From c9d5a4fbd5850e2ca0c2f74034c23e78f48b5468 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 27 Jan 2023 19:42:21 +0000 Subject: [PATCH] CodeGen from PR 22328 in Azure/azure-rest-api-specs Merge 30bf4630b5d7b1a9021ccda62108ad1e6a3d33c9 into 6e290d0b310e87d56cfa98cababea00b489d2c07 --- .../monitor/armmonitor/CHANGELOG.md | 60 + .../monitor/armmonitor/actiongroups_client.go | 120 +- .../actiongroups_client_example_test.go | 677 --------- .../armmonitor/activitylogalerts_client.go | 56 +- .../activitylogalerts_client_example_test.go | 282 ---- .../monitor/armmonitor/activitylogs_client.go | 37 +- .../activitylogs_client_example_test.go | 66 - .../armmonitor/alertruleincidents_client.go | 24 +- .../alertruleincidents_client_example_test.go | 60 - .../monitor/armmonitor/alertrules_client.go | 52 +- .../alertrules_client_example_test.go | 183 --- .../monitor/armmonitor/autorest.md | 6 +- .../armmonitor/autoscalesettings_client.go | 56 +- .../autoscalesettings_client_example_test.go | 422 ------ .../azuremonitorworkspaces_client.go | 408 ++++++ .../monitor/armmonitor/baselines_client.go | 9 +- .../baselines_client_example_test.go | 50 - .../monitor/armmonitor/client.go | 105 ++ .../monitor/armmonitor/constants.go | 93 +- .../datacollectionendpoints_client.go | 54 +- ...collectionendpoints_client_example_test.go | 155 --- .../datacollectionruleassociations_client.go | 58 +- ...ionruleassociations_client_example_test.go | 150 -- .../armmonitor/datacollectionrules_client.go | 52 +- ...datacollectionrules_client_example_test.go | 229 ---- .../armmonitor/diagnosticsettings_client.go | 37 +- .../diagnosticsettings_client_example_test.go | 213 --- .../diagnosticsettingscategory_client.go | 20 +- ...ticsettingscategory_client_example_test.go | 60 - .../armmonitor/eventcategories_client.go | 8 +- .../eventcategories_client_example_test.go | 41 - sdk/resourcemanager/monitor/armmonitor/go.mod | 14 +- sdk/resourcemanager/monitor/armmonitor/go.sum | 24 +- .../monitor/armmonitor/logprofiles_client.go | 35 +- .../logprofiles_client_example_test.go | 151 --- .../monitor/armmonitor/metricalerts_client.go | 52 +- .../metricalerts_client_example_test.go | 697 ---------- .../armmonitor/metricalertsstatus_client.go | 24 +- .../metricalertsstatus_client_example_test.go | 55 - .../armmonitor/metricdefinitions_client.go | 10 +- .../metricdefinitions_client_example_test.go | 90 -- .../armmonitor/metricnamespaces_client.go | 10 +- .../metricnamespaces_client_example_test.go | 42 - .../monitor/armmonitor/metrics_client.go | 9 +- .../armmonitor/metrics_client_example_test.go | 102 -- .../monitor/armmonitor/models.go | 394 +++++- .../monitor/armmonitor/models_serde.go | 1205 +++++++++++++---- .../monitor/armmonitor/operations_client.go | 7 +- .../operations_client_example_test.go | 36 - .../monitor/armmonitor/polymorphic_helpers.go | 10 +- .../armmonitor/predictivemetric_client.go | 25 +- .../predictivemetric_client_example_test.go | 36 - .../privateendpointconnections_client.go | 50 +- ...endpointconnections_client_example_test.go | 107 -- .../armmonitor/privatelinkresources_client.go | 26 +- ...rivatelinkresources_client_example_test.go | 55 - .../privatelinkscopedresources_client.go | 50 +- ...linkscopedresources_client_example_test.go | 109 -- .../privatelinkscopeoperationstatus_client.go | 15 +- ...copeoperationstatus_client_example_test.go | 36 - .../armmonitor/privatelinkscopes_client.go | 56 +- .../privatelinkscopes_client_example_test.go | 189 --- .../monitor/armmonitor/response_types.go | 115 +- .../armmonitor/scheduledqueryrules_client.go | 80 +- ...scheduledqueryrules_client_example_test.go | 325 ----- .../armmonitor/tenantactivitylogs_client.go | 8 +- .../tenantactivitylogs_client_example_test.go | 122 -- .../monitor/armmonitor/time_rfc3339.go | 2 +- .../monitor/armmonitor/vminsights_client.go | 11 +- .../vminsights_client_example_test.go | 112 -- 70 files changed, 2643 insertions(+), 5696 deletions(-) delete mode 100644 sdk/resourcemanager/monitor/armmonitor/actiongroups_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/activitylogs_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/alertrules_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client_example_test.go create mode 100644 sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/baselines_client_example_test.go create mode 100644 sdk/resourcemanager/monitor/armmonitor/client.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/eventcategories_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/logprofiles_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/metricalerts_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/metrics_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/operations_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/predictivemetric_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/vminsights_client_example_test.go diff --git a/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md b/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md index af065ac329a6..d3e92d642149 100644 --- a/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md +++ b/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md @@ -1,5 +1,65 @@ # Release History +## 0.9.0 (2023-01-27) +### Breaking Changes + +- Type of `DynamicMetricCriteria.AdditionalProperties` has been changed from `map[string]interface{}` to `map[string]any` +- Type of `ErrorAdditionalInfo.Info` has been changed from `interface{}` to `any` +- Type of `ErrorResponseAdditionalInfo.Info` has been changed from `interface{}` to `any` +- Type of `ExtensionDataSource.ExtensionSettings` has been changed from `interface{}` to `any` +- Type of `MetricAlertCriteria.AdditionalProperties` has been changed from `map[string]interface{}` to `map[string]any` +- Type of `MetricAlertMultipleResourceMultipleMetricCriteria.AdditionalProperties` has been changed from `map[string]interface{}` to `map[string]any` +- Type of `MetricAlertSingleResourceMultipleMetricCriteria.AdditionalProperties` has been changed from `map[string]interface{}` to `map[string]any` +- Type of `MetricCriteria.AdditionalProperties` has been changed from `map[string]interface{}` to `map[string]any` +- Type of `MultiMetricCriteria.AdditionalProperties` has been changed from `map[string]interface{}` to `map[string]any` +- Type of `WebtestLocationAvailabilityCriteria.AdditionalProperties` has been changed from `map[string]interface{}` to `map[string]any` + +### Features Added + +- New type alias `ActionType` with values `ActionTypeInternal` +- New type alias `IdentityType` with values `IdentityTypeNone`, `IdentityTypeSystemAssigned`, `IdentityTypeUserAssigned` +- New type alias `Origin` with values `OriginSystem`, `OriginUser`, `OriginUserSystem` +- New type alias `ProvisioningState` with values `ProvisioningStateCanceled`, `ProvisioningStateCreating`, `ProvisioningStateDeleting`, `ProvisioningStateFailed`, `ProvisioningStateSucceeded` +- New type alias `PublicNetworkAccess` with values `PublicNetworkAccessDisabled`, `PublicNetworkAccessEnabled`, `PublicNetworkAccessSecuredByPerimeter` +- New function `NewAzureMonitorWorkspacesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AzureMonitorWorkspacesClient, error)` +- New function `*AzureMonitorWorkspacesClient.Create(context.Context, string, string, AzureMonitorWorkspaceResource, *AzureMonitorWorkspacesClientCreateOptions) (AzureMonitorWorkspacesClientCreateResponse, error)` +- New function `*AzureMonitorWorkspacesClient.Delete(context.Context, string, string, *AzureMonitorWorkspacesClientDeleteOptions) (AzureMonitorWorkspacesClientDeleteResponse, error)` +- New function `*AzureMonitorWorkspacesClient.Get(context.Context, string, string, *AzureMonitorWorkspacesClientGetOptions) (AzureMonitorWorkspacesClientGetResponse, error)` +- New function `*AzureMonitorWorkspacesClient.NewListByResourceGroupPager(string, *AzureMonitorWorkspacesClientListByResourceGroupOptions) *runtime.Pager[AzureMonitorWorkspacesClientListByResourceGroupResponse]` +- New function `*AzureMonitorWorkspacesClient.NewListBySubscriptionPager(*AzureMonitorWorkspacesClientListBySubscriptionOptions) *runtime.Pager[AzureMonitorWorkspacesClientListBySubscriptionResponse]` +- New function `*AzureMonitorWorkspacesClient.Update(context.Context, string, string, *AzureMonitorWorkspacesClientUpdateOptions) (AzureMonitorWorkspacesClientUpdateResponse, error)` +- New function `NewClient(azcore.TokenCredential, *arm.ClientOptions) (*Client, error)` +- New function `*Client.NewOperationsListPager(*ClientOperationsListOptions) *runtime.Pager[ClientOperationsListResponse]` +- New struct `AzureMonitorWorkspace` +- New struct `AzureMonitorWorkspaceDefaultIngestionSettings` +- New struct `AzureMonitorWorkspaceMetrics` +- New struct `AzureMonitorWorkspaceResource` +- New struct `AzureMonitorWorkspaceResourceForUpdate` +- New struct `AzureMonitorWorkspaceResourceListResult` +- New struct `AzureMonitorWorkspaceResourceProperties` +- New struct `AzureMonitorWorkspacesClient` +- New struct `AzureMonitorWorkspacesClientListByResourceGroupResponse` +- New struct `AzureMonitorWorkspacesClientListBySubscriptionResponse` +- New struct `Client` +- New struct `ClientOperationsListResponse` +- New struct `ErrorDetailAutoGenerated` +- New struct `ErrorResponseAutoGenerated2` +- New struct `Identity` +- New struct `IngestionSettings` +- New struct `Metrics` +- New struct `OperationAutoGenerated` +- New struct `OperationDisplayAutoGenerated` +- New struct `OperationListResultAutoGenerated` +- New struct `ResourceAutoGenerated5` +- New struct `RuleResolveConfiguration` +- New struct `TrackedResourceAutoGenerated` +- New struct `UserIdentityProperties` +- New field `PublicNetworkAccess` in struct `ScheduledQueryRuleProperties` +- New field `RuleResolveConfiguration` in struct `ScheduledQueryRuleProperties` +- New field `Identity` in struct `ScheduledQueryRuleResource` +- New field `Identity` in struct `ScheduledQueryRuleResourcePatch` + + ## 0.8.0 (2022-10-18) ### Breaking Changes diff --git a/sdk/resourcemanager/monitor/armmonitor/actiongroups_client.go b/sdk/resourcemanager/monitor/armmonitor/actiongroups_client.go index d4469f36114a..259ddb95d4d7 100644 --- a/sdk/resourcemanager/monitor/armmonitor/actiongroups_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/actiongroups_client.go @@ -32,9 +32,9 @@ type ActionGroupsClient struct { } // NewActionGroupsClient creates a new instance of ActionGroupsClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewActionGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ActionGroupsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,12 +57,13 @@ func NewActionGroupsClient(subscriptionID string, credential azcore.TokenCredent // BeginCreateNotificationsAtActionGroupResourceLevel - Send test notifications to a set of provided receivers // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-06-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// actionGroupName - The name of the action group. -// notificationRequest - The notification request body which includes the contact details -// options - ActionGroupsClientBeginCreateNotificationsAtActionGroupResourceLevelOptions contains the optional parameters -// for the ActionGroupsClient.BeginCreateNotificationsAtActionGroupResourceLevel method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - actionGroupName - The name of the action group. +// - notificationRequest - The notification request body which includes the contact details +// - options - ActionGroupsClientBeginCreateNotificationsAtActionGroupResourceLevelOptions contains the optional parameters +// for the ActionGroupsClient.BeginCreateNotificationsAtActionGroupResourceLevel method. func (client *ActionGroupsClient) BeginCreateNotificationsAtActionGroupResourceLevel(ctx context.Context, resourceGroupName string, actionGroupName string, notificationRequest NotificationRequestBody, options *ActionGroupsClientBeginCreateNotificationsAtActionGroupResourceLevelOptions) (*runtime.Poller[ActionGroupsClientCreateNotificationsAtActionGroupResourceLevelResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createNotificationsAtActionGroupResourceLevel(ctx, resourceGroupName, actionGroupName, notificationRequest, options) @@ -79,6 +80,7 @@ func (client *ActionGroupsClient) BeginCreateNotificationsAtActionGroupResourceL // CreateNotificationsAtActionGroupResourceLevel - Send test notifications to a set of provided receivers // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-06-01 func (client *ActionGroupsClient) createNotificationsAtActionGroupResourceLevel(ctx context.Context, resourceGroupName string, actionGroupName string, notificationRequest NotificationRequestBody, options *ActionGroupsClientBeginCreateNotificationsAtActionGroupResourceLevelOptions) (*http.Response, error) { req, err := client.createNotificationsAtActionGroupResourceLevelCreateRequest(ctx, resourceGroupName, actionGroupName, notificationRequest, options) @@ -123,11 +125,12 @@ func (client *ActionGroupsClient) createNotificationsAtActionGroupResourceLevelC // BeginCreateNotificationsAtResourceGroupLevel - Send test notifications to a set of provided receivers // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-06-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// notificationRequest - The notification request body which includes the contact details -// options - ActionGroupsClientBeginCreateNotificationsAtResourceGroupLevelOptions contains the optional parameters for the -// ActionGroupsClient.BeginCreateNotificationsAtResourceGroupLevel method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - notificationRequest - The notification request body which includes the contact details +// - options - ActionGroupsClientBeginCreateNotificationsAtResourceGroupLevelOptions contains the optional parameters for the +// ActionGroupsClient.BeginCreateNotificationsAtResourceGroupLevel method. func (client *ActionGroupsClient) BeginCreateNotificationsAtResourceGroupLevel(ctx context.Context, resourceGroupName string, notificationRequest NotificationRequestBody, options *ActionGroupsClientBeginCreateNotificationsAtResourceGroupLevelOptions) (*runtime.Poller[ActionGroupsClientCreateNotificationsAtResourceGroupLevelResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createNotificationsAtResourceGroupLevel(ctx, resourceGroupName, notificationRequest, options) @@ -144,6 +147,7 @@ func (client *ActionGroupsClient) BeginCreateNotificationsAtResourceGroupLevel(c // CreateNotificationsAtResourceGroupLevel - Send test notifications to a set of provided receivers // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-06-01 func (client *ActionGroupsClient) createNotificationsAtResourceGroupLevel(ctx context.Context, resourceGroupName string, notificationRequest NotificationRequestBody, options *ActionGroupsClientBeginCreateNotificationsAtResourceGroupLevelOptions) (*http.Response, error) { req, err := client.createNotificationsAtResourceGroupLevelCreateRequest(ctx, resourceGroupName, notificationRequest, options) @@ -184,12 +188,13 @@ func (client *ActionGroupsClient) createNotificationsAtResourceGroupLevelCreateR // CreateOrUpdate - Create a new action group or update an existing one. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-06-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// actionGroupName - The name of the action group. -// actionGroup - The action group to create or use for the update. -// options - ActionGroupsClientCreateOrUpdateOptions contains the optional parameters for the ActionGroupsClient.CreateOrUpdate -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - actionGroupName - The name of the action group. +// - actionGroup - The action group to create or use for the update. +// - options - ActionGroupsClientCreateOrUpdateOptions contains the optional parameters for the ActionGroupsClient.CreateOrUpdate +// method. func (client *ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource, options *ActionGroupsClientCreateOrUpdateOptions) (ActionGroupsClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, actionGroupName, actionGroup, options) if err != nil { @@ -242,10 +247,11 @@ func (client *ActionGroupsClient) createOrUpdateHandleResponse(resp *http.Respon // Delete - Delete an action group. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-06-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// actionGroupName - The name of the action group. -// options - ActionGroupsClientDeleteOptions contains the optional parameters for the ActionGroupsClient.Delete method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - actionGroupName - The name of the action group. +// - options - ActionGroupsClientDeleteOptions contains the optional parameters for the ActionGroupsClient.Delete method. func (client *ActionGroupsClient) Delete(ctx context.Context, resourceGroupName string, actionGroupName string, options *ActionGroupsClientDeleteOptions) (ActionGroupsClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, actionGroupName, options) if err != nil { @@ -290,12 +296,13 @@ func (client *ActionGroupsClient) deleteCreateRequest(ctx context.Context, resou // EnableReceiver - Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. This // operation is only supported for Email or SMS receivers. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-06-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// actionGroupName - The name of the action group. -// enableRequest - The receiver to re-enable. -// options - ActionGroupsClientEnableReceiverOptions contains the optional parameters for the ActionGroupsClient.EnableReceiver -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - actionGroupName - The name of the action group. +// - enableRequest - The receiver to re-enable. +// - options - ActionGroupsClientEnableReceiverOptions contains the optional parameters for the ActionGroupsClient.EnableReceiver +// method. func (client *ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest, options *ActionGroupsClientEnableReceiverOptions) (ActionGroupsClientEnableReceiverResponse, error) { req, err := client.enableReceiverCreateRequest(ctx, resourceGroupName, actionGroupName, enableRequest, options) if err != nil { @@ -339,10 +346,11 @@ func (client *ActionGroupsClient) enableReceiverCreateRequest(ctx context.Contex // Get - Get an action group. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-06-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// actionGroupName - The name of the action group. -// options - ActionGroupsClientGetOptions contains the optional parameters for the ActionGroupsClient.Get method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - actionGroupName - The name of the action group. +// - options - ActionGroupsClientGetOptions contains the optional parameters for the ActionGroupsClient.Get method. func (client *ActionGroupsClient) Get(ctx context.Context, resourceGroupName string, actionGroupName string, options *ActionGroupsClientGetOptions) (ActionGroupsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, actionGroupName, options) if err != nil { @@ -395,10 +403,11 @@ func (client *ActionGroupsClient) getHandleResponse(resp *http.Response) (Action // GetTestNotifications - Get the test notifications by the notification id // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-06-01 -// notificationID - The notification id -// options - ActionGroupsClientGetTestNotificationsOptions contains the optional parameters for the ActionGroupsClient.GetTestNotifications -// method. +// - notificationID - The notification id +// - options - ActionGroupsClientGetTestNotificationsOptions contains the optional parameters for the ActionGroupsClient.GetTestNotifications +// method. func (client *ActionGroupsClient) GetTestNotifications(ctx context.Context, notificationID string, options *ActionGroupsClientGetTestNotificationsOptions) (ActionGroupsClientGetTestNotificationsResponse, error) { req, err := client.getTestNotificationsCreateRequest(ctx, notificationID, options) if err != nil { @@ -447,12 +456,13 @@ func (client *ActionGroupsClient) getTestNotificationsHandleResponse(resp *http. // GetTestNotificationsAtActionGroupResourceLevel - Get the test notifications by the notification id // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-06-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// actionGroupName - The name of the action group. -// notificationID - The notification id -// options - ActionGroupsClientGetTestNotificationsAtActionGroupResourceLevelOptions contains the optional parameters for -// the ActionGroupsClient.GetTestNotificationsAtActionGroupResourceLevel method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - actionGroupName - The name of the action group. +// - notificationID - The notification id +// - options - ActionGroupsClientGetTestNotificationsAtActionGroupResourceLevelOptions contains the optional parameters for +// the ActionGroupsClient.GetTestNotificationsAtActionGroupResourceLevel method. func (client *ActionGroupsClient) GetTestNotificationsAtActionGroupResourceLevel(ctx context.Context, resourceGroupName string, actionGroupName string, notificationID string, options *ActionGroupsClientGetTestNotificationsAtActionGroupResourceLevelOptions) (ActionGroupsClientGetTestNotificationsAtActionGroupResourceLevelResponse, error) { req, err := client.getTestNotificationsAtActionGroupResourceLevelCreateRequest(ctx, resourceGroupName, actionGroupName, notificationID, options) if err != nil { @@ -509,11 +519,12 @@ func (client *ActionGroupsClient) getTestNotificationsAtActionGroupResourceLevel // GetTestNotificationsAtResourceGroupLevel - Get the test notifications by the notification id // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-06-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// notificationID - The notification id -// options - ActionGroupsClientGetTestNotificationsAtResourceGroupLevelOptions contains the optional parameters for the ActionGroupsClient.GetTestNotificationsAtResourceGroupLevel -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - notificationID - The notification id +// - options - ActionGroupsClientGetTestNotificationsAtResourceGroupLevelOptions contains the optional parameters for the ActionGroupsClient.GetTestNotificationsAtResourceGroupLevel +// method. func (client *ActionGroupsClient) GetTestNotificationsAtResourceGroupLevel(ctx context.Context, resourceGroupName string, notificationID string, options *ActionGroupsClientGetTestNotificationsAtResourceGroupLevelOptions) (ActionGroupsClientGetTestNotificationsAtResourceGroupLevelResponse, error) { req, err := client.getTestNotificationsAtResourceGroupLevelCreateRequest(ctx, resourceGroupName, notificationID, options) if err != nil { @@ -565,10 +576,11 @@ func (client *ActionGroupsClient) getTestNotificationsAtResourceGroupLevelHandle } // NewListByResourceGroupPager - Get a list of all action groups in a resource group. +// // Generated from API version 2022-06-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - ActionGroupsClientListByResourceGroupOptions contains the optional parameters for the ActionGroupsClient.ListByResourceGroup -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ActionGroupsClientListByResourceGroupOptions contains the optional parameters for the ActionGroupsClient.NewListByResourceGroupPager +// method. func (client *ActionGroupsClient) NewListByResourceGroupPager(resourceGroupName string, options *ActionGroupsClientListByResourceGroupOptions) *runtime.Pager[ActionGroupsClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[ActionGroupsClientListByResourceGroupResponse]{ More: func(page ActionGroupsClientListByResourceGroupResponse) bool { @@ -623,9 +635,10 @@ func (client *ActionGroupsClient) listByResourceGroupHandleResponse(resp *http.R } // NewListBySubscriptionIDPager - Get a list of all action groups in a subscription. +// // Generated from API version 2022-06-01 -// options - ActionGroupsClientListBySubscriptionIDOptions contains the optional parameters for the ActionGroupsClient.ListBySubscriptionID -// method. +// - options - ActionGroupsClientListBySubscriptionIDOptions contains the optional parameters for the ActionGroupsClient.NewListBySubscriptionIDPager +// method. func (client *ActionGroupsClient) NewListBySubscriptionIDPager(options *ActionGroupsClientListBySubscriptionIDOptions) *runtime.Pager[ActionGroupsClientListBySubscriptionIDResponse] { return runtime.NewPager(runtime.PagingHandler[ActionGroupsClientListBySubscriptionIDResponse]{ More: func(page ActionGroupsClientListBySubscriptionIDResponse) bool { @@ -677,10 +690,11 @@ func (client *ActionGroupsClient) listBySubscriptionIDHandleResponse(resp *http. // BeginPostTestNotifications - Send test notifications to a set of provided receivers // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-06-01 -// notificationRequest - The notification request body which includes the contact details -// options - ActionGroupsClientBeginPostTestNotificationsOptions contains the optional parameters for the ActionGroupsClient.BeginPostTestNotifications -// method. +// - notificationRequest - The notification request body which includes the contact details +// - options - ActionGroupsClientBeginPostTestNotificationsOptions contains the optional parameters for the ActionGroupsClient.BeginPostTestNotifications +// method. func (client *ActionGroupsClient) BeginPostTestNotifications(ctx context.Context, notificationRequest NotificationRequestBody, options *ActionGroupsClientBeginPostTestNotificationsOptions) (*runtime.Poller[ActionGroupsClientPostTestNotificationsResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.postTestNotifications(ctx, notificationRequest, options) @@ -697,6 +711,7 @@ func (client *ActionGroupsClient) BeginPostTestNotifications(ctx context.Context // PostTestNotifications - Send test notifications to a set of provided receivers // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-06-01 func (client *ActionGroupsClient) postTestNotifications(ctx context.Context, notificationRequest NotificationRequestBody, options *ActionGroupsClientBeginPostTestNotificationsOptions) (*http.Response, error) { req, err := client.postTestNotificationsCreateRequest(ctx, notificationRequest, options) @@ -733,11 +748,12 @@ func (client *ActionGroupsClient) postTestNotificationsCreateRequest(ctx context // Update - Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-06-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// actionGroupName - The name of the action group. -// actionGroupPatch - Parameters supplied to the operation. -// options - ActionGroupsClientUpdateOptions contains the optional parameters for the ActionGroupsClient.Update method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - actionGroupName - The name of the action group. +// - actionGroupPatch - Parameters supplied to the operation. +// - options - ActionGroupsClientUpdateOptions contains the optional parameters for the ActionGroupsClient.Update method. func (client *ActionGroupsClient) Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody, options *ActionGroupsClientUpdateOptions) (ActionGroupsClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, actionGroupName, actionGroupPatch, options) if err != nil { diff --git a/sdk/resourcemanager/monitor/armmonitor/actiongroups_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/actiongroups_client_example_test.go deleted file mode 100644 index 8e085c40f54f..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/actiongroups_client_example_test.go +++ /dev/null @@ -1,677 +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. - -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/tree/main/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-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() - client, err := armmonitor.NewActionGroupsClient("187f412d-1758-44d9-b052-169e2564721d", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-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() - client, err := armmonitor.NewActionGroupsClient("187f412d-1758-44d9-b052-169e2564721d", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "Default-NotificationRules", "SampleActionGroup", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-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() - client, err := armmonitor.NewActionGroupsClient("187f412d-1758-44d9-b052-169e2564721d", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.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/tree/main/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-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() - client, err := armmonitor.NewActionGroupsClient("187f412d-1758-44d9-b052-169e2564721d", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/postTestNotifications.json -func ExampleActionGroupsClient_BeginPostTestNotifications() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmonitor.NewActionGroupsClient("187f412d-1758-44d9-b052-169e2564721d", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginPostTestNotifications(ctx, 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/postTestNotificationsAtResourceGroupLevel.json -func ExampleActionGroupsClient_BeginCreateNotificationsAtResourceGroupLevel() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmonitor.NewActionGroupsClient("187f412d-1758-44d9-b052-169e2564721d", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateNotificationsAtResourceGroupLevel(ctx, "Default-TestNotifications", 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-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() - client, err := armmonitor.NewActionGroupsClient("11111111-1111-1111-1111-111111111111", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/getTestNotifications.json -func ExampleActionGroupsClient_GetTestNotifications() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmonitor.NewActionGroupsClient("187f412d-1758-44d9-b052-169e2564721d", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetTestNotifications(ctx, "11000222191287", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/getTestNotificationsAtResourceGroupLevel.json -func ExampleActionGroupsClient_GetTestNotificationsAtResourceGroupLevel() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmonitor.NewActionGroupsClient("187f412d-1758-44d9-b052-169e2564721d", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetTestNotificationsAtResourceGroupLevel(ctx, "Default-TestNotifications", "11000222191287", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-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() - client, err := armmonitor.NewActionGroupsClient("11111111-1111-1111-1111-111111111111", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetTestNotificationsAtActionGroupResourceLevel(ctx, "TestRgName", "TestAgName", "11000222191287", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-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() - client, err := armmonitor.NewActionGroupsClient("187f412d-1758-44d9-b052-169e2564721d", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionIDPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-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() - client, err := armmonitor.NewActionGroupsClient("187f412d-1758-44d9-b052-169e2564721d", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.EnableReceiver(ctx, "Default-NotificationRules", "SampleActionGroup", armmonitor.EnableRequest{ - ReceiverName: to.Ptr("John Doe's mobile"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client.go b/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client.go index 94009f8182f9..e317cf152915 100644 --- a/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client.go @@ -32,9 +32,9 @@ type ActivityLogAlertsClient struct { } // NewActivityLogAlertsClient creates a new instance of ActivityLogAlertsClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewActivityLogAlertsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ActivityLogAlertsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,12 +57,13 @@ func NewActivityLogAlertsClient(subscriptionID string, credential azcore.TokenCr // CreateOrUpdate - Create a new Activity Log Alert rule or update an existing one. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-10-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// activityLogAlertName - The name of the Activity Log Alert rule. -// activityLogAlertRule - The Activity Log Alert rule to create or use for the update. -// options - ActivityLogAlertsClientCreateOrUpdateOptions contains the optional parameters for the ActivityLogAlertsClient.CreateOrUpdate -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - activityLogAlertName - The name of the Activity Log Alert rule. +// - activityLogAlertRule - The Activity Log Alert rule to create or use for the update. +// - options - ActivityLogAlertsClientCreateOrUpdateOptions contains the optional parameters for the ActivityLogAlertsClient.CreateOrUpdate +// method. func (client *ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertRule ActivityLogAlertResource, options *ActivityLogAlertsClientCreateOrUpdateOptions) (ActivityLogAlertsClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, activityLogAlertName, activityLogAlertRule, options) if err != nil { @@ -115,11 +116,12 @@ func (client *ActivityLogAlertsClient) createOrUpdateHandleResponse(resp *http.R // Delete - Delete an Activity Log Alert rule. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-10-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// activityLogAlertName - The name of the Activity Log Alert rule. -// options - ActivityLogAlertsClientDeleteOptions contains the optional parameters for the ActivityLogAlertsClient.Delete -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - activityLogAlertName - The name of the Activity Log Alert rule. +// - options - ActivityLogAlertsClientDeleteOptions contains the optional parameters for the ActivityLogAlertsClient.Delete +// method. func (client *ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string, options *ActivityLogAlertsClientDeleteOptions) (ActivityLogAlertsClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, activityLogAlertName, options) if err != nil { @@ -163,10 +165,11 @@ func (client *ActivityLogAlertsClient) deleteCreateRequest(ctx context.Context, // Get - Get an Activity Log Alert rule. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-10-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// activityLogAlertName - The name of the Activity Log Alert rule. -// options - ActivityLogAlertsClientGetOptions contains the optional parameters for the ActivityLogAlertsClient.Get method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - activityLogAlertName - The name of the Activity Log Alert rule. +// - options - ActivityLogAlertsClientGetOptions contains the optional parameters for the ActivityLogAlertsClient.Get method. func (client *ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName string, activityLogAlertName string, options *ActivityLogAlertsClientGetOptions) (ActivityLogAlertsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, activityLogAlertName, options) if err != nil { @@ -218,10 +221,11 @@ func (client *ActivityLogAlertsClient) getHandleResponse(resp *http.Response) (A } // NewListByResourceGroupPager - Get a list of all Activity Log Alert rules in a resource group. +// // Generated from API version 2020-10-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - ActivityLogAlertsClientListByResourceGroupOptions contains the optional parameters for the ActivityLogAlertsClient.ListByResourceGroup -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ActivityLogAlertsClientListByResourceGroupOptions contains the optional parameters for the ActivityLogAlertsClient.NewListByResourceGroupPager +// method. func (client *ActivityLogAlertsClient) NewListByResourceGroupPager(resourceGroupName string, options *ActivityLogAlertsClientListByResourceGroupOptions) *runtime.Pager[ActivityLogAlertsClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[ActivityLogAlertsClientListByResourceGroupResponse]{ More: func(page ActivityLogAlertsClientListByResourceGroupResponse) bool { @@ -282,9 +286,10 @@ func (client *ActivityLogAlertsClient) listByResourceGroupHandleResponse(resp *h } // NewListBySubscriptionIDPager - Get a list of all Activity Log Alert rules in a subscription. +// // Generated from API version 2020-10-01 -// options - ActivityLogAlertsClientListBySubscriptionIDOptions contains the optional parameters for the ActivityLogAlertsClient.ListBySubscriptionID -// method. +// - options - ActivityLogAlertsClientListBySubscriptionIDOptions contains the optional parameters for the ActivityLogAlertsClient.NewListBySubscriptionIDPager +// method. func (client *ActivityLogAlertsClient) NewListBySubscriptionIDPager(options *ActivityLogAlertsClientListBySubscriptionIDOptions) *runtime.Pager[ActivityLogAlertsClientListBySubscriptionIDResponse] { return runtime.NewPager(runtime.PagingHandler[ActivityLogAlertsClientListBySubscriptionIDResponse]{ More: func(page ActivityLogAlertsClientListBySubscriptionIDResponse) bool { @@ -344,12 +349,13 @@ func (client *ActivityLogAlertsClient) listBySubscriptionIDHandleResponse(resp * // and to enable or disable the Alert rule. To update other fields use CreateOrUpdate // operation. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2020-10-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// activityLogAlertName - The name of the Activity Log Alert rule. -// activityLogAlertRulePatch - Parameters supplied to the operation. -// options - ActivityLogAlertsClientUpdateOptions contains the optional parameters for the ActivityLogAlertsClient.Update -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - activityLogAlertName - The name of the Activity Log Alert rule. +// - activityLogAlertRulePatch - Parameters supplied to the operation. +// - options - ActivityLogAlertsClientUpdateOptions contains the optional parameters for the ActivityLogAlertsClient.Update +// method. func (client *ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertRulePatch AlertRulePatchObject, options *ActivityLogAlertsClientUpdateOptions) (ActivityLogAlertsClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, activityLogAlertName, activityLogAlertRulePatch, options) if err != nil { diff --git a/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client_example_test.go deleted file mode 100644 index 0a0fa72cf693..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client_example_test.go +++ /dev/null @@ -1,282 +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. - -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/tree/main/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() - client, err := armmonitor.NewActivityLogAlertsClient("187f412d-1758-44d9-b052-169e2564721d", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewActivityLogAlertsClient("187f412d-1758-44d9-b052-169e2564721d", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewActivityLogAlertsClient("187f412d-1758-44d9-b052-169e2564721d", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewActivityLogAlertsClient("187f412d-1758-44d9-b052-169e2564721d", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "MyResourceGroup", "SampleActivityLogAlertRule", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewActivityLogAlertsClient("187f412d-1758-44d9-b052-169e2564721d", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.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/tree/main/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() - client, err := armmonitor.NewActivityLogAlertsClient("187f412d-1758-44d9-b052-169e2564721d", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewActivityLogAlertsClient("187f412d-1758-44d9-b052-169e2564721d", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionIDPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewActivityLogAlertsClient("187f412d-1758-44d9-b052-169e2564721d", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("MyResourceGroup", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/activitylogs_client.go b/sdk/resourcemanager/monitor/armmonitor/activitylogs_client.go index cc1828a93d39..625a2c0e46a5 100644 --- a/sdk/resourcemanager/monitor/armmonitor/activitylogs_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/activitylogs_client.go @@ -32,9 +32,9 @@ type ActivityLogsClient struct { } // NewActivityLogsClient creates a new instance of ActivityLogsClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewActivityLogsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ActivityLogsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -56,22 +56,23 @@ func NewActivityLogsClient(subscriptionID string, credential azcore.TokenCredent } // NewListPager - Provides the list of records from the activity logs. +// // Generated from API version 2015-04-01 -// filter - Reduces the set of data collected. -// This argument is required and it also requires at least the start date/time. -// The $filter argument is very restricted and allows only the following patterns. -// - List events for a resource group: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' -// and resourceGroupName eq 'resourceGroupName'. -// - List events for resource: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' -// and resourceUri eq 'resourceURI'. -// - List events for a subscription in a time range: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp -// le '2014-07-20T04:36:37.6407898Z'. -// - List events for a resource provider: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' -// and resourceProvider eq 'resourceProviderName'. -// - List events for a correlation Id: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' -// and correlationId eq 'correlationID'. -// NOTE: No other syntax is allowed. -// options - ActivityLogsClientListOptions contains the optional parameters for the ActivityLogsClient.List method. +// - filter - Reduces the set of data collected. +// This argument is required and it also requires at least the start date/time. +// The $filter argument is very restricted and allows only the following patterns. +// - List events for a resource group: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' +// and resourceGroupName eq 'resourceGroupName'. +// - List events for resource: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' +// and resourceUri eq 'resourceURI'. +// - List events for a subscription in a time range: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp +// le '2014-07-20T04:36:37.6407898Z'. +// - List events for a resource provider: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' +// and resourceProvider eq 'resourceProviderName'. +// - List events for a correlation Id: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' +// and correlationId eq 'correlationID'. +// NOTE: No other syntax is allowed. +// - options - ActivityLogsClientListOptions contains the optional parameters for the ActivityLogsClient.NewListPager method. func (client *ActivityLogsClient) NewListPager(filter string, options *ActivityLogsClientListOptions) *runtime.Pager[ActivityLogsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ActivityLogsClientListResponse]{ More: func(page ActivityLogsClientListResponse) bool { 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 b5366f39e3fb..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/activitylogs_client_example_test.go +++ /dev/null @@ -1,66 +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. - -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/tree/main/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() - client, err := armmonitor.NewActivityLogsClient("089bd33f-d4ec-47fe-8ba5-0753aa5c5b33", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.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() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewActivityLogsClient("089bd33f-d4ec-47fe-8ba5-0753aa5c5b33", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.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() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client.go b/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client.go index cf918875e7e6..034f3dc00a93 100644 --- a/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client.go @@ -32,9 +32,9 @@ type AlertRuleIncidentsClient struct { } // NewAlertRuleIncidentsClient creates a new instance of AlertRuleIncidentsClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewAlertRuleIncidentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertRuleIncidentsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,11 +57,12 @@ func NewAlertRuleIncidentsClient(subscriptionID string, credential azcore.TokenC // Get - Gets an incident associated to an alert rule // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2016-03-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// ruleName - The name of the rule. -// incidentName - The name of the incident to retrieve. -// options - AlertRuleIncidentsClientGetOptions contains the optional parameters for the AlertRuleIncidentsClient.Get method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - ruleName - The name of the rule. +// - incidentName - The name of the incident to retrieve. +// - options - AlertRuleIncidentsClientGetOptions contains the optional parameters for the AlertRuleIncidentsClient.Get method. func (client *AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string, options *AlertRuleIncidentsClientGetOptions) (AlertRuleIncidentsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, ruleName, incidentName, options) if err != nil { @@ -117,11 +118,12 @@ func (client *AlertRuleIncidentsClient) getHandleResponse(resp *http.Response) ( } // NewListByAlertRulePager - Gets a list of incidents associated to an alert rule +// // Generated from API version 2016-03-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// ruleName - The name of the rule. -// options - AlertRuleIncidentsClientListByAlertRuleOptions contains the optional parameters for the AlertRuleIncidentsClient.ListByAlertRule -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - ruleName - The name of the rule. +// - options - AlertRuleIncidentsClientListByAlertRuleOptions contains the optional parameters for the AlertRuleIncidentsClient.NewListByAlertRulePager +// method. func (client *AlertRuleIncidentsClient) NewListByAlertRulePager(resourceGroupName string, ruleName string, options *AlertRuleIncidentsClientListByAlertRuleOptions) *runtime.Pager[AlertRuleIncidentsClientListByAlertRuleResponse] { return runtime.NewPager(runtime.PagingHandler[AlertRuleIncidentsClientListByAlertRuleResponse]{ More: func(page AlertRuleIncidentsClientListByAlertRuleResponse) bool { 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 2368333fea49..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client_example_test.go +++ /dev/null @@ -1,60 +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. - -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/tree/main/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() - client, err := armmonitor.NewAlertRuleIncidentsClient("b67f7fec-69fc-4974-9099-a26bd6ffeda3", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "Rac46PostSwapRG", "myRuleName", "Website_started", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewAlertRuleIncidentsClient("b67f7fec-69fc-4974-9099-a26bd6ffeda3", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByAlertRulePager("Rac46PostSwapRG", "myRuleName", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/alertrules_client.go b/sdk/resourcemanager/monitor/armmonitor/alertrules_client.go index 99e6c61cc307..4389be0ecdd0 100644 --- a/sdk/resourcemanager/monitor/armmonitor/alertrules_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/alertrules_client.go @@ -32,9 +32,9 @@ type AlertRulesClient struct { } // NewAlertRulesClient creates a new instance of AlertRulesClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewAlertRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertRulesClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,12 +57,13 @@ func NewAlertRulesClient(subscriptionID string, credential azcore.TokenCredentia // CreateOrUpdate - Creates or updates a classic metric alert rule. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2016-03-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// ruleName - The name of the rule. -// parameters - The parameters of the rule to create or update. -// options - AlertRulesClientCreateOrUpdateOptions contains the optional parameters for the AlertRulesClient.CreateOrUpdate -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - ruleName - The name of the rule. +// - parameters - The parameters of the rule to create or update. +// - options - AlertRulesClientCreateOrUpdateOptions contains the optional parameters for the AlertRulesClient.CreateOrUpdate +// method. func (client *AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource, options *AlertRulesClientCreateOrUpdateOptions) (AlertRulesClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, ruleName, parameters, options) if err != nil { @@ -115,10 +116,11 @@ func (client *AlertRulesClient) createOrUpdateHandleResponse(resp *http.Response // Delete - Deletes a classic metric alert rule // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2016-03-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// ruleName - The name of the rule. -// options - AlertRulesClientDeleteOptions contains the optional parameters for the AlertRulesClient.Delete method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - ruleName - The name of the rule. +// - options - AlertRulesClientDeleteOptions contains the optional parameters for the AlertRulesClient.Delete method. func (client *AlertRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName string, options *AlertRulesClientDeleteOptions) (AlertRulesClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, ruleName, options) if err != nil { @@ -162,10 +164,11 @@ func (client *AlertRulesClient) deleteCreateRequest(ctx context.Context, resourc // Get - Gets a classic metric alert rule // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2016-03-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// ruleName - The name of the rule. -// options - AlertRulesClientGetOptions contains the optional parameters for the AlertRulesClient.Get method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - ruleName - The name of the rule. +// - options - AlertRulesClientGetOptions contains the optional parameters for the AlertRulesClient.Get method. func (client *AlertRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string, options *AlertRulesClientGetOptions) (AlertRulesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, ruleName, options) if err != nil { @@ -217,10 +220,11 @@ func (client *AlertRulesClient) getHandleResponse(resp *http.Response) (AlertRul } // NewListByResourceGroupPager - List the classic metric alert rules within a resource group. +// // Generated from API version 2016-03-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - AlertRulesClientListByResourceGroupOptions contains the optional parameters for the AlertRulesClient.ListByResourceGroup -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - AlertRulesClientListByResourceGroupOptions contains the optional parameters for the AlertRulesClient.NewListByResourceGroupPager +// method. func (client *AlertRulesClient) NewListByResourceGroupPager(resourceGroupName string, options *AlertRulesClientListByResourceGroupOptions) *runtime.Pager[AlertRulesClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[AlertRulesClientListByResourceGroupResponse]{ More: func(page AlertRulesClientListByResourceGroupResponse) bool { @@ -275,9 +279,10 @@ func (client *AlertRulesClient) listByResourceGroupHandleResponse(resp *http.Res } // NewListBySubscriptionPager - List the classic metric alert rules within a subscription. +// // Generated from API version 2016-03-01 -// options - AlertRulesClientListBySubscriptionOptions contains the optional parameters for the AlertRulesClient.ListBySubscription -// method. +// - options - AlertRulesClientListBySubscriptionOptions contains the optional parameters for the AlertRulesClient.NewListBySubscriptionPager +// method. func (client *AlertRulesClient) NewListBySubscriptionPager(options *AlertRulesClientListBySubscriptionOptions) *runtime.Pager[AlertRulesClientListBySubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[AlertRulesClientListBySubscriptionResponse]{ More: func(page AlertRulesClientListBySubscriptionResponse) bool { @@ -329,11 +334,12 @@ func (client *AlertRulesClient) listBySubscriptionHandleResponse(resp *http.Resp // Update - Updates an existing classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2016-03-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// ruleName - The name of the rule. -// alertRulesResource - Parameters supplied to the operation. -// options - AlertRulesClientUpdateOptions contains the optional parameters for the AlertRulesClient.Update method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - ruleName - The name of the rule. +// - alertRulesResource - Parameters supplied to the operation. +// - options - AlertRulesClientUpdateOptions contains the optional parameters for the AlertRulesClient.Update method. func (client *AlertRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch, options *AlertRulesClientUpdateOptions) (AlertRulesClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, ruleName, alertRulesResource, options) if err != nil { diff --git a/sdk/resourcemanager/monitor/armmonitor/alertrules_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/alertrules_client_example_test.go deleted file mode 100644 index 0b85fd1e4b0f..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/alertrules_client_example_test.go +++ /dev/null @@ -1,183 +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. - -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/tree/main/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() - client, err := armmonitor.NewAlertRulesClient("b67f7fec-69fc-4974-9099-a26bd6ffeda3", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewAlertRulesClient("b67f7fec-69fc-4974-9099-a26bd6ffeda3", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.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/tree/main/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() - client, err := armmonitor.NewAlertRulesClient("b67f7fec-69fc-4974-9099-a26bd6ffeda3", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "Rac46PostSwapRG", "chiricutin", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewAlertRulesClient("b67f7fec-69fc-4974-9099-a26bd6ffeda3", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewAlertRulesClient("b67f7fec-69fc-4974-9099-a26bd6ffeda3", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("Rac46PostSwapRG", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewAlertRulesClient("b67f7fec-69fc-4974-9099-a26bd6ffeda3", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/autorest.md b/sdk/resourcemanager/monitor/armmonitor/autorest.md index ecb320c638a4..e64cc6a2f609 100644 --- a/sdk/resourcemanager/monitor/armmonitor/autorest.md +++ b/sdk/resourcemanager/monitor/armmonitor/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/68847d6ae901f0cb2efa62ae2c523ad8cf5c2ea3/specification/monitor/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/68847d6ae901f0cb2efa62ae2c523ad8cf5c2ea3/specification/monitor/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/monitor/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/monitor/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.8.0 +module-version: 0.9.0 ``` diff --git a/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client.go b/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client.go index 6bb9d3cd21eb..8e6c05d6714e 100644 --- a/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client.go @@ -32,9 +32,9 @@ type AutoscaleSettingsClient struct { } // NewAutoscaleSettingsClient creates a new instance of AutoscaleSettingsClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewAutoscaleSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AutoscaleSettingsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,12 +57,13 @@ func NewAutoscaleSettingsClient(subscriptionID string, credential azcore.TokenCr // CreateOrUpdate - Creates or updates an autoscale setting. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// autoscaleSettingName - The autoscale setting name. -// parameters - Parameters supplied to the operation. -// options - AutoscaleSettingsClientCreateOrUpdateOptions contains the optional parameters for the AutoscaleSettingsClient.CreateOrUpdate -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - autoscaleSettingName - The autoscale setting name. +// - parameters - Parameters supplied to the operation. +// - options - AutoscaleSettingsClientCreateOrUpdateOptions contains the optional parameters for the AutoscaleSettingsClient.CreateOrUpdate +// method. func (client *AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource, options *AutoscaleSettingsClientCreateOrUpdateOptions) (AutoscaleSettingsClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, autoscaleSettingName, parameters, options) if err != nil { @@ -115,11 +116,12 @@ func (client *AutoscaleSettingsClient) createOrUpdateHandleResponse(resp *http.R // Delete - Deletes and autoscale setting // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// autoscaleSettingName - The autoscale setting name. -// options - AutoscaleSettingsClientDeleteOptions contains the optional parameters for the AutoscaleSettingsClient.Delete -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - autoscaleSettingName - The autoscale setting name. +// - options - AutoscaleSettingsClientDeleteOptions contains the optional parameters for the AutoscaleSettingsClient.Delete +// method. func (client *AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string, options *AutoscaleSettingsClientDeleteOptions) (AutoscaleSettingsClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, autoscaleSettingName, options) if err != nil { @@ -163,10 +165,11 @@ func (client *AutoscaleSettingsClient) deleteCreateRequest(ctx context.Context, // Get - Gets an autoscale setting // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// autoscaleSettingName - The autoscale setting name. -// options - AutoscaleSettingsClientGetOptions contains the optional parameters for the AutoscaleSettingsClient.Get method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - autoscaleSettingName - The autoscale setting name. +// - options - AutoscaleSettingsClientGetOptions contains the optional parameters for the AutoscaleSettingsClient.Get method. func (client *AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string, options *AutoscaleSettingsClientGetOptions) (AutoscaleSettingsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, autoscaleSettingName, options) if err != nil { @@ -218,10 +221,11 @@ func (client *AutoscaleSettingsClient) getHandleResponse(resp *http.Response) (A } // NewListByResourceGroupPager - Lists the autoscale settings for a resource group +// // Generated from API version 2022-10-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - AutoscaleSettingsClientListByResourceGroupOptions contains the optional parameters for the AutoscaleSettingsClient.ListByResourceGroup -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - AutoscaleSettingsClientListByResourceGroupOptions contains the optional parameters for the AutoscaleSettingsClient.NewListByResourceGroupPager +// method. func (client *AutoscaleSettingsClient) NewListByResourceGroupPager(resourceGroupName string, options *AutoscaleSettingsClientListByResourceGroupOptions) *runtime.Pager[AutoscaleSettingsClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[AutoscaleSettingsClientListByResourceGroupResponse]{ More: func(page AutoscaleSettingsClientListByResourceGroupResponse) bool { @@ -282,9 +286,10 @@ func (client *AutoscaleSettingsClient) listByResourceGroupHandleResponse(resp *h } // NewListBySubscriptionPager - Lists the autoscale settings for a subscription +// // Generated from API version 2022-10-01 -// options - AutoscaleSettingsClientListBySubscriptionOptions contains the optional parameters for the AutoscaleSettingsClient.ListBySubscription -// method. +// - options - AutoscaleSettingsClientListBySubscriptionOptions contains the optional parameters for the AutoscaleSettingsClient.NewListBySubscriptionPager +// method. func (client *AutoscaleSettingsClient) NewListBySubscriptionPager(options *AutoscaleSettingsClientListBySubscriptionOptions) *runtime.Pager[AutoscaleSettingsClientListBySubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[AutoscaleSettingsClientListBySubscriptionResponse]{ More: func(page AutoscaleSettingsClientListBySubscriptionResponse) bool { @@ -342,12 +347,13 @@ func (client *AutoscaleSettingsClient) listBySubscriptionHandleResponse(resp *ht // Update - Updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// autoscaleSettingName - The autoscale setting name. -// autoscaleSettingResource - Parameters supplied to the operation. -// options - AutoscaleSettingsClientUpdateOptions contains the optional parameters for the AutoscaleSettingsClient.Update -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - autoscaleSettingName - The autoscale setting name. +// - autoscaleSettingResource - Parameters supplied to the operation. +// - options - AutoscaleSettingsClientUpdateOptions contains the optional parameters for the AutoscaleSettingsClient.Update +// method. func (client *AutoscaleSettingsClient) Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch, options *AutoscaleSettingsClientUpdateOptions) (AutoscaleSettingsClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, autoscaleSettingName, autoscaleSettingResource, options) if err != nil { diff --git a/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client_example_test.go deleted file mode 100644 index 3598e5bf3971..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client_example_test.go +++ /dev/null @@ -1,422 +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. - -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/tree/main/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() - client, err := armmonitor.NewAutoscaleSettingsClient("b67f7fec-69fc-4974-9099-a26bd6ffeda3", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("TestingMetricsScaleSet", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewAutoscaleSettingsClient("b67f7fec-69fc-4974-9099-a26bd6ffeda3", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewAutoscaleSettingsClient("b67f7fec-69fc-4974-9099-a26bd6ffeda3", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.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/tree/main/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() - client, err := armmonitor.NewAutoscaleSettingsClient("b67f7fec-69fc-4974-9099-a26bd6ffeda3", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "TestingMetricsScaleSet", "MySetting", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewAutoscaleSettingsClient("b67f7fec-69fc-4974-9099-a26bd6ffeda3", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewAutoscaleSettingsClient("b67f7fec-69fc-4974-9099-a26bd6ffeda3", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client.go b/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client.go new file mode 100644 index 000000000000..fefab318cc84 --- /dev/null +++ b/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client.go @@ -0,0 +1,408 @@ +//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 + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AzureMonitorWorkspacesClient contains the methods for the AzureMonitorWorkspaces group. +// Don't use this type directly, use NewAzureMonitorWorkspacesClient() instead. +type AzureMonitorWorkspacesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewAzureMonitorWorkspacesClient creates a new instance of AzureMonitorWorkspacesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAzureMonitorWorkspacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AzureMonitorWorkspacesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AzureMonitorWorkspacesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Create - Create or update a workspace +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-06-03-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - azureMonitorWorkspaceName - The name of the Azure Monitor workspace. The name is case insensitive +// - azureMonitorWorkspaceProperties - Properties that need to be specified to create a new workspace +// - options - AzureMonitorWorkspacesClientCreateOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Create +// method. +func (client *AzureMonitorWorkspacesClient) Create(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, azureMonitorWorkspaceProperties AzureMonitorWorkspaceResource, options *AzureMonitorWorkspacesClientCreateOptions) (AzureMonitorWorkspacesClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, azureMonitorWorkspaceName, azureMonitorWorkspaceProperties, options) + if err != nil { + return AzureMonitorWorkspacesClientCreateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AzureMonitorWorkspacesClientCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return AzureMonitorWorkspacesClientCreateResponse{}, runtime.NewResponseError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *AzureMonitorWorkspacesClient) createCreateRequest(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, azureMonitorWorkspaceProperties AzureMonitorWorkspaceResource, options *AzureMonitorWorkspacesClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if azureMonitorWorkspaceName == "" { + return nil, errors.New("parameter azureMonitorWorkspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureMonitorWorkspaceName}", url.PathEscape(azureMonitorWorkspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-03-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, azureMonitorWorkspaceProperties) +} + +// createHandleResponse handles the Create response. +func (client *AzureMonitorWorkspacesClient) createHandleResponse(resp *http.Response) (AzureMonitorWorkspacesClientCreateResponse, error) { + result := AzureMonitorWorkspacesClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureMonitorWorkspaceResource); err != nil { + return AzureMonitorWorkspacesClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Delete a workspace +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-06-03-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - azureMonitorWorkspaceName - The name of the Azure Monitor workspace. The name is case insensitive +// - options - AzureMonitorWorkspacesClientDeleteOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Delete +// method. +func (client *AzureMonitorWorkspacesClient) Delete(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientDeleteOptions) (AzureMonitorWorkspacesClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, azureMonitorWorkspaceName, options) + if err != nil { + return AzureMonitorWorkspacesClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AzureMonitorWorkspacesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return AzureMonitorWorkspacesClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return AzureMonitorWorkspacesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AzureMonitorWorkspacesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if azureMonitorWorkspaceName == "" { + return nil, errors.New("parameter azureMonitorWorkspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureMonitorWorkspaceName}", url.PathEscape(azureMonitorWorkspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-03-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Returns the specific Azure Monitor workspace +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-06-03-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - azureMonitorWorkspaceName - The name of the Azure Monitor workspace. The name is case insensitive +// - options - AzureMonitorWorkspacesClientGetOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Get +// method. +func (client *AzureMonitorWorkspacesClient) Get(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientGetOptions) (AzureMonitorWorkspacesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, azureMonitorWorkspaceName, options) + if err != nil { + return AzureMonitorWorkspacesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AzureMonitorWorkspacesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AzureMonitorWorkspacesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AzureMonitorWorkspacesClient) getCreateRequest(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if azureMonitorWorkspaceName == "" { + return nil, errors.New("parameter azureMonitorWorkspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureMonitorWorkspaceName}", url.PathEscape(azureMonitorWorkspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-03-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AzureMonitorWorkspacesClient) getHandleResponse(resp *http.Response) (AzureMonitorWorkspacesClientGetResponse, error) { + result := AzureMonitorWorkspacesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureMonitorWorkspaceResource); err != nil { + return AzureMonitorWorkspacesClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists all workspaces in the specified resource group +// +// Generated from API version 2021-06-03-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - AzureMonitorWorkspacesClientListByResourceGroupOptions contains the optional parameters for the AzureMonitorWorkspacesClient.NewListByResourceGroupPager +// method. +func (client *AzureMonitorWorkspacesClient) NewListByResourceGroupPager(resourceGroupName string, options *AzureMonitorWorkspacesClientListByResourceGroupOptions) *runtime.Pager[AzureMonitorWorkspacesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[AzureMonitorWorkspacesClientListByResourceGroupResponse]{ + More: func(page AzureMonitorWorkspacesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AzureMonitorWorkspacesClientListByResourceGroupResponse) (AzureMonitorWorkspacesClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AzureMonitorWorkspacesClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AzureMonitorWorkspacesClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AzureMonitorWorkspacesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *AzureMonitorWorkspacesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AzureMonitorWorkspacesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-03-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *AzureMonitorWorkspacesClient) listByResourceGroupHandleResponse(resp *http.Response) (AzureMonitorWorkspacesClientListByResourceGroupResponse, error) { + result := AzureMonitorWorkspacesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureMonitorWorkspaceResourceListResult); err != nil { + return AzureMonitorWorkspacesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Lists all workspaces in the specified subscription +// +// Generated from API version 2021-06-03-preview +// - options - AzureMonitorWorkspacesClientListBySubscriptionOptions contains the optional parameters for the AzureMonitorWorkspacesClient.NewListBySubscriptionPager +// method. +func (client *AzureMonitorWorkspacesClient) NewListBySubscriptionPager(options *AzureMonitorWorkspacesClientListBySubscriptionOptions) *runtime.Pager[AzureMonitorWorkspacesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[AzureMonitorWorkspacesClientListBySubscriptionResponse]{ + More: func(page AzureMonitorWorkspacesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AzureMonitorWorkspacesClientListBySubscriptionResponse) (AzureMonitorWorkspacesClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AzureMonitorWorkspacesClientListBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AzureMonitorWorkspacesClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AzureMonitorWorkspacesClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *AzureMonitorWorkspacesClient) listBySubscriptionCreateRequest(ctx context.Context, options *AzureMonitorWorkspacesClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Monitor/accounts" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-03-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *AzureMonitorWorkspacesClient) listBySubscriptionHandleResponse(resp *http.Response) (AzureMonitorWorkspacesClientListBySubscriptionResponse, error) { + result := AzureMonitorWorkspacesClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureMonitorWorkspaceResourceListResult); err != nil { + return AzureMonitorWorkspacesClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - Updates part of a workspace +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-06-03-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - azureMonitorWorkspaceName - The name of the Azure Monitor workspace. The name is case insensitive +// - options - AzureMonitorWorkspacesClientUpdateOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Update +// method. +func (client *AzureMonitorWorkspacesClient) Update(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientUpdateOptions) (AzureMonitorWorkspacesClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, azureMonitorWorkspaceName, options) + if err != nil { + return AzureMonitorWorkspacesClientUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AzureMonitorWorkspacesClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AzureMonitorWorkspacesClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *AzureMonitorWorkspacesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if azureMonitorWorkspaceName == "" { + return nil, errors.New("parameter azureMonitorWorkspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{azureMonitorWorkspaceName}", url.PathEscape(azureMonitorWorkspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-03-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.AzureMonitorWorkspaceProperties != nil { + return req, runtime.MarshalAsJSON(req, *options.AzureMonitorWorkspaceProperties) + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *AzureMonitorWorkspacesClient) updateHandleResponse(resp *http.Response) (AzureMonitorWorkspacesClientUpdateResponse, error) { + result := AzureMonitorWorkspacesClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureMonitorWorkspaceResource); err != nil { + return AzureMonitorWorkspacesClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/monitor/armmonitor/baselines_client.go b/sdk/resourcemanager/monitor/armmonitor/baselines_client.go index 0c9cde9bfcb5..73e8480949d0 100644 --- a/sdk/resourcemanager/monitor/armmonitor/baselines_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/baselines_client.go @@ -29,8 +29,8 @@ type BaselinesClient struct { } // NewBaselinesClient creates a new instance of BaselinesClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewBaselinesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*BaselinesClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -51,9 +51,10 @@ func NewBaselinesClient(credential azcore.TokenCredential, options *arm.ClientOp } // NewListPager - Lists the metric baseline values for a resource. +// // Generated from API version 2019-03-01 -// resourceURI - The identifier of the resource. -// options - BaselinesClientListOptions contains the optional parameters for the BaselinesClient.List method. +// - resourceURI - The identifier of the resource. +// - options - BaselinesClientListOptions contains the optional parameters for the BaselinesClient.NewListPager method. func (client *BaselinesClient) NewListPager(resourceURI string, options *BaselinesClientListOptions) *runtime.Pager[BaselinesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[BaselinesClientListResponse]{ More: func(page BaselinesClientListResponse) bool { 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 649047cb0cb4..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/baselines_client_example_test.go +++ /dev/null @@ -1,50 +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. - -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/tree/main/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() - client, err := armmonitor.NewBaselinesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.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() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/client.go b/sdk/resourcemanager/monitor/armmonitor/client.go new file mode 100644 index 000000000000..f280b31bb717 --- /dev/null +++ b/sdk/resourcemanager/monitor/armmonitor/client.go @@ -0,0 +1,105 @@ +//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 + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" +) + +// Client contains the methods for the Monitor group. +// Don't use this type directly, use NewClient() instead. +type Client struct { + host string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &Client{ + host: ep, + pl: pl, + } + return client, nil +} + +// NewOperationsListPager - Lists available Operations for this Resource Provider +// +// Generated from API version 2021-06-03-preview +// - options - ClientOperationsListOptions contains the optional parameters for the Client.NewOperationsListPager method. +func (client *Client) NewOperationsListPager(options *ClientOperationsListOptions) *runtime.Pager[ClientOperationsListResponse] { + return runtime.NewPager(runtime.PagingHandler[ClientOperationsListResponse]{ + More: func(page ClientOperationsListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ClientOperationsListResponse) (ClientOperationsListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.operationsListCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ClientOperationsListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ClientOperationsListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClientOperationsListResponse{}, runtime.NewResponseError(resp) + } + return client.operationsListHandleResponse(resp) + }, + }) +} + +// operationsListCreateRequest creates the OperationsList request. +func (client *Client) operationsListCreateRequest(ctx context.Context, options *ClientOperationsListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Monitor/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-03-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// operationsListHandleResponse handles the OperationsList response. +func (client *Client) operationsListHandleResponse(resp *http.Response) (ClientOperationsListResponse, error) { + result := ClientOperationsListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResultAutoGenerated); err != nil { + return ClientOperationsListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/monitor/armmonitor/constants.go b/sdk/resourcemanager/monitor/armmonitor/constants.go index 583be93bd909..c3e11e569f12 100644 --- a/sdk/resourcemanager/monitor/armmonitor/constants.go +++ b/sdk/resourcemanager/monitor/armmonitor/constants.go @@ -11,7 +11,7 @@ package armmonitor const ( moduleName = "armmonitor" - moduleVersion = "v0.8.0" + moduleVersion = "v0.9.0" ) // AccessMode - Access mode types. @@ -30,6 +30,20 @@ func PossibleAccessModeValues() []AccessMode { } } +// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string + +const ( + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + // AggregationType - the aggregation type of the metric. type AggregationType string @@ -307,6 +321,24 @@ func PossibleEventLevelValues() []EventLevel { } } +// IdentityType - Type of managed service identity. +type IdentityType string + +const ( + IdentityTypeSystemAssigned IdentityType = "SystemAssigned" + IdentityTypeUserAssigned IdentityType = "UserAssigned" + IdentityTypeNone IdentityType = "None" +) + +// PossibleIdentityTypeValues returns the possible values for the IdentityType const type. +func PossibleIdentityTypeValues() []IdentityType { + return []IdentityType{ + IdentityTypeSystemAssigned, + IdentityTypeUserAssigned, + IdentityTypeNone, + } +} + // Kind - Indicates the type of scheduled query rule. The default is LogAlert. type Kind string @@ -834,6 +866,25 @@ func PossibleOperatorValues() []Operator { } } +// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default +// value is "user,system" +type Origin string + +const ( + OriginSystem Origin = "system" + OriginUser Origin = "user" + OriginUserSystem Origin = "user,system" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} + // PredictiveAutoscalePolicyScaleMode - the predictive autoscale mode type PredictiveAutoscalePolicyScaleMode string @@ -890,6 +941,46 @@ func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointSer } } +// ProvisioningState - The provisioning state of the Azure Monitor workspace. Set to Succeeded if everything is healthy. +type ProvisioningState string + +const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateCanceled, + ProvisioningStateCreating, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateSucceeded, + } +} + +// PublicNetworkAccess - This determines if traffic is allowed over public network. By default it is enabled. +type PublicNetworkAccess string + +const ( + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" + PublicNetworkAccessSecuredByPerimeter PublicNetworkAccess = "SecuredByPerimeter" +) + +// PossiblePublicNetworkAccessValues returns the possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{ + PublicNetworkAccessDisabled, + PublicNetworkAccessEnabled, + PublicNetworkAccessSecuredByPerimeter, + } +} + // ReceiverStatus - Indicates the status of the receiver. Receivers that are not Enabled will not receive any communications. type ReceiverStatus string diff --git a/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client.go index f1fa33d58e15..36e6c7a0e8b5 100644 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client.go @@ -32,9 +32,9 @@ type DataCollectionEndpointsClient struct { } // NewDataCollectionEndpointsClient creates a new instance of DataCollectionEndpointsClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewDataCollectionEndpointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DataCollectionEndpointsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,11 +57,12 @@ func NewDataCollectionEndpointsClient(subscriptionID string, credential azcore.T // Create - Creates or updates a data collection endpoint. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-09-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// dataCollectionEndpointName - The name of the data collection endpoint. The name is case insensitive. -// options - DataCollectionEndpointsClientCreateOptions contains the optional parameters for the DataCollectionEndpointsClient.Create -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - dataCollectionEndpointName - The name of the data collection endpoint. The name is case insensitive. +// - options - DataCollectionEndpointsClientCreateOptions contains the optional parameters for the DataCollectionEndpointsClient.Create +// method. func (client *DataCollectionEndpointsClient) Create(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientCreateOptions) (DataCollectionEndpointsClientCreateResponse, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, dataCollectionEndpointName, options) if err != nil { @@ -117,11 +118,12 @@ func (client *DataCollectionEndpointsClient) createHandleResponse(resp *http.Res // Delete - Deletes a data collection endpoint. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-09-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// dataCollectionEndpointName - The name of the data collection endpoint. The name is case insensitive. -// options - DataCollectionEndpointsClientDeleteOptions contains the optional parameters for the DataCollectionEndpointsClient.Delete -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - dataCollectionEndpointName - The name of the data collection endpoint. The name is case insensitive. +// - options - DataCollectionEndpointsClientDeleteOptions contains the optional parameters for the DataCollectionEndpointsClient.Delete +// method. func (client *DataCollectionEndpointsClient) Delete(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientDeleteOptions) (DataCollectionEndpointsClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, dataCollectionEndpointName, options) if err != nil { @@ -165,11 +167,12 @@ func (client *DataCollectionEndpointsClient) deleteCreateRequest(ctx context.Con // Get - Returns the specified data collection endpoint. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-09-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// dataCollectionEndpointName - The name of the data collection endpoint. The name is case insensitive. -// options - DataCollectionEndpointsClientGetOptions contains the optional parameters for the DataCollectionEndpointsClient.Get -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - dataCollectionEndpointName - The name of the data collection endpoint. The name is case insensitive. +// - options - DataCollectionEndpointsClientGetOptions contains the optional parameters for the DataCollectionEndpointsClient.Get +// method. func (client *DataCollectionEndpointsClient) Get(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientGetOptions) (DataCollectionEndpointsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, dataCollectionEndpointName, options) if err != nil { @@ -221,10 +224,11 @@ func (client *DataCollectionEndpointsClient) getHandleResponse(resp *http.Respon } // NewListByResourceGroupPager - Lists all data collection endpoints in the specified resource group. +// // Generated from API version 2021-09-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - DataCollectionEndpointsClientListByResourceGroupOptions contains the optional parameters for the DataCollectionEndpointsClient.ListByResourceGroup -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - DataCollectionEndpointsClientListByResourceGroupOptions contains the optional parameters for the DataCollectionEndpointsClient.NewListByResourceGroupPager +// method. func (client *DataCollectionEndpointsClient) NewListByResourceGroupPager(resourceGroupName string, options *DataCollectionEndpointsClientListByResourceGroupOptions) *runtime.Pager[DataCollectionEndpointsClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[DataCollectionEndpointsClientListByResourceGroupResponse]{ More: func(page DataCollectionEndpointsClientListByResourceGroupResponse) bool { @@ -285,9 +289,10 @@ func (client *DataCollectionEndpointsClient) listByResourceGroupHandleResponse(r } // NewListBySubscriptionPager - Lists all data collection endpoints in the specified subscription +// // Generated from API version 2021-09-01-preview -// options - DataCollectionEndpointsClientListBySubscriptionOptions contains the optional parameters for the DataCollectionEndpointsClient.ListBySubscription -// method. +// - options - DataCollectionEndpointsClientListBySubscriptionOptions contains the optional parameters for the DataCollectionEndpointsClient.NewListBySubscriptionPager +// method. func (client *DataCollectionEndpointsClient) NewListBySubscriptionPager(options *DataCollectionEndpointsClientListBySubscriptionOptions) *runtime.Pager[DataCollectionEndpointsClientListBySubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[DataCollectionEndpointsClientListBySubscriptionResponse]{ More: func(page DataCollectionEndpointsClientListBySubscriptionResponse) bool { @@ -345,11 +350,12 @@ func (client *DataCollectionEndpointsClient) listBySubscriptionHandleResponse(re // Update - Updates part of a data collection endpoint. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-09-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// dataCollectionEndpointName - The name of the data collection endpoint. The name is case insensitive. -// options - DataCollectionEndpointsClientUpdateOptions contains the optional parameters for the DataCollectionEndpointsClient.Update -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - dataCollectionEndpointName - The name of the data collection endpoint. The name is case insensitive. +// - options - DataCollectionEndpointsClientUpdateOptions contains the optional parameters for the DataCollectionEndpointsClient.Update +// method. func (client *DataCollectionEndpointsClient) Update(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientUpdateOptions) (DataCollectionEndpointsClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, dataCollectionEndpointName, options) if err != nil { diff --git a/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client_example_test.go deleted file mode 100644 index 0539617f8d38..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client_example_test.go +++ /dev/null @@ -1,155 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -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/tree/main/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/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() - client, err := armmonitor.NewDataCollectionEndpointsClient("703362b3-f278-4e4b-9179-c76eaf41ffc2", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/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() - client, err := armmonitor.NewDataCollectionEndpointsClient("703362b3-f278-4e4b-9179-c76eaf41ffc2", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/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() - client, err := armmonitor.NewDataCollectionEndpointsClient("703362b3-f278-4e4b-9179-c76eaf41ffc2", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myCollectionEndpoint", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/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() - client, err := armmonitor.NewDataCollectionEndpointsClient("703362b3-f278-4e4b-9179-c76eaf41ffc2", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/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() - client, err := armmonitor.NewDataCollectionEndpointsClient("703362b3-f278-4e4b-9179-c76eaf41ffc2", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/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() - client, err := armmonitor.NewDataCollectionEndpointsClient("703362b3-f278-4e4b-9179-c76eaf41ffc2", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "myResourceGroup", "myCollectionEndpoint", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client.go index 82d35ac7cde0..2800659ae140 100644 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client.go @@ -32,9 +32,9 @@ type DataCollectionRuleAssociationsClient struct { } // NewDataCollectionRuleAssociationsClient creates a new instance of DataCollectionRuleAssociationsClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewDataCollectionRuleAssociationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DataCollectionRuleAssociationsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,11 +57,12 @@ func NewDataCollectionRuleAssociationsClient(subscriptionID string, credential a // Create - Creates or updates an association. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-09-01-preview -// resourceURI - The identifier of the resource. -// associationName - The name of the association. The name is case insensitive. -// options - DataCollectionRuleAssociationsClientCreateOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.Create -// method. +// - resourceURI - The identifier of the resource. +// - associationName - The name of the association. The name is case insensitive. +// - options - DataCollectionRuleAssociationsClientCreateOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.Create +// method. func (client *DataCollectionRuleAssociationsClient) Create(ctx context.Context, resourceURI string, associationName string, options *DataCollectionRuleAssociationsClientCreateOptions) (DataCollectionRuleAssociationsClientCreateResponse, error) { req, err := client.createCreateRequest(ctx, resourceURI, associationName, options) if err != nil { @@ -110,11 +111,12 @@ func (client *DataCollectionRuleAssociationsClient) createHandleResponse(resp *h // Delete - Deletes an association. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-09-01-preview -// resourceURI - The identifier of the resource. -// associationName - The name of the association. The name is case insensitive. -// options - DataCollectionRuleAssociationsClientDeleteOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.Delete -// method. +// - resourceURI - The identifier of the resource. +// - associationName - The name of the association. The name is case insensitive. +// - options - DataCollectionRuleAssociationsClientDeleteOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.Delete +// method. func (client *DataCollectionRuleAssociationsClient) Delete(ctx context.Context, resourceURI string, associationName string, options *DataCollectionRuleAssociationsClientDeleteOptions) (DataCollectionRuleAssociationsClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceURI, associationName, options) if err != nil { @@ -151,11 +153,12 @@ func (client *DataCollectionRuleAssociationsClient) deleteCreateRequest(ctx cont // Get - Returns the specified association. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-09-01-preview -// resourceURI - The identifier of the resource. -// associationName - The name of the association. The name is case insensitive. -// options - DataCollectionRuleAssociationsClientGetOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.Get -// method. +// - resourceURI - The identifier of the resource. +// - associationName - The name of the association. The name is case insensitive. +// - options - DataCollectionRuleAssociationsClientGetOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.Get +// method. func (client *DataCollectionRuleAssociationsClient) Get(ctx context.Context, resourceURI string, associationName string, options *DataCollectionRuleAssociationsClientGetOptions) (DataCollectionRuleAssociationsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceURI, associationName, options) if err != nil { @@ -200,11 +203,12 @@ func (client *DataCollectionRuleAssociationsClient) getHandleResponse(resp *http } // NewListByDataCollectionEndpointPager - Lists associations for the specified data collection endpoint. +// // Generated from API version 2021-09-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// dataCollectionEndpointName - The name of the data collection endpoint. The name is case insensitive. -// options - DataCollectionRuleAssociationsClientListByDataCollectionEndpointOptions contains the optional parameters for -// the DataCollectionRuleAssociationsClient.ListByDataCollectionEndpoint method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - dataCollectionEndpointName - The name of the data collection endpoint. The name is case insensitive. +// - options - DataCollectionRuleAssociationsClientListByDataCollectionEndpointOptions contains the optional parameters for +// the DataCollectionRuleAssociationsClient.NewListByDataCollectionEndpointPager method. func (client *DataCollectionRuleAssociationsClient) NewListByDataCollectionEndpointPager(resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionRuleAssociationsClientListByDataCollectionEndpointOptions) *runtime.Pager[DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse] { return runtime.NewPager(runtime.PagingHandler[DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse]{ More: func(page DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse) bool { @@ -269,10 +273,11 @@ func (client *DataCollectionRuleAssociationsClient) listByDataCollectionEndpoint } // NewListByResourcePager - Lists associations for the specified resource. +// // Generated from API version 2021-09-01-preview -// resourceURI - The identifier of the resource. -// options - DataCollectionRuleAssociationsClientListByResourceOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.ListByResource -// method. +// - resourceURI - The identifier of the resource. +// - options - DataCollectionRuleAssociationsClientListByResourceOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.NewListByResourcePager +// method. func (client *DataCollectionRuleAssociationsClient) NewListByResourcePager(resourceURI string, options *DataCollectionRuleAssociationsClientListByResourceOptions) *runtime.Pager[DataCollectionRuleAssociationsClientListByResourceResponse] { return runtime.NewPager(runtime.PagingHandler[DataCollectionRuleAssociationsClientListByResourceResponse]{ More: func(page DataCollectionRuleAssociationsClientListByResourceResponse) bool { @@ -326,11 +331,12 @@ func (client *DataCollectionRuleAssociationsClient) listByResourceHandleResponse } // NewListByRulePager - Lists associations for the specified data collection rule. +// // Generated from API version 2021-09-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// dataCollectionRuleName - The name of the data collection rule. The name is case insensitive. -// options - DataCollectionRuleAssociationsClientListByRuleOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.ListByRule -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - dataCollectionRuleName - The name of the data collection rule. The name is case insensitive. +// - options - DataCollectionRuleAssociationsClientListByRuleOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.NewListByRulePager +// method. func (client *DataCollectionRuleAssociationsClient) NewListByRulePager(resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRuleAssociationsClientListByRuleOptions) *runtime.Pager[DataCollectionRuleAssociationsClientListByRuleResponse] { return runtime.NewPager(runtime.PagingHandler[DataCollectionRuleAssociationsClientListByRuleResponse]{ More: func(page DataCollectionRuleAssociationsClientListByRuleResponse) bool { 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 2dbc9063bcf6..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client_example_test.go +++ /dev/null @@ -1,150 +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. - -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/tree/main/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/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() - client, err := armmonitor.NewDataCollectionRuleAssociationsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourcePager("subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/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() - client, err := armmonitor.NewDataCollectionRuleAssociationsClient("703362b3-f278-4e4b-9179-c76eaf41ffc2", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByRulePager("myResourceGroup", "myCollectionRule", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/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() - client, err := armmonitor.NewDataCollectionRuleAssociationsClient("703362b3-f278-4e4b-9179-c76eaf41ffc2", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByDataCollectionEndpointPager("myResourceGroup", "myDataCollectionEndpointName", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/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() - client, err := armmonitor.NewDataCollectionRuleAssociationsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/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() - client, err := armmonitor.NewDataCollectionRuleAssociationsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/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() - client, err := armmonitor.NewDataCollectionRuleAssociationsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", "myAssociation", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client.go index 58253cd56f7b..4a363f0e3640 100644 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client.go @@ -32,9 +32,9 @@ type DataCollectionRulesClient struct { } // NewDataCollectionRulesClient creates a new instance of DataCollectionRulesClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewDataCollectionRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DataCollectionRulesClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,11 +57,12 @@ func NewDataCollectionRulesClient(subscriptionID string, credential azcore.Token // Create - Creates or updates a data collection rule. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-09-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// dataCollectionRuleName - The name of the data collection rule. The name is case insensitive. -// options - DataCollectionRulesClientCreateOptions contains the optional parameters for the DataCollectionRulesClient.Create -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - dataCollectionRuleName - The name of the data collection rule. The name is case insensitive. +// - options - DataCollectionRulesClientCreateOptions contains the optional parameters for the DataCollectionRulesClient.Create +// method. func (client *DataCollectionRulesClient) Create(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRulesClientCreateOptions) (DataCollectionRulesClientCreateResponse, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, dataCollectionRuleName, options) if err != nil { @@ -117,11 +118,12 @@ func (client *DataCollectionRulesClient) createHandleResponse(resp *http.Respons // Delete - Deletes a data collection rule. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-09-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// dataCollectionRuleName - The name of the data collection rule. The name is case insensitive. -// options - DataCollectionRulesClientDeleteOptions contains the optional parameters for the DataCollectionRulesClient.Delete -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - dataCollectionRuleName - The name of the data collection rule. The name is case insensitive. +// - options - DataCollectionRulesClientDeleteOptions contains the optional parameters for the DataCollectionRulesClient.Delete +// method. func (client *DataCollectionRulesClient) Delete(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRulesClientDeleteOptions) (DataCollectionRulesClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, dataCollectionRuleName, options) if err != nil { @@ -165,10 +167,11 @@ func (client *DataCollectionRulesClient) deleteCreateRequest(ctx context.Context // Get - Returns the specified data collection rule. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-09-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// dataCollectionRuleName - The name of the data collection rule. The name is case insensitive. -// options - DataCollectionRulesClientGetOptions contains the optional parameters for the DataCollectionRulesClient.Get method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - dataCollectionRuleName - The name of the data collection rule. The name is case insensitive. +// - options - DataCollectionRulesClientGetOptions contains the optional parameters for the DataCollectionRulesClient.Get method. func (client *DataCollectionRulesClient) Get(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRulesClientGetOptions) (DataCollectionRulesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, dataCollectionRuleName, options) if err != nil { @@ -220,10 +223,11 @@ func (client *DataCollectionRulesClient) getHandleResponse(resp *http.Response) } // NewListByResourceGroupPager - Lists all data collection rules in the specified resource group. +// // Generated from API version 2021-09-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - DataCollectionRulesClientListByResourceGroupOptions contains the optional parameters for the DataCollectionRulesClient.ListByResourceGroup -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - DataCollectionRulesClientListByResourceGroupOptions contains the optional parameters for the DataCollectionRulesClient.NewListByResourceGroupPager +// method. func (client *DataCollectionRulesClient) NewListByResourceGroupPager(resourceGroupName string, options *DataCollectionRulesClientListByResourceGroupOptions) *runtime.Pager[DataCollectionRulesClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[DataCollectionRulesClientListByResourceGroupResponse]{ More: func(page DataCollectionRulesClientListByResourceGroupResponse) bool { @@ -284,9 +288,10 @@ func (client *DataCollectionRulesClient) listByResourceGroupHandleResponse(resp } // NewListBySubscriptionPager - Lists all data collection rules in the specified subscription. +// // Generated from API version 2021-09-01-preview -// options - DataCollectionRulesClientListBySubscriptionOptions contains the optional parameters for the DataCollectionRulesClient.ListBySubscription -// method. +// - options - DataCollectionRulesClientListBySubscriptionOptions contains the optional parameters for the DataCollectionRulesClient.NewListBySubscriptionPager +// method. func (client *DataCollectionRulesClient) NewListBySubscriptionPager(options *DataCollectionRulesClientListBySubscriptionOptions) *runtime.Pager[DataCollectionRulesClientListBySubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[DataCollectionRulesClientListBySubscriptionResponse]{ More: func(page DataCollectionRulesClientListBySubscriptionResponse) bool { @@ -344,11 +349,12 @@ func (client *DataCollectionRulesClient) listBySubscriptionHandleResponse(resp * // Update - Updates part of a data collection rule. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-09-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// dataCollectionRuleName - The name of the data collection rule. The name is case insensitive. -// options - DataCollectionRulesClientUpdateOptions contains the optional parameters for the DataCollectionRulesClient.Update -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - dataCollectionRuleName - The name of the data collection rule. The name is case insensitive. +// - options - DataCollectionRulesClientUpdateOptions contains the optional parameters for the DataCollectionRulesClient.Update +// method. func (client *DataCollectionRulesClient) Update(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRulesClientUpdateOptions) (DataCollectionRulesClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, dataCollectionRuleName, options) if err != nil { diff --git a/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client_example_test.go deleted file mode 100644 index bb0d7471db57..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client_example_test.go +++ /dev/null @@ -1,229 +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. - -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/tree/main/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/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() - client, err := armmonitor.NewDataCollectionRulesClient("703362b3-f278-4e4b-9179-c76eaf41ffc2", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/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() - client, err := armmonitor.NewDataCollectionRulesClient("703362b3-f278-4e4b-9179-c76eaf41ffc2", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/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() - client, err := armmonitor.NewDataCollectionRulesClient("703362b3-f278-4e4b-9179-c76eaf41ffc2", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myCollectionRule", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/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() - client, err := armmonitor.NewDataCollectionRulesClient("703362b3-f278-4e4b-9179-c76eaf41ffc2", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/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() - client, err := armmonitor.NewDataCollectionRulesClient("703362b3-f278-4e4b-9179-c76eaf41ffc2", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/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() - client, err := armmonitor.NewDataCollectionRulesClient("703362b3-f278-4e4b-9179-c76eaf41ffc2", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "myResourceGroup", "myCollectionRule", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client.go b/sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client.go index f32f585ee0f4..046c86478396 100644 --- a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client.go @@ -31,8 +31,8 @@ type DiagnosticSettingsClient struct { } // NewDiagnosticSettingsClient creates a new instance of DiagnosticSettingsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewDiagnosticSettingsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*DiagnosticSettingsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -54,12 +54,13 @@ func NewDiagnosticSettingsClient(credential azcore.TokenCredential, options *arm // CreateOrUpdate - Creates or updates diagnostic settings for the specified resource. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-05-01-preview -// resourceURI - The identifier of the resource. -// name - The name of the diagnostic setting. -// parameters - Parameters supplied to the operation. -// options - DiagnosticSettingsClientCreateOrUpdateOptions contains the optional parameters for the DiagnosticSettingsClient.CreateOrUpdate -// method. +// - resourceURI - The identifier of the resource. +// - name - The name of the diagnostic setting. +// - parameters - Parameters supplied to the operation. +// - options - DiagnosticSettingsClientCreateOrUpdateOptions contains the optional parameters for the DiagnosticSettingsClient.CreateOrUpdate +// method. func (client *DiagnosticSettingsClient) CreateOrUpdate(ctx context.Context, resourceURI string, name string, parameters DiagnosticSettingsResource, options *DiagnosticSettingsClientCreateOrUpdateOptions) (DiagnosticSettingsClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceURI, name, parameters, options) if err != nil { @@ -105,11 +106,12 @@ func (client *DiagnosticSettingsClient) createOrUpdateHandleResponse(resp *http. // Delete - Deletes existing diagnostic settings for the specified resource. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-05-01-preview -// resourceURI - The identifier of the resource. -// name - The name of the diagnostic setting. -// options - DiagnosticSettingsClientDeleteOptions contains the optional parameters for the DiagnosticSettingsClient.Delete -// method. +// - resourceURI - The identifier of the resource. +// - name - The name of the diagnostic setting. +// - options - DiagnosticSettingsClientDeleteOptions contains the optional parameters for the DiagnosticSettingsClient.Delete +// method. func (client *DiagnosticSettingsClient) Delete(ctx context.Context, resourceURI string, name string, options *DiagnosticSettingsClientDeleteOptions) (DiagnosticSettingsClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceURI, name, options) if err != nil { @@ -146,10 +148,11 @@ func (client *DiagnosticSettingsClient) deleteCreateRequest(ctx context.Context, // Get - Gets the active diagnostic settings for the specified resource. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-05-01-preview -// resourceURI - The identifier of the resource. -// name - The name of the diagnostic setting. -// options - DiagnosticSettingsClientGetOptions contains the optional parameters for the DiagnosticSettingsClient.Get method. +// - resourceURI - The identifier of the resource. +// - name - The name of the diagnostic setting. +// - options - DiagnosticSettingsClientGetOptions contains the optional parameters for the DiagnosticSettingsClient.Get method. func (client *DiagnosticSettingsClient) Get(ctx context.Context, resourceURI string, name string, options *DiagnosticSettingsClientGetOptions) (DiagnosticSettingsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceURI, name, options) if err != nil { @@ -194,9 +197,11 @@ func (client *DiagnosticSettingsClient) getHandleResponse(resp *http.Response) ( } // NewListPager - Gets the active diagnostic settings list for the specified resource. +// // Generated from API version 2021-05-01-preview -// resourceURI - The identifier of the resource. -// options - DiagnosticSettingsClientListOptions contains the optional parameters for the DiagnosticSettingsClient.List method. +// - resourceURI - The identifier of the resource. +// - options - DiagnosticSettingsClientListOptions contains the optional parameters for the DiagnosticSettingsClient.NewListPager +// method. func (client *DiagnosticSettingsClient) NewListPager(resourceURI string, options *DiagnosticSettingsClientListOptions) *runtime.Pager[DiagnosticSettingsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[DiagnosticSettingsClientListResponse]{ More: func(page DiagnosticSettingsClientListResponse) bool { 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 97000c64405a..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client_example_test.go +++ /dev/null @@ -1,213 +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. - -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/tree/main/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() - client, err := armmonitor.NewDiagnosticSettingsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewDiagnosticSettingsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewDiagnosticSettingsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewDiagnosticSettingsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewDiagnosticSettingsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.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/tree/main/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() - client, err := armmonitor.NewDiagnosticSettingsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewDiagnosticSettingsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client.go b/sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client.go index 78ec02bb82e4..141359285c85 100644 --- a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client.go @@ -31,8 +31,8 @@ type DiagnosticSettingsCategoryClient struct { } // NewDiagnosticSettingsCategoryClient creates a new instance of DiagnosticSettingsCategoryClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewDiagnosticSettingsCategoryClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*DiagnosticSettingsCategoryClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -54,11 +54,12 @@ func NewDiagnosticSettingsCategoryClient(credential azcore.TokenCredential, opti // Get - Gets the diagnostic settings category for the specified resource. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-05-01-preview -// resourceURI - The identifier of the resource. -// name - The name of the diagnostic setting. -// options - DiagnosticSettingsCategoryClientGetOptions contains the optional parameters for the DiagnosticSettingsCategoryClient.Get -// method. +// - resourceURI - The identifier of the resource. +// - name - The name of the diagnostic setting. +// - options - DiagnosticSettingsCategoryClientGetOptions contains the optional parameters for the DiagnosticSettingsCategoryClient.Get +// method. func (client *DiagnosticSettingsCategoryClient) Get(ctx context.Context, resourceURI string, name string, options *DiagnosticSettingsCategoryClientGetOptions) (DiagnosticSettingsCategoryClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceURI, name, options) if err != nil { @@ -103,10 +104,11 @@ func (client *DiagnosticSettingsCategoryClient) getHandleResponse(resp *http.Res } // NewListPager - Lists the diagnostic settings categories for the specified resource. +// // Generated from API version 2021-05-01-preview -// resourceURI - The identifier of the resource. -// options - DiagnosticSettingsCategoryClientListOptions contains the optional parameters for the DiagnosticSettingsCategoryClient.List -// method. +// - resourceURI - The identifier of the resource. +// - options - DiagnosticSettingsCategoryClientListOptions contains the optional parameters for the DiagnosticSettingsCategoryClient.NewListPager +// method. func (client *DiagnosticSettingsCategoryClient) NewListPager(resourceURI string, options *DiagnosticSettingsCategoryClientListOptions) *runtime.Pager[DiagnosticSettingsCategoryClientListResponse] { return runtime.NewPager(runtime.PagingHandler[DiagnosticSettingsCategoryClientListResponse]{ More: func(page DiagnosticSettingsCategoryClientListResponse) bool { 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 b6ab561325e8..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client_example_test.go +++ /dev/null @@ -1,60 +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. - -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/tree/main/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() - client, err := armmonitor.NewDiagnosticSettingsCategoryClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewDiagnosticSettingsCategoryClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/eventcategories_client.go b/sdk/resourcemanager/monitor/armmonitor/eventcategories_client.go index 0faa825a1829..faa3897bda06 100644 --- a/sdk/resourcemanager/monitor/armmonitor/eventcategories_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/eventcategories_client.go @@ -28,8 +28,8 @@ type EventCategoriesClient struct { } // NewEventCategoriesClient creates a new instance of EventCategoriesClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewEventCategoriesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*EventCategoriesClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -51,8 +51,10 @@ func NewEventCategoriesClient(credential azcore.TokenCredential, options *arm.Cl // NewListPager - Get the list of available event categories supported in the Activity Logs Service. The current list includes // the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. +// // Generated from API version 2015-04-01 -// options - EventCategoriesClientListOptions contains the optional parameters for the EventCategoriesClient.List method. +// - options - EventCategoriesClientListOptions contains the optional parameters for the EventCategoriesClient.NewListPager +// method. func (client *EventCategoriesClient) NewListPager(options *EventCategoriesClientListOptions) *runtime.Pager[EventCategoriesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[EventCategoriesClientListResponse]{ More: func(page EventCategoriesClientListResponse) bool { 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 e9a3c95b2d7a..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/eventcategories_client_example_test.go +++ /dev/null @@ -1,41 +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. - -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/tree/main/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() - client, err := armmonitor.NewEventCategoriesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/go.mod b/sdk/resourcemanager/monitor/armmonitor/go.mod index b3f80e01b286..7862cecff61e 100644 --- a/sdk/resourcemanager/monitor/armmonitor/go.mod +++ b/sdk/resourcemanager/monitor/armmonitor/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/monitor/armmonitor/go.sum b/sdk/resourcemanager/monitor/armmonitor/go.sum index 9c038303505c..fcd024b572be 100644 --- a/sdk/resourcemanager/monitor/armmonitor/go.sum +++ b/sdk/resourcemanager/monitor/armmonitor/go.sum @@ -1,33 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.0 h1:Ut0ZGdOwJDw0npYEg+TLlPls3Pq6JiZaP2/aGKir7Zw= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 h1:BWe8a+f/t+7KY7zH2mqygeUD0t8hNFXe08p1Pb3/jKE= -github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/monitor/armmonitor/logprofiles_client.go b/sdk/resourcemanager/monitor/armmonitor/logprofiles_client.go index a9357647a2b1..87fc94320cde 100644 --- a/sdk/resourcemanager/monitor/armmonitor/logprofiles_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/logprofiles_client.go @@ -32,9 +32,9 @@ type LogProfilesClient struct { } // NewLogProfilesClient creates a new instance of LogProfilesClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewLogProfilesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LogProfilesClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,11 +57,12 @@ func NewLogProfilesClient(subscriptionID string, credential azcore.TokenCredenti // CreateOrUpdate - Create or update a log profile in Azure Monitoring REST API. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2016-03-01 -// logProfileName - The name of the log profile. -// parameters - Parameters supplied to the operation. -// options - LogProfilesClientCreateOrUpdateOptions contains the optional parameters for the LogProfilesClient.CreateOrUpdate -// method. +// - logProfileName - The name of the log profile. +// - parameters - Parameters supplied to the operation. +// - options - LogProfilesClientCreateOrUpdateOptions contains the optional parameters for the LogProfilesClient.CreateOrUpdate +// method. func (client *LogProfilesClient) CreateOrUpdate(ctx context.Context, logProfileName string, parameters LogProfileResource, options *LogProfilesClientCreateOrUpdateOptions) (LogProfilesClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, logProfileName, parameters, options) if err != nil { @@ -110,9 +111,10 @@ func (client *LogProfilesClient) createOrUpdateHandleResponse(resp *http.Respons // Delete - Deletes the log profile. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2016-03-01 -// logProfileName - The name of the log profile. -// options - LogProfilesClientDeleteOptions contains the optional parameters for the LogProfilesClient.Delete method. +// - logProfileName - The name of the log profile. +// - options - LogProfilesClientDeleteOptions contains the optional parameters for the LogProfilesClient.Delete method. func (client *LogProfilesClient) Delete(ctx context.Context, logProfileName string, options *LogProfilesClientDeleteOptions) (LogProfilesClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, logProfileName, options) if err != nil { @@ -151,9 +153,10 @@ func (client *LogProfilesClient) deleteCreateRequest(ctx context.Context, logPro // Get - Gets the log profile. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2016-03-01 -// logProfileName - The name of the log profile. -// options - LogProfilesClientGetOptions contains the optional parameters for the LogProfilesClient.Get method. +// - logProfileName - The name of the log profile. +// - options - LogProfilesClientGetOptions contains the optional parameters for the LogProfilesClient.Get method. func (client *LogProfilesClient) Get(ctx context.Context, logProfileName string, options *LogProfilesClientGetOptions) (LogProfilesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, logProfileName, options) if err != nil { @@ -201,8 +204,9 @@ func (client *LogProfilesClient) getHandleResponse(resp *http.Response) (LogProf } // NewListPager - List the log profiles. +// // Generated from API version 2016-03-01 -// options - LogProfilesClientListOptions contains the optional parameters for the LogProfilesClient.List method. +// - options - LogProfilesClientListOptions contains the optional parameters for the LogProfilesClient.NewListPager method. func (client *LogProfilesClient) NewListPager(options *LogProfilesClientListOptions) *runtime.Pager[LogProfilesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[LogProfilesClientListResponse]{ More: func(page LogProfilesClientListResponse) bool { @@ -254,10 +258,11 @@ func (client *LogProfilesClient) listHandleResponse(resp *http.Response) (LogPro // Update - Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2016-03-01 -// logProfileName - The name of the log profile. -// logProfilesResource - Parameters supplied to the operation. -// options - LogProfilesClientUpdateOptions contains the optional parameters for the LogProfilesClient.Update method. +// - logProfileName - The name of the log profile. +// - logProfilesResource - Parameters supplied to the operation. +// - options - LogProfilesClientUpdateOptions contains the optional parameters for the LogProfilesClient.Update method. func (client *LogProfilesClient) Update(ctx context.Context, logProfileName string, logProfilesResource LogProfileResourcePatch, options *LogProfilesClientUpdateOptions) (LogProfilesClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, logProfileName, logProfilesResource, options) if err != nil { diff --git a/sdk/resourcemanager/monitor/armmonitor/logprofiles_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/logprofiles_client_example_test.go deleted file mode 100644 index d9238b995ea9..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/logprofiles_client_example_test.go +++ /dev/null @@ -1,151 +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. - -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/tree/main/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() - client, err := armmonitor.NewLogProfilesClient("b67f7fec-69fc-4974-9099-a26bd6ffeda3", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.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/tree/main/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() - client, err := armmonitor.NewLogProfilesClient("df602c9c-7aa0-407d-a6fb-eb20c8bd1192", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewLogProfilesClient("df602c9c-7aa0-407d-a6fb-eb20c8bd1192", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewLogProfilesClient("df602c9c-7aa0-407d-a6fb-eb20c8bd1192", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewLogProfilesClient("df602c9c-7aa0-407d-a6fb-eb20c8bd1192", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metricalerts_client.go b/sdk/resourcemanager/monitor/armmonitor/metricalerts_client.go index 8c7b943291e0..c46315ccae63 100644 --- a/sdk/resourcemanager/monitor/armmonitor/metricalerts_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/metricalerts_client.go @@ -32,9 +32,9 @@ type MetricAlertsClient struct { } // NewMetricAlertsClient creates a new instance of MetricAlertsClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewMetricAlertsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MetricAlertsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,12 +57,13 @@ func NewMetricAlertsClient(subscriptionID string, credential azcore.TokenCredent // CreateOrUpdate - Create or update an metric alert definition. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-03-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// ruleName - The name of the rule. -// parameters - The parameters of the rule to create or update. -// options - MetricAlertsClientCreateOrUpdateOptions contains the optional parameters for the MetricAlertsClient.CreateOrUpdate -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - ruleName - The name of the rule. +// - parameters - The parameters of the rule to create or update. +// - options - MetricAlertsClientCreateOrUpdateOptions contains the optional parameters for the MetricAlertsClient.CreateOrUpdate +// method. func (client *MetricAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResource, options *MetricAlertsClientCreateOrUpdateOptions) (MetricAlertsClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, ruleName, parameters, options) if err != nil { @@ -115,10 +116,11 @@ func (client *MetricAlertsClient) createOrUpdateHandleResponse(resp *http.Respon // Delete - Delete an alert rule definition. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-03-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// ruleName - The name of the rule. -// options - MetricAlertsClientDeleteOptions contains the optional parameters for the MetricAlertsClient.Delete method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - ruleName - The name of the rule. +// - options - MetricAlertsClientDeleteOptions contains the optional parameters for the MetricAlertsClient.Delete method. func (client *MetricAlertsClient) Delete(ctx context.Context, resourceGroupName string, ruleName string, options *MetricAlertsClientDeleteOptions) (MetricAlertsClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, ruleName, options) if err != nil { @@ -162,10 +164,11 @@ func (client *MetricAlertsClient) deleteCreateRequest(ctx context.Context, resou // Get - Retrieve an alert rule definition. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-03-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// ruleName - The name of the rule. -// options - MetricAlertsClientGetOptions contains the optional parameters for the MetricAlertsClient.Get method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - ruleName - The name of the rule. +// - options - MetricAlertsClientGetOptions contains the optional parameters for the MetricAlertsClient.Get method. func (client *MetricAlertsClient) Get(ctx context.Context, resourceGroupName string, ruleName string, options *MetricAlertsClientGetOptions) (MetricAlertsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, ruleName, options) if err != nil { @@ -217,10 +220,11 @@ func (client *MetricAlertsClient) getHandleResponse(resp *http.Response) (Metric } // NewListByResourceGroupPager - Retrieve alert rule definitions in a resource group. +// // Generated from API version 2018-03-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - MetricAlertsClientListByResourceGroupOptions contains the optional parameters for the MetricAlertsClient.ListByResourceGroup -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - MetricAlertsClientListByResourceGroupOptions contains the optional parameters for the MetricAlertsClient.NewListByResourceGroupPager +// method. func (client *MetricAlertsClient) NewListByResourceGroupPager(resourceGroupName string, options *MetricAlertsClientListByResourceGroupOptions) *runtime.Pager[MetricAlertsClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[MetricAlertsClientListByResourceGroupResponse]{ More: func(page MetricAlertsClientListByResourceGroupResponse) bool { @@ -275,9 +279,10 @@ func (client *MetricAlertsClient) listByResourceGroupHandleResponse(resp *http.R } // NewListBySubscriptionPager - Retrieve alert rule definitions in a subscription. +// // Generated from API version 2018-03-01 -// options - MetricAlertsClientListBySubscriptionOptions contains the optional parameters for the MetricAlertsClient.ListBySubscription -// method. +// - options - MetricAlertsClientListBySubscriptionOptions contains the optional parameters for the MetricAlertsClient.NewListBySubscriptionPager +// method. func (client *MetricAlertsClient) NewListBySubscriptionPager(options *MetricAlertsClientListBySubscriptionOptions) *runtime.Pager[MetricAlertsClientListBySubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[MetricAlertsClientListBySubscriptionResponse]{ More: func(page MetricAlertsClientListBySubscriptionResponse) bool { @@ -329,11 +334,12 @@ func (client *MetricAlertsClient) listBySubscriptionHandleResponse(resp *http.Re // Update - Update an metric alert definition. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-03-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// ruleName - The name of the rule. -// parameters - The parameters of the rule to update. -// options - MetricAlertsClientUpdateOptions contains the optional parameters for the MetricAlertsClient.Update method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - ruleName - The name of the rule. +// - parameters - The parameters of the rule to update. +// - options - MetricAlertsClientUpdateOptions contains the optional parameters for the MetricAlertsClient.Update method. func (client *MetricAlertsClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch, options *MetricAlertsClientUpdateOptions) (MetricAlertsClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, ruleName, parameters, options) if err != nil { diff --git a/sdk/resourcemanager/monitor/armmonitor/metricalerts_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/metricalerts_client_example_test.go deleted file mode 100644 index 8462d0389a19..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metricalerts_client_example_test.go +++ /dev/null @@ -1,697 +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. - -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/tree/main/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() - client, err := armmonitor.NewMetricAlertsClient("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewMetricAlertsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "gigtest", "MetricAlertOnMultipleResources", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewMetricAlertsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "gigtest", "chiricutin", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewMetricAlertsClient("12345678-1234-1234-1234-123456789101", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "rg-example", "webtest-name-example", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewMetricAlertsClient("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "gigtest", "MetricAlertOnMultipleResources", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewMetricAlertsClient("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "gigtest", "chiricutin", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewMetricAlertsClient("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "gigtest1", "MetricAlertAtResourceGroupLevel", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewMetricAlertsClient("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "gigtest", "MetricAlertAtSubscriptionLevel", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewMetricAlertsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewMetricAlertsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewMetricAlertsClient("12345678-1234-1234-1234-123456789101", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewMetricAlertsClient("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewMetricAlertsClient("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewMetricAlertsClient("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewMetricAlertsClient("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewMetricAlertsClient("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewMetricAlertsClient("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewMetricAlertsClient("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "gigtest", "chiricutin", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client.go b/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client.go index a2461258af1b..c362813da582 100644 --- a/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client.go @@ -32,9 +32,9 @@ type MetricAlertsStatusClient struct { } // NewMetricAlertsStatusClient creates a new instance of MetricAlertsStatusClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewMetricAlertsStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MetricAlertsStatusClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,10 +57,11 @@ func NewMetricAlertsStatusClient(subscriptionID string, credential azcore.TokenC // List - Retrieve an alert rule status. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-03-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// ruleName - The name of the rule. -// options - MetricAlertsStatusClientListOptions contains the optional parameters for the MetricAlertsStatusClient.List method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - ruleName - The name of the rule. +// - options - MetricAlertsStatusClientListOptions contains the optional parameters for the MetricAlertsStatusClient.List method. func (client *MetricAlertsStatusClient) List(ctx context.Context, resourceGroupName string, ruleName string, options *MetricAlertsStatusClientListOptions) (MetricAlertsStatusClientListResponse, error) { req, err := client.listCreateRequest(ctx, resourceGroupName, ruleName, options) if err != nil { @@ -113,12 +114,13 @@ func (client *MetricAlertsStatusClient) listHandleResponse(resp *http.Response) // ListByName - Retrieve an alert rule status. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-03-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// ruleName - The name of the rule. -// statusName - The name of the status. -// options - MetricAlertsStatusClientListByNameOptions contains the optional parameters for the MetricAlertsStatusClient.ListByName -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - ruleName - The name of the rule. +// - statusName - The name of the status. +// - options - MetricAlertsStatusClientListByNameOptions contains the optional parameters for the MetricAlertsStatusClient.ListByName +// method. func (client *MetricAlertsStatusClient) ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string, options *MetricAlertsStatusClientListByNameOptions) (MetricAlertsStatusClientListByNameResponse, error) { req, err := client.listByNameCreateRequest(ctx, resourceGroupName, ruleName, statusName, options) if err != nil { diff --git a/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client_example_test.go deleted file mode 100644 index 95d1bb5852da..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client_example_test.go +++ /dev/null @@ -1,55 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -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/tree/main/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() - client, err := armmonitor.NewMetricAlertsStatusClient("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, "gigtest", "chiricutin", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewMetricAlertsStatusClient("009f6022-67ec-423e-9aa7-691182870588", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListByName(ctx, "EastUs", "custom1", "cmVzb3VyY2VJZD0vc3Vic2NyaXB0aW9ucy8xNGRkZjBjNS03N2M1LTRiNTMtODRmNi1lMWZhNDNhZDY4ZjcvcmVzb3VyY2VHcm91cHMvZ2lndGVzdC9wcm92aWRlcnMvTWljcm9zb2Z0LkNvbXB1dGUvdmlydHVhbE1hY2hpbmVzL2dpZ3dhZG1l", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client.go b/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client.go index d5df411c25ad..cdfcc193a80b 100644 --- a/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client.go @@ -29,8 +29,8 @@ type MetricDefinitionsClient struct { } // NewMetricDefinitionsClient creates a new instance of MetricDefinitionsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewMetricDefinitionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*MetricDefinitionsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -51,9 +51,11 @@ func NewMetricDefinitionsClient(credential azcore.TokenCredential, options *arm. } // NewListPager - Lists the metric definitions for the resource. +// // Generated from API version 2018-01-01 -// resourceURI - The identifier of the resource. -// options - MetricDefinitionsClientListOptions contains the optional parameters for the MetricDefinitionsClient.List method. +// - 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 { 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 a38d686fb0cd..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client_example_test.go +++ /dev/null @@ -1,90 +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. - -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/tree/main/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-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() - client, err := armmonitor.NewMetricDefinitionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.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() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-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() - client, err := armmonitor.NewMetricDefinitionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.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() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-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() - client, err := armmonitor.NewMetricDefinitionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.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() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client.go b/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client.go index 715a223e6d8e..abfe167bf534 100644 --- a/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client.go @@ -29,8 +29,8 @@ type MetricNamespacesClient struct { } // NewMetricNamespacesClient creates a new instance of MetricNamespacesClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewMetricNamespacesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*MetricNamespacesClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -51,9 +51,11 @@ func NewMetricNamespacesClient(credential azcore.TokenCredential, options *arm.C } // NewListPager - Lists the metric namespaces for the resource. +// // Generated from API version 2017-12-01-preview -// resourceURI - The identifier of the resource. -// options - MetricNamespacesClientListOptions contains the optional parameters for the MetricNamespacesClient.List method. +// - resourceURI - The identifier of the resource. +// - options - MetricNamespacesClientListOptions contains the optional parameters for the MetricNamespacesClient.NewListPager +// method. func (client *MetricNamespacesClient) NewListPager(resourceURI string, options *MetricNamespacesClientListOptions) *runtime.Pager[MetricNamespacesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[MetricNamespacesClientListResponse]{ More: func(page MetricNamespacesClientListResponse) bool { 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 4404f3e3b774..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client_example_test.go +++ /dev/null @@ -1,42 +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. - -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/tree/main/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() - client, err := armmonitor.NewMetricNamespacesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.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() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metrics_client.go b/sdk/resourcemanager/monitor/armmonitor/metrics_client.go index b33f799bb2fc..c08e6972375c 100644 --- a/sdk/resourcemanager/monitor/armmonitor/metrics_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/metrics_client.go @@ -30,8 +30,8 @@ type MetricsClient struct { } // NewMetricsClient creates a new instance of MetricsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewMetricsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*MetricsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -53,9 +53,10 @@ func NewMetricsClient(credential azcore.TokenCredential, options *arm.ClientOpti // List - Lists the metric values for a resource. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-01-01 -// resourceURI - The identifier of the resource. -// options - MetricsClientListOptions contains the optional parameters for the MetricsClient.List method. +// - 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) { req, err := client.listCreateRequest(ctx, resourceURI, options) if err != 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 07b6542c138d..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metrics_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. - -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/tree/main/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-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() - client, err := armmonitor.NewMetricsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, "subscriptions/b324c52b-4073-4807-93af-e07d289c093e/resourceGroups/test/providers/Microsoft.Storage/storageAccounts/larryshoebox/blobServices/default", &armmonitor.MetricsClientListOptions{Timespan: to.Ptr("2017-04-14T02:20:00Z/2017-04-14T04:20:00Z"), - Interval: to.Ptr("PT1M"), - Metricnames: nil, - Aggregation: to.Ptr("Average,count"), - Top: to.Ptr[int32](3), - Orderby: to.Ptr("Average asc"), - Filter: to.Ptr("BlobType eq '*'"), - ResultType: nil, - Metricnamespace: to.Ptr("Microsoft.Storage/storageAccounts/blobServices"), - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-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() - client, err := armmonitor.NewMetricsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, "subscriptions/b324c52b-4073-4807-93af-e07d289c093e/resourceGroups/test/providers/Microsoft.Storage/storageAccounts/larryshoebox/blobServices/default", &armmonitor.MetricsClientListOptions{Timespan: to.Ptr("2017-04-14T02:20:00Z/2017-04-14T04:20:00Z"), - Interval: to.Ptr("PT1M"), - Metricnames: nil, - Aggregation: to.Ptr("Average,count"), - Top: to.Ptr[int32](3), - Orderby: to.Ptr("Average asc"), - Filter: to.Ptr("BlobType eq '*'"), - ResultType: nil, - Metricnamespace: to.Ptr("Microsoft.Storage/storageAccounts/blobServices"), - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-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() - client, err := armmonitor.NewMetricsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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"), - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/monitor/armmonitor/models.go b/sdk/resourcemanager/monitor/armmonitor/models.go index 2c44e9eca74f..068894c719a1 100644 --- a/sdk/resourcemanager/monitor/armmonitor/models.go +++ b/sdk/resourcemanager/monitor/armmonitor/models.go @@ -220,13 +220,13 @@ type ActionGroupsClientGetTestNotificationsOptions struct { // placeholder for future optional parameters } -// ActionGroupsClientListByResourceGroupOptions contains the optional parameters for the ActionGroupsClient.ListByResourceGroup +// ActionGroupsClientListByResourceGroupOptions contains the optional parameters for the ActionGroupsClient.NewListByResourceGroupPager // method. type ActionGroupsClientListByResourceGroupOptions struct { // placeholder for future optional parameters } -// ActionGroupsClientListBySubscriptionIDOptions contains the optional parameters for the ActionGroupsClient.ListBySubscriptionID +// ActionGroupsClientListBySubscriptionIDOptions contains the optional parameters for the ActionGroupsClient.NewListBySubscriptionIDPager // method. type ActionGroupsClientListBySubscriptionIDOptions struct { // placeholder for future optional parameters @@ -290,13 +290,13 @@ type ActivityLogAlertsClientGetOptions struct { // placeholder for future optional parameters } -// ActivityLogAlertsClientListByResourceGroupOptions contains the optional parameters for the ActivityLogAlertsClient.ListByResourceGroup +// ActivityLogAlertsClientListByResourceGroupOptions contains the optional parameters for the ActivityLogAlertsClient.NewListByResourceGroupPager // method. type ActivityLogAlertsClientListByResourceGroupOptions struct { // placeholder for future optional parameters } -// ActivityLogAlertsClientListBySubscriptionIDOptions contains the optional parameters for the ActivityLogAlertsClient.ListBySubscriptionID +// ActivityLogAlertsClientListBySubscriptionIDOptions contains the optional parameters for the ActivityLogAlertsClient.NewListBySubscriptionIDPager // method. type ActivityLogAlertsClientListBySubscriptionIDOptions struct { // placeholder for future optional parameters @@ -307,7 +307,7 @@ type ActivityLogAlertsClientUpdateOptions struct { // placeholder for future optional parameters } -// ActivityLogsClientListOptions contains the optional parameters for the ActivityLogsClient.List method. +// ActivityLogsClientListOptions contains the optional parameters for the ActivityLogsClient.NewListPager method. type ActivityLogsClientListOptions struct { // Used to fetch events with only the given properties. // The $select argument is a comma separated list of property names to be returned. Possible values are: authorization, claims, @@ -379,7 +379,7 @@ type AlertRuleIncidentsClientGetOptions struct { // placeholder for future optional parameters } -// AlertRuleIncidentsClientListByAlertRuleOptions contains the optional parameters for the AlertRuleIncidentsClient.ListByAlertRule +// AlertRuleIncidentsClientListByAlertRuleOptions contains the optional parameters for the AlertRuleIncidentsClient.NewListByAlertRulePager // method. type AlertRuleIncidentsClientListByAlertRuleOptions struct { // placeholder for future optional parameters @@ -498,13 +498,13 @@ type AlertRulesClientGetOptions struct { // placeholder for future optional parameters } -// AlertRulesClientListByResourceGroupOptions contains the optional parameters for the AlertRulesClient.ListByResourceGroup +// AlertRulesClientListByResourceGroupOptions contains the optional parameters for the AlertRulesClient.NewListByResourceGroupPager // method. type AlertRulesClientListByResourceGroupOptions struct { // placeholder for future optional parameters } -// AlertRulesClientListBySubscriptionOptions contains the optional parameters for the AlertRulesClient.ListBySubscription +// AlertRulesClientListBySubscriptionOptions contains the optional parameters for the AlertRulesClient.NewListBySubscriptionPager // method. type AlertRulesClientListBySubscriptionOptions struct { // placeholder for future optional parameters @@ -692,13 +692,13 @@ type AutoscaleSettingsClientGetOptions struct { // placeholder for future optional parameters } -// AutoscaleSettingsClientListByResourceGroupOptions contains the optional parameters for the AutoscaleSettingsClient.ListByResourceGroup +// AutoscaleSettingsClientListByResourceGroupOptions contains the optional parameters for the AutoscaleSettingsClient.NewListByResourceGroupPager // method. type AutoscaleSettingsClientListByResourceGroupOptions struct { // placeholder for future optional parameters } -// AutoscaleSettingsClientListBySubscriptionOptions contains the optional parameters for the AutoscaleSettingsClient.ListBySubscription +// AutoscaleSettingsClientListBySubscriptionOptions contains the optional parameters for the AutoscaleSettingsClient.NewListBySubscriptionPager // method. type AutoscaleSettingsClientListBySubscriptionOptions struct { // placeholder for future optional parameters @@ -791,6 +791,132 @@ type AzureMonitorPrivateLinkScopeProperties struct { ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` } +// AzureMonitorWorkspace - Properties of an Azure Monitor workspace +type AzureMonitorWorkspace struct { + // READ-ONLY; The immutable ID of the Azure Monitor workspace. This property is read-only. + AccountID *string `json:"accountId,omitempty" azure:"ro"` + + // READ-ONLY; The Data Collection Rule and Endpoint used for ingestion by default. + DefaultIngestionSettings *AzureMonitorWorkspaceDefaultIngestionSettings `json:"defaultIngestionSettings,omitempty" azure:"ro"` + + // READ-ONLY; Information about metrics for the Azure Monitor workspace + Metrics *AzureMonitorWorkspaceMetrics `json:"metrics,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the Azure Monitor workspace. Set to Succeeded if everything is healthy. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// AzureMonitorWorkspaceDefaultIngestionSettings - The Data Collection Rule and Endpoint used for ingestion by default. +type AzureMonitorWorkspaceDefaultIngestionSettings struct { + // READ-ONLY; The Azure resource Id of the default data collection endpoint for this workspace. + DataCollectionEndpointResourceID *string `json:"dataCollectionEndpointResourceId,omitempty" azure:"ro"` + + // READ-ONLY; The Azure resource Id of the default data collection rule for this workspace. + DataCollectionRuleResourceID *string `json:"dataCollectionRuleResourceId,omitempty" azure:"ro"` +} + +// AzureMonitorWorkspaceMetrics - Information about metrics for the Azure Monitor workspace +type AzureMonitorWorkspaceMetrics struct { + // READ-ONLY; An internal identifier for the metrics container. Only to be used by the system + InternalID *string `json:"internalId,omitempty" azure:"ro"` + + // READ-ONLY; The Prometheus query endpoint for the workspace + PrometheusQueryEndpoint *string `json:"prometheusQueryEndpoint,omitempty" azure:"ro"` +} + +// AzureMonitorWorkspaceResource - An Azure Monitor Workspace definition +type AzureMonitorWorkspaceResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string `json:"location,omitempty"` + + // Resource properties + Properties *AzureMonitorWorkspaceResourceProperties `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource entity tag (ETag) + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// AzureMonitorWorkspaceResourceForUpdate - Definition of ARM tracked top level resource properties for update operation +type AzureMonitorWorkspaceResourceForUpdate struct { + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` +} + +// AzureMonitorWorkspaceResourceListResult - A pageable list of resources +type AzureMonitorWorkspaceResourceListResult struct { + // REQUIRED; A list of resources + Value []*AzureMonitorWorkspaceResource `json:"value,omitempty"` + + // The URL to use for getting the next set of results + NextLink *string `json:"nextLink,omitempty"` +} + +// AzureMonitorWorkspaceResourceProperties - Resource properties +type AzureMonitorWorkspaceResourceProperties struct { + // READ-ONLY; The immutable ID of the Azure Monitor workspace. This property is read-only. + AccountID *string `json:"accountId,omitempty" azure:"ro"` + + // READ-ONLY; The Data Collection Rule and Endpoint used for ingestion by default. + DefaultIngestionSettings *AzureMonitorWorkspaceDefaultIngestionSettings `json:"defaultIngestionSettings,omitempty" azure:"ro"` + + // READ-ONLY; Information about metrics for the Azure Monitor workspace + Metrics *AzureMonitorWorkspaceMetrics `json:"metrics,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the Azure Monitor workspace. Set to Succeeded if everything is healthy. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// AzureMonitorWorkspacesClientCreateOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Create +// method. +type AzureMonitorWorkspacesClientCreateOptions struct { + // placeholder for future optional parameters +} + +// AzureMonitorWorkspacesClientDeleteOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Delete +// method. +type AzureMonitorWorkspacesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// AzureMonitorWorkspacesClientGetOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Get method. +type AzureMonitorWorkspacesClientGetOptions struct { + // placeholder for future optional parameters +} + +// AzureMonitorWorkspacesClientListByResourceGroupOptions contains the optional parameters for the AzureMonitorWorkspacesClient.NewListByResourceGroupPager +// method. +type AzureMonitorWorkspacesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// AzureMonitorWorkspacesClientListBySubscriptionOptions contains the optional parameters for the AzureMonitorWorkspacesClient.NewListBySubscriptionPager +// method. +type AzureMonitorWorkspacesClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// AzureMonitorWorkspacesClientUpdateOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Update +// method. +type AzureMonitorWorkspacesClientUpdateOptions struct { + // The payload + AzureMonitorWorkspaceProperties *AzureMonitorWorkspaceResourceForUpdate +} + // AzureResource - An azure resource object type AzureResource struct { // REQUIRED; Resource location @@ -837,7 +963,7 @@ type BaselineMetadata struct { Value *string `json:"value,omitempty"` } -// BaselinesClientListOptions contains the optional parameters for the BaselinesClient.List method. +// BaselinesClientListOptions contains the optional parameters for the BaselinesClient.NewListPager method. type BaselinesClientListOptions struct { // The list of aggregation types (comma separated) to retrieve. Aggregation *string @@ -867,6 +993,11 @@ type BaselinesClientListOptions struct { Timespan *string } +// ClientOperationsListOptions contains the optional parameters for the Client.NewOperationsListPager method. +type ClientOperationsListOptions struct { + // placeholder for future optional parameters +} + // ColumnDefinition - Definition of custom data column. type ColumnDefinition struct { // The name of the column. @@ -1073,13 +1204,13 @@ type DataCollectionEndpointsClientGetOptions struct { // placeholder for future optional parameters } -// DataCollectionEndpointsClientListByResourceGroupOptions contains the optional parameters for the DataCollectionEndpointsClient.ListByResourceGroup +// DataCollectionEndpointsClientListByResourceGroupOptions contains the optional parameters for the DataCollectionEndpointsClient.NewListByResourceGroupPager // method. type DataCollectionEndpointsClientListByResourceGroupOptions struct { // placeholder for future optional parameters } -// DataCollectionEndpointsClientListBySubscriptionOptions contains the optional parameters for the DataCollectionEndpointsClient.ListBySubscription +// DataCollectionEndpointsClientListBySubscriptionOptions contains the optional parameters for the DataCollectionEndpointsClient.NewListBySubscriptionPager // method. type DataCollectionEndpointsClientListBySubscriptionOptions struct { // placeholder for future optional parameters @@ -1236,19 +1367,19 @@ type DataCollectionRuleAssociationsClientGetOptions struct { // placeholder for future optional parameters } -// DataCollectionRuleAssociationsClientListByDataCollectionEndpointOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.ListByDataCollectionEndpoint +// DataCollectionRuleAssociationsClientListByDataCollectionEndpointOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.NewListByDataCollectionEndpointPager // method. type DataCollectionRuleAssociationsClientListByDataCollectionEndpointOptions struct { // placeholder for future optional parameters } -// DataCollectionRuleAssociationsClientListByResourceOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.ListByResource +// DataCollectionRuleAssociationsClientListByResourceOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.NewListByResourcePager // method. type DataCollectionRuleAssociationsClientListByResourceOptions struct { // placeholder for future optional parameters } -// DataCollectionRuleAssociationsClientListByRuleOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.ListByRule +// DataCollectionRuleAssociationsClientListByRuleOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.NewListByRulePager // method. type DataCollectionRuleAssociationsClientListByRuleOptions struct { // placeholder for future optional parameters @@ -1398,13 +1529,13 @@ type DataCollectionRulesClientGetOptions struct { // placeholder for future optional parameters } -// DataCollectionRulesClientListByResourceGroupOptions contains the optional parameters for the DataCollectionRulesClient.ListByResourceGroup +// DataCollectionRulesClientListByResourceGroupOptions contains the optional parameters for the DataCollectionRulesClient.NewListByResourceGroupPager // method. type DataCollectionRulesClientListByResourceGroupOptions struct { // placeholder for future optional parameters } -// DataCollectionRulesClientListBySubscriptionOptions contains the optional parameters for the DataCollectionRulesClient.ListBySubscription +// DataCollectionRulesClientListBySubscriptionOptions contains the optional parameters for the DataCollectionRulesClient.NewListBySubscriptionPager // method. type DataCollectionRulesClientListBySubscriptionOptions struct { // placeholder for future optional parameters @@ -1529,7 +1660,7 @@ type DiagnosticSettingsCategoryClientGetOptions struct { // placeholder for future optional parameters } -// DiagnosticSettingsCategoryClientListOptions contains the optional parameters for the DiagnosticSettingsCategoryClient.List +// DiagnosticSettingsCategoryClientListOptions contains the optional parameters for the DiagnosticSettingsCategoryClient.NewListPager // method. type DiagnosticSettingsCategoryClientListOptions struct { // placeholder for future optional parameters @@ -1575,7 +1706,7 @@ type DiagnosticSettingsClientGetOptions struct { // placeholder for future optional parameters } -// DiagnosticSettingsClientListOptions contains the optional parameters for the DiagnosticSettingsClient.List method. +// DiagnosticSettingsClientListOptions contains the optional parameters for the DiagnosticSettingsClient.NewListPager method. type DiagnosticSettingsClientListOptions struct { // placeholder for future optional parameters } @@ -1641,7 +1772,7 @@ type DynamicMetricCriteria struct { TimeAggregation *AggregationTypeEnum `json:"timeAggregation,omitempty"` // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]interface{} + AdditionalProperties map[string]any // List of dimension conditions. Dimensions []*MetricDimension `json:"dimensions,omitempty"` @@ -1727,7 +1858,7 @@ type Error struct { // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty" azure:"ro"` + Info any `json:"info,omitempty" azure:"ro"` // READ-ONLY; The additional info type. Type *string `json:"type,omitempty" azure:"ro"` @@ -1757,6 +1888,24 @@ type ErrorDetail struct { Target *string `json:"target,omitempty" azure:"ro"` } +// ErrorDetailAutoGenerated - The error detail. +type ErrorDetailAutoGenerated struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo `json:"additionalInfo,omitempty" azure:"ro"` + + // READ-ONLY; The error code. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; The error details. + Details []*ErrorDetailAutoGenerated `json:"details,omitempty" azure:"ro"` + + // READ-ONLY; The error message. + Message *string `json:"message,omitempty" azure:"ro"` + + // READ-ONLY; The error target. + Target *string `json:"target,omitempty" azure:"ro"` +} + // ErrorResponse - Describes the format of Error response. type ErrorResponse struct { // Error code @@ -1769,7 +1918,7 @@ type ErrorResponse struct { // ErrorResponseAdditionalInfo - The resource management error additional info. type ErrorResponseAdditionalInfo struct { // READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty" azure:"ro"` + Info any `json:"info,omitempty" azure:"ro"` // READ-ONLY; The additional info type. Type *string `json:"type,omitempty" azure:"ro"` @@ -1784,6 +1933,13 @@ type ErrorResponseAutoGenerated struct { Message *string `json:"message,omitempty" azure:"ro"` } +// ErrorResponseAutoGenerated2 - Common error response for all Azure Resource Manager APIs to return error details for failed +// operations. (This also follows the OData error response format.). +type ErrorResponseAutoGenerated2 struct { + // The error object. + Error *ErrorDetailAutoGenerated `json:"error,omitempty"` +} + // 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 { @@ -1810,7 +1966,7 @@ type ErrorResponseDetails struct { Target *string `json:"target,omitempty" azure:"ro"` } -// EventCategoriesClientListOptions contains the optional parameters for the EventCategoriesClient.List method. +// EventCategoriesClientListOptions contains the optional parameters for the EventCategoriesClient.NewListPager method. type EventCategoriesClientListOptions struct { // placeholder for future optional parameters } @@ -1947,7 +2103,7 @@ type ExtensionDataSource struct { ExtensionName *string `json:"extensionName,omitempty"` // The extension settings. The format is specific for particular extension. - ExtensionSettings interface{} `json:"extensionSettings,omitempty"` + ExtensionSettings any `json:"extensionSettings,omitempty"` // The list of data sources this extension needs data from. InputDataSources []*string `json:"inputDataSources,omitempty"` @@ -1976,6 +2132,23 @@ type HTTPRequestInfo struct { URI *string `json:"uri,omitempty"` } +// Identity for the resource. +type Identity struct { + // REQUIRED; Type of managed service identity. + Type *IdentityType `json:"type,omitempty"` + + // The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource + // ids in the form: + // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + UserAssignedIdentities map[string]*UserIdentityProperties `json:"userAssignedIdentities,omitempty"` + + // READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` + + // READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty" azure:"ro"` +} + // IisLogsDataSource - Enables IIS logs to be collected by this data collection rule. type IisLogsDataSource struct { // REQUIRED; IIS streams @@ -2013,6 +2186,15 @@ type IncidentListResult struct { Value []*Incident `json:"value,omitempty"` } +// IngestionSettings - Settings for data ingestion +type IngestionSettings struct { + // READ-ONLY; The Azure resource Id of the default data collection endpoint for this workspace. + DataCollectionEndpointResourceID *string `json:"dataCollectionEndpointResourceId,omitempty" azure:"ro"` + + // READ-ONLY; The Azure resource Id of the default data collection rule for this workspace. + DataCollectionRuleResourceID *string `json:"dataCollectionRuleResourceId,omitempty" azure:"ro"` +} + // ItsmReceiver - An Itsm receiver. type ItsmReceiver struct { // REQUIRED; Unique identification of ITSM connection among multiple defined in above workspace. @@ -2197,7 +2379,7 @@ type LogProfilesClientGetOptions struct { // placeholder for future optional parameters } -// LogProfilesClientListOptions contains the optional parameters for the LogProfilesClient.List method. +// LogProfilesClientListOptions contains the optional parameters for the LogProfilesClient.NewListPager method. type LogProfilesClientListOptions struct { // placeholder for future optional parameters } @@ -2350,7 +2532,7 @@ type MetricAlertCriteria struct { ODataType *Odatatype `json:"odata.type,omitempty"` // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]interface{} + AdditionalProperties map[string]any } // GetMetricAlertCriteria implements the MetricAlertCriteriaClassification interface for type MetricAlertCriteria. @@ -2363,7 +2545,7 @@ type MetricAlertMultipleResourceMultipleMetricCriteria struct { ODataType *Odatatype `json:"odata.type,omitempty"` // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]interface{} + AdditionalProperties map[string]any // the list of multiple metric criteria for this 'all of' operation. AllOf []MultiMetricCriteriaClassification `json:"allOf,omitempty"` @@ -2506,7 +2688,7 @@ type MetricAlertSingleResourceMultipleMetricCriteria struct { ODataType *Odatatype `json:"odata.type,omitempty"` // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]interface{} + AdditionalProperties map[string]any // The list of metric criteria for this 'all of' operation. AllOf []*MetricCriteria `json:"allOf,omitempty"` @@ -2568,13 +2750,13 @@ type MetricAlertsClientGetOptions struct { // placeholder for future optional parameters } -// MetricAlertsClientListByResourceGroupOptions contains the optional parameters for the MetricAlertsClient.ListByResourceGroup +// MetricAlertsClientListByResourceGroupOptions contains the optional parameters for the MetricAlertsClient.NewListByResourceGroupPager // method. type MetricAlertsClientListByResourceGroupOptions struct { // placeholder for future optional parameters } -// MetricAlertsClientListBySubscriptionOptions contains the optional parameters for the MetricAlertsClient.ListBySubscription +// MetricAlertsClientListBySubscriptionOptions contains the optional parameters for the MetricAlertsClient.NewListBySubscriptionPager // method. type MetricAlertsClientListBySubscriptionOptions struct { // placeholder for future optional parameters @@ -2652,7 +2834,7 @@ type MetricCriteria struct { TimeAggregation *AggregationTypeEnum `json:"timeAggregation,omitempty"` // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]interface{} + AdditionalProperties map[string]any // List of dimension conditions. Dimensions []*MetricDimension `json:"dimensions,omitempty"` @@ -2726,7 +2908,7 @@ type MetricDefinitionCollection struct { Value []*MetricDefinition `json:"value,omitempty"` } -// MetricDefinitionsClientListOptions contains the optional parameters for the MetricDefinitionsClient.List method. +// MetricDefinitionsClientListOptions contains the optional parameters for the MetricDefinitionsClient.NewListPager method. type MetricDefinitionsClientListOptions struct { // Metric namespace to query metric definitions for. Metricnamespace *string @@ -2774,7 +2956,7 @@ type MetricNamespaceName struct { MetricNamespaceName *string `json:"metricNamespaceName,omitempty"` } -// MetricNamespacesClientListOptions contains the optional parameters for the MetricNamespacesClient.List method. +// MetricNamespacesClientListOptions contains the optional parameters for the MetricNamespacesClient.NewListPager method. type MetricNamespacesClientListOptions struct { // The ISO 8601 conform Date start time from which to query for metric namespaces. StartTime *string @@ -2869,6 +3051,15 @@ type MetricValue struct { Total *float64 `json:"total,omitempty"` } +// Metrics - Information about metrics for the workspace +type Metrics struct { + // READ-ONLY; An internal identifier for the metrics container. Only to be used by the system + InternalID *string `json:"internalId,omitempty" azure:"ro"` + + // READ-ONLY; The Prometheus query endpoint for the workspace + PrometheusQueryEndpoint *string `json:"prometheusQueryEndpoint,omitempty" azure:"ro"` +} + // MetricsClientListOptions contains the optional parameters for the MetricsClient.List method. type MetricsClientListOptions struct { // The list of aggregation types (comma separated) to retrieve. @@ -2926,7 +3117,7 @@ type MultiMetricCriteria struct { TimeAggregation *AggregationTypeEnum `json:"timeAggregation,omitempty"` // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]interface{} + AdditionalProperties map[string]any // List of dimension conditions. Dimensions []*MetricDimension `json:"dimensions,omitempty"` @@ -2951,7 +3142,7 @@ type NetworkRuleSet struct { type NotificationRequestBody struct { // REQUIRED; The value of the supported alert type. Supported alert type values are: servicehealth, metricstaticthreshold, // metricsdynamicthreshold, logalertv2, smartalert, webtestalert, logalertv1numresult, - // logalertv1metricmeasurement, resourcehealth, activitylog, budget + // logalertv1metricmeasurement, resourcehealth, activitylog, actualcostbudget, forecastedbudget AlertType *string `json:"alertType,omitempty"` // The list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are @@ -2998,6 +3189,27 @@ type Operation struct { Name *string `json:"name,omitempty"` } +// 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 `json:"display,omitempty"` + + // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType `json:"actionType,omitempty" azure:"ro"` + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane + // operations. + IsDataAction *bool `json:"isDataAction,omitempty" azure:"ro"` + + // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", + // "Microsoft.Compute/virtualMachines/capture/action" + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + // value is "user,system" + Origin *Origin `json:"origin,omitempty" azure:"ro"` +} + // OperationDisplay - Display metadata associated with the operation. type OperationDisplay struct { // Operation type: Read, write, delete, etc. @@ -3010,6 +3222,24 @@ type OperationDisplay struct { Resource *string `json:"resource,omitempty"` } +// OperationDisplayAutoGenerated - Localized display information for this particular operation. +type OperationDisplayAutoGenerated struct { + // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. + Description *string `json:"description,omitempty" azure:"ro"` + + // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + // Machine", "Restart Virtual Machine". + Operation *string `json:"operation,omitempty" azure:"ro"` + + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". + Provider *string `json:"provider,omitempty" azure:"ro"` + + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". + Resource *string `json:"resource,omitempty" azure:"ro"` +} + // OperationListResult - Result of the request to list Microsoft.Insights operations. It contains a list of operations and // a URL link to get the next set of results. type OperationListResult struct { @@ -3020,6 +3250,16 @@ type OperationListResult struct { Value []*Operation `json:"value,omitempty"` } +// OperationListResultAutoGenerated - A list of REST API operations supported by an Azure Resource Provider. It contains an +// URL link to get the next set of results. +type OperationListResultAutoGenerated struct { + // READ-ONLY; URL to get the next set of operation list results (if there are any). + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; List of operations supported by the resource provider + Value []*OperationAutoGenerated `json:"value,omitempty" azure:"ro"` +} + // OperationStatus - The status of operation. type OperationStatus struct { // End time of the job in standard ISO8601 format. @@ -3247,7 +3487,7 @@ type PrivateLinkScopedResourcesClientGetOptions struct { // placeholder for future optional parameters } -// PrivateLinkScopedResourcesClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateLinkScopedResourcesClient.ListByPrivateLinkScope +// PrivateLinkScopedResourcesClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateLinkScopedResourcesClient.NewListByPrivateLinkScopePager // method. type PrivateLinkScopedResourcesClientListByPrivateLinkScopeOptions struct { // placeholder for future optional parameters @@ -3271,13 +3511,13 @@ type PrivateLinkScopesClientGetOptions struct { // placeholder for future optional parameters } -// PrivateLinkScopesClientListByResourceGroupOptions contains the optional parameters for the PrivateLinkScopesClient.ListByResourceGroup +// PrivateLinkScopesClientListByResourceGroupOptions contains the optional parameters for the PrivateLinkScopesClient.NewListByResourceGroupPager // method. type PrivateLinkScopesClientListByResourceGroupOptions struct { // placeholder for future optional parameters } -// PrivateLinkScopesClientListOptions contains the optional parameters for the PrivateLinkScopesClient.List method. +// PrivateLinkScopesClientListOptions contains the optional parameters for the PrivateLinkScopesClient.NewListPager method. type PrivateLinkScopesClientListOptions struct { // placeholder for future optional parameters } @@ -3467,6 +3707,21 @@ type ResourceAutoGenerated4 struct { Type *string `json:"type,omitempty" azure:"ro"` } +// 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 `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + // ResourceForUpdate - Definition of ARM tracked top level resource properties for update operation. type ResourceForUpdate struct { // Resource tags. @@ -3702,6 +3957,16 @@ func (r *RuleMetricDataSource) GetRuleDataSource() *RuleDataSource { } } +// RuleResolveConfiguration - TBD. Relevant only for rules of the kind LogAlert. +type RuleResolveConfiguration struct { + // The flag that indicates whether or not to auto resolve a fired alert. + AutoResolved *bool `json:"autoResolved,omitempty"` + + // The duration a rule must evaluate as healthy before the fired alert is automatically resolved represented in ISO 8601 duration + // format. + TimeToResolve *string `json:"timeToResolve,omitempty"` +} + // RuleWebhookAction - Specifies the action to post to service when the rule condition is evaluated. The discriminator is // always RuleWebhookAction in this case. type RuleWebhookAction struct { @@ -3818,6 +4083,12 @@ type ScheduledQueryRuleProperties struct { // of the kind LogAlert. OverrideQueryTimeRange *string `json:"overrideQueryTimeRange,omitempty"` + // This determines if traffic is allowed over public network. By default it is enabled. + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + + // Defines the configuration for resolving fired alerts. Relevant only for rules of the kind LogAlert. + RuleResolveConfiguration *RuleResolveConfiguration `json:"ruleResolveConfiguration,omitempty"` + // The list of resource id's that this scheduled query rule is scoped to. Scopes []*string `json:"scopes,omitempty"` @@ -3858,6 +4129,9 @@ type ScheduledQueryRuleResource struct { // REQUIRED; The rule properties of the resource. Properties *ScheduledQueryRuleProperties `json:"properties,omitempty"` + // The identity of the resource. + Identity *Identity `json:"identity,omitempty"` + // Indicates the type of scheduled query rule. The default is LogAlert. Kind *Kind `json:"kind,omitempty"` @@ -3894,6 +4168,9 @@ type ScheduledQueryRuleResourceCollection struct { // ScheduledQueryRuleResourcePatch - The scheduled query rule resource for patch operations. type ScheduledQueryRuleResourcePatch struct { + // The identity of the resource. + Identity *Identity `json:"identity,omitempty"` + // The scheduled query rule properties of the resource. Properties *ScheduledQueryRuleProperties `json:"properties,omitempty"` @@ -3917,13 +4194,13 @@ type ScheduledQueryRulesClientGetOptions struct { // placeholder for future optional parameters } -// ScheduledQueryRulesClientListByResourceGroupOptions contains the optional parameters for the ScheduledQueryRulesClient.ListByResourceGroup +// ScheduledQueryRulesClientListByResourceGroupOptions contains the optional parameters for the ScheduledQueryRulesClient.NewListByResourceGroupPager // method. type ScheduledQueryRulesClientListByResourceGroupOptions struct { // placeholder for future optional parameters } -// ScheduledQueryRulesClientListBySubscriptionOptions contains the optional parameters for the ScheduledQueryRulesClient.ListBySubscription +// ScheduledQueryRulesClientListBySubscriptionOptions contains the optional parameters for the ScheduledQueryRulesClient.NewListBySubscriptionPager // method. type ScheduledQueryRulesClientListBySubscriptionOptions struct { // placeholder for future optional parameters @@ -4077,7 +4354,7 @@ type TagsResource struct { Tags map[string]*string `json:"tags,omitempty"` } -// TenantActivityLogsClientListOptions contains the optional parameters for the TenantActivityLogsClient.List method. +// TenantActivityLogsClientListOptions contains the optional parameters for the TenantActivityLogsClient.NewListPager method. type TenantActivityLogsClientListOptions struct { // Reduces the set of data collected. // The $filter is very restricted and allows only the following patterns. @@ -4237,6 +4514,37 @@ type TrackedResource struct { Type *string `json:"type,omitempty" azure:"ro"` } +// TrackedResourceAutoGenerated - The resource model definition for an Azure Resource Manager tracked top level resource which +// has 'tags' and a 'location' +type TrackedResourceAutoGenerated struct { + // REQUIRED; The geo-location where the resource lives + Location *string `json:"location,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// UserIdentityProperties - User assigned identity properties. +type UserIdentityProperties struct { + // READ-ONLY; The client id of user assigned identity. + ClientID *string `json:"clientId,omitempty" azure:"ro"` + + // READ-ONLY; The principal id of user assigned identity. + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` +} + // VMInsightsClientGetOnboardingStatusOptions contains the optional parameters for the VMInsightsClient.GetOnboardingStatus // method. type VMInsightsClientGetOnboardingStatusOptions struct { @@ -4335,7 +4643,7 @@ type WebtestLocationAvailabilityCriteria struct { WebTestID *string `json:"webTestId,omitempty"` // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]interface{} + AdditionalProperties map[string]any } // GetMetricAlertCriteria implements the MetricAlertCriteriaClassification interface for type WebtestLocationAvailabilityCriteria. diff --git a/sdk/resourcemanager/monitor/armmonitor/models_serde.go b/sdk/resourcemanager/monitor/armmonitor/models_serde.go index 59962bd7e62d..7acfe29eea16 100644 --- a/sdk/resourcemanager/monitor/armmonitor/models_serde.go +++ b/sdk/resourcemanager/monitor/armmonitor/models_serde.go @@ -19,7 +19,7 @@ import ( // MarshalJSON implements the json.Marshaller interface for type AccessModeSettings. func (a AccessModeSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "exclusions", a.Exclusions) populate(objectMap, "ingestionAccessMode", a.IngestionAccessMode) populate(objectMap, "queryAccessMode", a.QueryAccessMode) @@ -54,7 +54,7 @@ func (a *AccessModeSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AccessModeSettingsExclusion. func (a AccessModeSettingsExclusion) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "ingestionAccessMode", a.IngestionAccessMode) populate(objectMap, "privateEndpointConnectionName", a.PrivateEndpointConnectionName) populate(objectMap, "queryAccessMode", a.QueryAccessMode) @@ -89,7 +89,7 @@ func (a *AccessModeSettingsExclusion) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ActionDetail. func (a ActionDetail) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "Detail", a.Detail) populate(objectMap, "MechanismType", a.MechanismType) populate(objectMap, "Name", a.Name) @@ -136,7 +136,7 @@ func (a *ActionDetail) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ActionGroup. func (a ActionGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "armRoleReceivers", a.ArmRoleReceivers) populate(objectMap, "automationRunbookReceivers", a.AutomationRunbookReceivers) populate(objectMap, "azureAppPushReceivers", a.AzureAppPushReceivers) @@ -211,7 +211,7 @@ func (a *ActionGroup) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ActionGroupAutoGenerated. func (a ActionGroupAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "actionGroupId", a.ActionGroupID) populate(objectMap, "webhookProperties", a.WebhookProperties) return json.Marshal(objectMap) @@ -242,7 +242,7 @@ func (a *ActionGroupAutoGenerated) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ActionGroupList. func (a ActionGroupList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", a.NextLink) populate(objectMap, "value", a.Value) return json.Marshal(objectMap) @@ -273,7 +273,7 @@ func (a *ActionGroupList) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ActionGroupPatch. func (a ActionGroupPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "enabled", a.Enabled) return json.Marshal(objectMap) } @@ -300,7 +300,7 @@ func (a *ActionGroupPatch) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ActionGroupPatchBody. func (a ActionGroupPatchBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", a.Properties) populate(objectMap, "tags", a.Tags) return json.Marshal(objectMap) @@ -331,7 +331,7 @@ func (a *ActionGroupPatchBody) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ActionGroupResource. func (a ActionGroupResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", a.ID) populate(objectMap, "location", a.Location) populate(objectMap, "name", a.Name) @@ -378,7 +378,7 @@ func (a *ActionGroupResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ActionList. func (a ActionList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "actionGroups", a.ActionGroups) return json.Marshal(objectMap) } @@ -405,7 +405,7 @@ func (a *ActionList) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Actions. func (a Actions) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "actionGroups", a.ActionGroups) populate(objectMap, "customProperties", a.CustomProperties) return json.Marshal(objectMap) @@ -436,7 +436,7 @@ func (a *Actions) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ActivityLogAlertResource. func (a ActivityLogAlertResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", a.ID) populate(objectMap, "location", a.Location) populate(objectMap, "name", a.Name) @@ -483,7 +483,7 @@ func (a *ActivityLogAlertResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AlertRule. func (a AlertRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "action", a.Action) populate(objectMap, "actions", a.Actions) populate(objectMap, "condition", a.Condition) @@ -538,7 +538,7 @@ func (a *AlertRule) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AlertRuleAllOfCondition. func (a AlertRuleAllOfCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "allOf", a.AllOf) return json.Marshal(objectMap) } @@ -565,7 +565,7 @@ func (a *AlertRuleAllOfCondition) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AlertRuleAnyOfOrLeafCondition. func (a AlertRuleAnyOfOrLeafCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "anyOf", a.AnyOf) populate(objectMap, "containsAny", a.ContainsAny) populate(objectMap, "equals", a.Equals) @@ -604,7 +604,7 @@ func (a *AlertRuleAnyOfOrLeafCondition) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AlertRuleLeafCondition. func (a AlertRuleLeafCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "containsAny", a.ContainsAny) populate(objectMap, "equals", a.Equals) populate(objectMap, "field", a.Field) @@ -639,7 +639,7 @@ func (a *AlertRuleLeafCondition) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AlertRuleList. func (a AlertRuleList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", a.NextLink) populate(objectMap, "value", a.Value) return json.Marshal(objectMap) @@ -670,7 +670,7 @@ func (a *AlertRuleList) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AlertRulePatchObject. func (a AlertRulePatchObject) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", a.Properties) populate(objectMap, "tags", a.Tags) return json.Marshal(objectMap) @@ -701,7 +701,7 @@ func (a *AlertRulePatchObject) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AlertRulePatchProperties. func (a AlertRulePatchProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "enabled", a.Enabled) return json.Marshal(objectMap) } @@ -728,7 +728,7 @@ func (a *AlertRulePatchProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AlertRuleProperties. func (a AlertRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "actions", a.Actions) populate(objectMap, "condition", a.Condition) populate(objectMap, "description", a.Description) @@ -771,7 +771,7 @@ func (a *AlertRuleProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AlertRuleResource. func (a AlertRuleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", a.ID) populate(objectMap, "location", a.Location) populate(objectMap, "name", a.Name) @@ -818,7 +818,7 @@ func (a *AlertRuleResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AlertRuleResourceCollection. func (a AlertRuleResourceCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "value", a.Value) return json.Marshal(objectMap) } @@ -845,7 +845,7 @@ func (a *AlertRuleResourceCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AlertRuleResourcePatch. func (a AlertRuleResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", a.Properties) populate(objectMap, "tags", a.Tags) return json.Marshal(objectMap) @@ -876,7 +876,7 @@ func (a *AlertRuleResourcePatch) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ArmRoleReceiver. func (a ArmRoleReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "name", a.Name) populate(objectMap, "roleId", a.RoleID) populate(objectMap, "useCommonAlertSchema", a.UseCommonAlertSchema) @@ -911,7 +911,7 @@ func (a *ArmRoleReceiver) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AutomationRunbookReceiver. func (a AutomationRunbookReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "automationAccountId", a.AutomationAccountID) populate(objectMap, "isGlobalRunbook", a.IsGlobalRunbook) populate(objectMap, "name", a.Name) @@ -962,7 +962,7 @@ func (a *AutomationRunbookReceiver) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AutoscaleErrorResponse. func (a AutoscaleErrorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "error", a.Error) populate(objectMap, "systemData", a.SystemData) return json.Marshal(objectMap) @@ -993,7 +993,7 @@ func (a *AutoscaleErrorResponse) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AutoscaleErrorResponseError. func (a AutoscaleErrorResponseError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "code", a.Code) populate(objectMap, "details", a.Details) populate(objectMap, "message", a.Message) @@ -1032,7 +1032,7 @@ func (a *AutoscaleErrorResponseError) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AutoscaleNotification. func (a AutoscaleNotification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "email", a.Email) objectMap["operation"] = "Scale" populate(objectMap, "webhooks", a.Webhooks) @@ -1067,7 +1067,7 @@ func (a *AutoscaleNotification) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AutoscaleProfile. func (a AutoscaleProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "capacity", a.Capacity) populate(objectMap, "fixedDate", a.FixedDate) populate(objectMap, "name", a.Name) @@ -1110,7 +1110,7 @@ func (a *AutoscaleProfile) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AutoscaleSetting. func (a AutoscaleSetting) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "enabled", a.Enabled) populate(objectMap, "name", a.Name) populate(objectMap, "notifications", a.Notifications) @@ -1161,7 +1161,7 @@ func (a *AutoscaleSetting) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AutoscaleSettingResource. func (a AutoscaleSettingResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", a.ID) populate(objectMap, "location", a.Location) populate(objectMap, "name", a.Name) @@ -1212,7 +1212,7 @@ func (a *AutoscaleSettingResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AutoscaleSettingResourceCollection. func (a AutoscaleSettingResourceCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", a.NextLink) populate(objectMap, "value", a.Value) return json.Marshal(objectMap) @@ -1243,7 +1243,7 @@ func (a *AutoscaleSettingResourceCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AutoscaleSettingResourcePatch. func (a AutoscaleSettingResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", a.Properties) populate(objectMap, "tags", a.Tags) return json.Marshal(objectMap) @@ -1274,7 +1274,7 @@ func (a *AutoscaleSettingResourcePatch) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AzureAppPushReceiver. func (a AzureAppPushReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "emailAddress", a.EmailAddress) populate(objectMap, "name", a.Name) return json.Marshal(objectMap) @@ -1305,7 +1305,7 @@ func (a *AzureAppPushReceiver) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AzureFunctionReceiver. func (a AzureFunctionReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "functionAppResourceId", a.FunctionAppResourceID) populate(objectMap, "functionName", a.FunctionName) populate(objectMap, "httpTriggerUrl", a.HTTPTriggerURL) @@ -1348,7 +1348,7 @@ func (a *AzureFunctionReceiver) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AzureMonitorMetricsDestination. func (a AzureMonitorMetricsDestination) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "name", a.Name) return json.Marshal(objectMap) } @@ -1375,7 +1375,7 @@ func (a *AzureMonitorMetricsDestination) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AzureMonitorPrivateLinkScope. func (a AzureMonitorPrivateLinkScope) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", a.ID) populate(objectMap, "location", a.Location) populate(objectMap, "name", a.Name) @@ -1426,7 +1426,7 @@ func (a *AzureMonitorPrivateLinkScope) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AzureMonitorPrivateLinkScopeListResult. func (a AzureMonitorPrivateLinkScopeListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", a.NextLink) populate(objectMap, "value", a.Value) return json.Marshal(objectMap) @@ -1457,7 +1457,7 @@ func (a *AzureMonitorPrivateLinkScopeListResult) UnmarshalJSON(data []byte) erro // MarshalJSON implements the json.Marshaller interface for type AzureMonitorPrivateLinkScopeProperties. func (a AzureMonitorPrivateLinkScopeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "accessModeSettings", a.AccessModeSettings) populate(objectMap, "privateEndpointConnections", a.PrivateEndpointConnections) populate(objectMap, "provisioningState", a.ProvisioningState) @@ -1490,9 +1490,262 @@ func (a *AzureMonitorPrivateLinkScopeProperties) UnmarshalJSON(data []byte) erro return nil } +// MarshalJSON implements the json.Marshaller interface for type AzureMonitorWorkspace. +func (a AzureMonitorWorkspace) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accountId", a.AccountID) + populate(objectMap, "defaultIngestionSettings", a.DefaultIngestionSettings) + populate(objectMap, "metrics", a.Metrics) + populate(objectMap, "provisioningState", a.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorWorkspace. +func (a *AzureMonitorWorkspace) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "accountId": + err = unpopulate(val, "AccountID", &a.AccountID) + delete(rawMsg, key) + case "defaultIngestionSettings": + err = unpopulate(val, "DefaultIngestionSettings", &a.DefaultIngestionSettings) + delete(rawMsg, key) + case "metrics": + err = unpopulate(val, "Metrics", &a.Metrics) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureMonitorWorkspaceDefaultIngestionSettings. +func (a AzureMonitorWorkspaceDefaultIngestionSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dataCollectionEndpointResourceId", a.DataCollectionEndpointResourceID) + populate(objectMap, "dataCollectionRuleResourceId", a.DataCollectionRuleResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorWorkspaceDefaultIngestionSettings. +func (a *AzureMonitorWorkspaceDefaultIngestionSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataCollectionEndpointResourceId": + err = unpopulate(val, "DataCollectionEndpointResourceID", &a.DataCollectionEndpointResourceID) + delete(rawMsg, key) + case "dataCollectionRuleResourceId": + err = unpopulate(val, "DataCollectionRuleResourceID", &a.DataCollectionRuleResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureMonitorWorkspaceMetrics. +func (a AzureMonitorWorkspaceMetrics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "internalId", a.InternalID) + populate(objectMap, "prometheusQueryEndpoint", a.PrometheusQueryEndpoint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorWorkspaceMetrics. +func (a *AzureMonitorWorkspaceMetrics) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "internalId": + err = unpopulate(val, "InternalID", &a.InternalID) + delete(rawMsg, key) + case "prometheusQueryEndpoint": + err = unpopulate(val, "PrometheusQueryEndpoint", &a.PrometheusQueryEndpoint) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureMonitorWorkspaceResource. +func (a AzureMonitorWorkspaceResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorWorkspaceResource. +func (a *AzureMonitorWorkspaceResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureMonitorWorkspaceResourceForUpdate. +func (a AzureMonitorWorkspaceResourceForUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", a.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorWorkspaceResourceForUpdate. +func (a *AzureMonitorWorkspaceResourceForUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureMonitorWorkspaceResourceListResult. +func (a AzureMonitorWorkspaceResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorWorkspaceResourceListResult. +func (a *AzureMonitorWorkspaceResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureMonitorWorkspaceResourceProperties. +func (a AzureMonitorWorkspaceResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accountId", a.AccountID) + populate(objectMap, "defaultIngestionSettings", a.DefaultIngestionSettings) + populate(objectMap, "metrics", a.Metrics) + populate(objectMap, "provisioningState", a.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorWorkspaceResourceProperties. +func (a *AzureMonitorWorkspaceResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "accountId": + err = unpopulate(val, "AccountID", &a.AccountID) + delete(rawMsg, key) + case "defaultIngestionSettings": + err = unpopulate(val, "DefaultIngestionSettings", &a.DefaultIngestionSettings) + delete(rawMsg, key) + case "metrics": + err = unpopulate(val, "Metrics", &a.Metrics) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type AzureResource. func (a AzureResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", a.ID) populate(objectMap, "location", a.Location) populate(objectMap, "name", a.Name) @@ -1535,7 +1788,7 @@ func (a *AzureResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AzureResourceAutoGenerated. func (a AzureResourceAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", a.ID) populate(objectMap, "location", a.Location) populate(objectMap, "name", a.Name) @@ -1578,7 +1831,7 @@ func (a *AzureResourceAutoGenerated) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type BaselineMetadata. func (b BaselineMetadata) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "name", b.Name) populate(objectMap, "value", b.Value) return json.Marshal(objectMap) @@ -1609,7 +1862,7 @@ func (b *BaselineMetadata) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ColumnDefinition. func (c ColumnDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "name", c.Name) populate(objectMap, "type", c.Type) return json.Marshal(objectMap) @@ -1640,7 +1893,7 @@ func (c *ColumnDefinition) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Condition. func (c Condition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "dimensions", c.Dimensions) populate(objectMap, "failingPeriods", c.FailingPeriods) populate(objectMap, "metricMeasureColumn", c.MetricMeasureColumn) @@ -1699,7 +1952,7 @@ func (c *Condition) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ConditionFailingPeriods. func (c ConditionFailingPeriods) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "minFailingPeriodsToAlert", c.MinFailingPeriodsToAlert) populate(objectMap, "numberOfEvaluationPeriods", c.NumberOfEvaluationPeriods) return json.Marshal(objectMap) @@ -1730,7 +1983,7 @@ func (c *ConditionFailingPeriods) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ConfigurationAccessEndpointSpec. func (c ConfigurationAccessEndpointSpec) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "endpoint", c.Endpoint) return json.Marshal(objectMap) } @@ -1757,7 +2010,7 @@ func (c *ConfigurationAccessEndpointSpec) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Context. func (c Context) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "contextType", c.ContextType) populate(objectMap, "notificationSource", c.NotificationSource) return json.Marshal(objectMap) @@ -1788,7 +2041,7 @@ func (c *Context) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpoint. func (d DataCollectionEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "configurationAccess", d.ConfigurationAccess) populate(objectMap, "description", d.Description) populate(objectMap, "immutableId", d.ImmutableID) @@ -1835,7 +2088,7 @@ func (d *DataCollectionEndpoint) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointConfigurationAccess. func (d DataCollectionEndpointConfigurationAccess) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "endpoint", d.Endpoint) return json.Marshal(objectMap) } @@ -1862,7 +2115,7 @@ func (d *DataCollectionEndpointConfigurationAccess) UnmarshalJSON(data []byte) e // MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointLogsIngestion. func (d DataCollectionEndpointLogsIngestion) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "endpoint", d.Endpoint) return json.Marshal(objectMap) } @@ -1889,7 +2142,7 @@ func (d *DataCollectionEndpointLogsIngestion) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointNetworkACLs. func (d DataCollectionEndpointNetworkACLs) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "publicNetworkAccess", d.PublicNetworkAccess) return json.Marshal(objectMap) } @@ -1916,7 +2169,7 @@ func (d *DataCollectionEndpointNetworkACLs) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointResource. func (d DataCollectionEndpointResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "etag", d.Etag) populate(objectMap, "id", d.ID) populate(objectMap, "kind", d.Kind) @@ -1975,7 +2228,7 @@ func (d *DataCollectionEndpointResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointResourceListResult. func (d DataCollectionEndpointResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", d.NextLink) populate(objectMap, "value", d.Value) return json.Marshal(objectMap) @@ -2006,7 +2259,7 @@ func (d *DataCollectionEndpointResourceListResult) UnmarshalJSON(data []byte) er // MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointResourceProperties. func (d DataCollectionEndpointResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "configurationAccess", d.ConfigurationAccess) populate(objectMap, "description", d.Description) populate(objectMap, "immutableId", d.ImmutableID) @@ -2053,7 +2306,7 @@ func (d *DataCollectionEndpointResourceProperties) UnmarshalJSON(data []byte) er // MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointResourceSystemData. func (d DataCollectionEndpointResourceSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "createdAt", d.CreatedAt) populate(objectMap, "createdBy", d.CreatedBy) populate(objectMap, "createdByType", d.CreatedByType) @@ -2100,7 +2353,7 @@ func (d *DataCollectionEndpointResourceSystemData) UnmarshalJSON(data []byte) er // MarshalJSON implements the json.Marshaller interface for type DataCollectionRule. func (d DataCollectionRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "dataCollectionEndpointId", d.DataCollectionEndpointID) populate(objectMap, "dataFlows", d.DataFlows) populate(objectMap, "dataSources", d.DataSources) @@ -2159,7 +2412,7 @@ func (d *DataCollectionRule) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociation. func (d DataCollectionRuleAssociation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "dataCollectionEndpointId", d.DataCollectionEndpointID) populate(objectMap, "dataCollectionRuleId", d.DataCollectionRuleID) populate(objectMap, "description", d.Description) @@ -2202,7 +2455,7 @@ func (d *DataCollectionRuleAssociation) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociationMetadata. func (d DataCollectionRuleAssociationMetadata) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "provisionedBy", d.ProvisionedBy) return json.Marshal(objectMap) } @@ -2229,7 +2482,7 @@ func (d *DataCollectionRuleAssociationMetadata) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociationProxyOnlyResource. func (d DataCollectionRuleAssociationProxyOnlyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "etag", d.Etag) populate(objectMap, "id", d.ID) populate(objectMap, "name", d.Name) @@ -2276,7 +2529,7 @@ func (d *DataCollectionRuleAssociationProxyOnlyResource) UnmarshalJSON(data []by // MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociationProxyOnlyResourceListResult. func (d DataCollectionRuleAssociationProxyOnlyResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", d.NextLink) populate(objectMap, "value", d.Value) return json.Marshal(objectMap) @@ -2307,7 +2560,7 @@ func (d *DataCollectionRuleAssociationProxyOnlyResourceListResult) UnmarshalJSON // MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociationProxyOnlyResourceProperties. func (d DataCollectionRuleAssociationProxyOnlyResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "dataCollectionEndpointId", d.DataCollectionEndpointID) populate(objectMap, "dataCollectionRuleId", d.DataCollectionRuleID) populate(objectMap, "description", d.Description) @@ -2350,7 +2603,7 @@ func (d *DataCollectionRuleAssociationProxyOnlyResourceProperties) UnmarshalJSON // MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociationProxyOnlyResourceSystemData. func (d DataCollectionRuleAssociationProxyOnlyResourceSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "createdAt", d.CreatedAt) populate(objectMap, "createdBy", d.CreatedBy) populate(objectMap, "createdByType", d.CreatedByType) @@ -2397,7 +2650,7 @@ func (d *DataCollectionRuleAssociationProxyOnlyResourceSystemData) UnmarshalJSON // MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleDataSources. func (d DataCollectionRuleDataSources) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "extensions", d.Extensions) populate(objectMap, "iisLogs", d.IisLogs) populate(objectMap, "logFiles", d.LogFiles) @@ -2444,7 +2697,7 @@ func (d *DataCollectionRuleDataSources) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleDestinations. func (d DataCollectionRuleDestinations) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "azureMonitorMetrics", d.AzureMonitorMetrics) populate(objectMap, "logAnalytics", d.LogAnalytics) return json.Marshal(objectMap) @@ -2475,7 +2728,7 @@ func (d *DataCollectionRuleDestinations) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleMetadata. func (d DataCollectionRuleMetadata) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "provisionedBy", d.ProvisionedBy) return json.Marshal(objectMap) } @@ -2502,7 +2755,7 @@ func (d *DataCollectionRuleMetadata) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleResource. func (d DataCollectionRuleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "etag", d.Etag) populate(objectMap, "id", d.ID) populate(objectMap, "kind", d.Kind) @@ -2561,7 +2814,7 @@ func (d *DataCollectionRuleResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleResourceListResult. func (d DataCollectionRuleResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", d.NextLink) populate(objectMap, "value", d.Value) return json.Marshal(objectMap) @@ -2592,7 +2845,7 @@ func (d *DataCollectionRuleResourceListResult) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleResourceProperties. func (d DataCollectionRuleResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "dataCollectionEndpointId", d.DataCollectionEndpointID) populate(objectMap, "dataFlows", d.DataFlows) populate(objectMap, "dataSources", d.DataSources) @@ -2651,7 +2904,7 @@ func (d *DataCollectionRuleResourceProperties) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleResourceSystemData. func (d DataCollectionRuleResourceSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "createdAt", d.CreatedAt) populate(objectMap, "createdBy", d.CreatedBy) populate(objectMap, "createdByType", d.CreatedByType) @@ -2698,7 +2951,7 @@ func (d *DataCollectionRuleResourceSystemData) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type DataContainer. func (d DataContainer) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "workspace", d.Workspace) return json.Marshal(objectMap) } @@ -2725,7 +2978,7 @@ func (d *DataContainer) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DataFlow. func (d DataFlow) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "destinations", d.Destinations) populate(objectMap, "outputStream", d.OutputStream) populate(objectMap, "streams", d.Streams) @@ -2764,7 +3017,7 @@ func (d *DataFlow) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DataSourcesSpec. func (d DataSourcesSpec) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "extensions", d.Extensions) populate(objectMap, "iisLogs", d.IisLogs) populate(objectMap, "logFiles", d.LogFiles) @@ -2811,7 +3064,7 @@ func (d *DataSourcesSpec) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DefaultErrorResponse. func (d DefaultErrorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "error", d.Error) return json.Marshal(objectMap) } @@ -2838,7 +3091,7 @@ func (d *DefaultErrorResponse) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DestinationsSpec. func (d DestinationsSpec) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "azureMonitorMetrics", d.AzureMonitorMetrics) populate(objectMap, "logAnalytics", d.LogAnalytics) return json.Marshal(objectMap) @@ -2869,7 +3122,7 @@ func (d *DestinationsSpec) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DestinationsSpecAzureMonitorMetrics. func (d DestinationsSpecAzureMonitorMetrics) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "name", d.Name) return json.Marshal(objectMap) } @@ -2896,7 +3149,7 @@ func (d *DestinationsSpecAzureMonitorMetrics) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DiagnosticSettings. func (d DiagnosticSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "eventHubAuthorizationRuleId", d.EventHubAuthorizationRuleID) populate(objectMap, "eventHubName", d.EventHubName) populate(objectMap, "logAnalyticsDestinationType", d.LogAnalyticsDestinationType) @@ -2955,7 +3208,7 @@ func (d *DiagnosticSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DiagnosticSettingsCategory. func (d DiagnosticSettingsCategory) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "categoryGroups", d.CategoryGroups) populate(objectMap, "categoryType", d.CategoryType) return json.Marshal(objectMap) @@ -2986,7 +3239,7 @@ func (d *DiagnosticSettingsCategory) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DiagnosticSettingsCategoryResource. func (d DiagnosticSettingsCategoryResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", d.ID) populate(objectMap, "name", d.Name) populate(objectMap, "properties", d.Properties) @@ -3029,7 +3282,7 @@ func (d *DiagnosticSettingsCategoryResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DiagnosticSettingsCategoryResourceCollection. func (d DiagnosticSettingsCategoryResourceCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } @@ -3056,7 +3309,7 @@ func (d *DiagnosticSettingsCategoryResourceCollection) UnmarshalJSON(data []byte // MarshalJSON implements the json.Marshaller interface for type DiagnosticSettingsResource. func (d DiagnosticSettingsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", d.ID) populate(objectMap, "name", d.Name) populate(objectMap, "properties", d.Properties) @@ -3099,7 +3352,7 @@ func (d *DiagnosticSettingsResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DiagnosticSettingsResourceCollection. func (d DiagnosticSettingsResourceCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } @@ -3126,7 +3379,7 @@ func (d *DiagnosticSettingsResourceCollection) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type Dimension. func (d Dimension) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "name", d.Name) populate(objectMap, "operator", d.Operator) populate(objectMap, "values", d.Values) @@ -3161,7 +3414,7 @@ func (d *Dimension) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DynamicMetricCriteria. func (d DynamicMetricCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "alertSensitivity", d.AlertSensitivity) objectMap["criterionType"] = CriterionTypeDynamicThresholdCriterion populate(objectMap, "dimensions", d.Dimensions) @@ -3225,10 +3478,10 @@ func (d *DynamicMetricCriteria) UnmarshalJSON(data []byte) error { delete(rawMsg, key) default: if d.AdditionalProperties == nil { - d.AdditionalProperties = map[string]interface{}{} + d.AdditionalProperties = map[string]any{} } if val != nil { - var aux interface{} + var aux any err = json.Unmarshal(val, &aux) d.AdditionalProperties[key] = aux } @@ -3243,7 +3496,7 @@ func (d *DynamicMetricCriteria) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DynamicThresholdFailingPeriods. func (d DynamicThresholdFailingPeriods) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "minFailingPeriodsToAlert", d.MinFailingPeriodsToAlert) populate(objectMap, "numberOfEvaluationPeriods", d.NumberOfEvaluationPeriods) return json.Marshal(objectMap) @@ -3274,7 +3527,7 @@ func (d *DynamicThresholdFailingPeriods) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type EmailNotification. func (e EmailNotification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "customEmails", e.CustomEmails) populate(objectMap, "sendToSubscriptionAdministrator", e.SendToSubscriptionAdministrator) populate(objectMap, "sendToSubscriptionCoAdministrators", e.SendToSubscriptionCoAdministrators) @@ -3309,7 +3562,7 @@ func (e *EmailNotification) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type EmailReceiver. func (e EmailReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "emailAddress", e.EmailAddress) populate(objectMap, "name", e.Name) populate(objectMap, "status", e.Status) @@ -3348,7 +3601,7 @@ func (e *EmailReceiver) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type EnableRequest. func (e EnableRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "receiverName", e.ReceiverName) return json.Marshal(objectMap) } @@ -3375,7 +3628,7 @@ func (e *EnableRequest) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Error. func (e Error) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "code", e.Code) populate(objectMap, "message", e.Message) return json.Marshal(objectMap) @@ -3406,7 +3659,7 @@ func (e *Error) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "info", &e.Info) populate(objectMap, "type", e.Type) return json.Marshal(objectMap) @@ -3437,7 +3690,7 @@ func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ErrorContract. func (e ErrorContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "error", e.Error) return json.Marshal(objectMap) } @@ -3464,7 +3717,7 @@ func (e *ErrorContract) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ErrorDetail. func (e ErrorDetail) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "additionalInfo", e.AdditionalInfo) populate(objectMap, "code", e.Code) populate(objectMap, "details", e.Details) @@ -3505,9 +3758,52 @@ func (e *ErrorDetail) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ErrorDetailAutoGenerated. +func (e ErrorDetailAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetailAutoGenerated. +func (e *ErrorDetailAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ErrorResponse. func (e ErrorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "code", e.Code) populate(objectMap, "message", e.Message) return json.Marshal(objectMap) @@ -3538,7 +3834,7 @@ func (e *ErrorResponse) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ErrorResponseAdditionalInfo. func (e ErrorResponseAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "info", &e.Info) populate(objectMap, "type", e.Type) return json.Marshal(objectMap) @@ -3569,7 +3865,7 @@ func (e *ErrorResponseAdditionalInfo) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ErrorResponseAutoGenerated. func (e ErrorResponseAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "code", e.Code) populate(objectMap, "message", e.Message) return json.Marshal(objectMap) @@ -3598,9 +3894,36 @@ func (e *ErrorResponseAutoGenerated) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseAutoGenerated2. +func (e ErrorResponseAutoGenerated2) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAutoGenerated2. +func (e *ErrorResponseAutoGenerated2) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ErrorResponseCommonV2. func (e ErrorResponseCommonV2) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "error", e.Error) return json.Marshal(objectMap) } @@ -3627,7 +3950,7 @@ func (e *ErrorResponseCommonV2) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ErrorResponseDetails. func (e ErrorResponseDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "additionalInfo", e.AdditionalInfo) populate(objectMap, "code", e.Code) populate(objectMap, "details", e.Details) @@ -3670,7 +3993,7 @@ func (e *ErrorResponseDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type EventCategoryCollection. func (e EventCategoryCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "value", e.Value) return json.Marshal(objectMap) } @@ -3697,7 +4020,7 @@ func (e *EventCategoryCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type EventData. func (e EventData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "authorization", e.Authorization) populate(objectMap, "caller", e.Caller) populate(objectMap, "category", e.Category) @@ -3816,7 +4139,7 @@ func (e *EventData) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type EventDataCollection. func (e EventDataCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", e.NextLink) populate(objectMap, "value", e.Value) return json.Marshal(objectMap) @@ -3847,7 +4170,7 @@ func (e *EventDataCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type EventHubReceiver. func (e EventHubReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "eventHubName", e.EventHubName) populate(objectMap, "eventHubNameSpace", e.EventHubNameSpace) populate(objectMap, "name", e.Name) @@ -3894,7 +4217,7 @@ func (e *EventHubReceiver) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ExtensionDataSource. func (e ExtensionDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "extensionName", e.ExtensionName) populate(objectMap, "extensionSettings", &e.ExtensionSettings) populate(objectMap, "inputDataSources", e.InputDataSources) @@ -3937,7 +4260,7 @@ func (e *ExtensionDataSource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type HTTPRequestInfo. func (h HTTPRequestInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "clientIpAddress", h.ClientIPAddress) populate(objectMap, "clientRequestId", h.ClientRequestID) populate(objectMap, "method", h.Method) @@ -3954,21 +4277,60 @@ func (h *HTTPRequestInfo) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "clientIpAddress": - err = unpopulate(val, "ClientIPAddress", &h.ClientIPAddress) + case "clientIpAddress": + err = unpopulate(val, "ClientIPAddress", &h.ClientIPAddress) + delete(rawMsg, key) + case "clientRequestId": + err = unpopulate(val, "ClientRequestID", &h.ClientRequestID) + delete(rawMsg, key) + case "method": + err = unpopulate(val, "Method", &h.Method) + delete(rawMsg, key) + case "uri": + err = unpopulate(val, "URI", &h.URI) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", i.PrincipalID) + populate(objectMap, "tenantId", i.TenantID) + populate(objectMap, "type", i.Type) + populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Identity. +func (i *Identity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &i.PrincipalID) delete(rawMsg, key) - case "clientRequestId": - err = unpopulate(val, "ClientRequestID", &h.ClientRequestID) + case "tenantId": + err = unpopulate(val, "TenantID", &i.TenantID) delete(rawMsg, key) - case "method": - err = unpopulate(val, "Method", &h.Method) + case "type": + err = unpopulate(val, "Type", &i.Type) delete(rawMsg, key) - case "uri": - err = unpopulate(val, "URI", &h.URI) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &i.UserAssignedIdentities) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil @@ -3976,7 +4338,7 @@ func (h *HTTPRequestInfo) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type IisLogsDataSource. func (i IisLogsDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "logDirectories", i.LogDirectories) populate(objectMap, "name", i.Name) populate(objectMap, "streams", i.Streams) @@ -4011,7 +4373,7 @@ func (i *IisLogsDataSource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Incident. func (i Incident) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "activatedTime", i.ActivatedTime) populate(objectMap, "isActive", i.IsActive) populate(objectMap, "name", i.Name) @@ -4054,7 +4416,7 @@ func (i *Incident) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type IncidentListResult. func (i IncidentListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "value", i.Value) return json.Marshal(objectMap) } @@ -4079,9 +4441,40 @@ func (i *IncidentListResult) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type IngestionSettings. +func (i IngestionSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dataCollectionEndpointResourceId", i.DataCollectionEndpointResourceID) + populate(objectMap, "dataCollectionRuleResourceId", i.DataCollectionRuleResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IngestionSettings. +func (i *IngestionSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataCollectionEndpointResourceId": + err = unpopulate(val, "DataCollectionEndpointResourceID", &i.DataCollectionEndpointResourceID) + delete(rawMsg, key) + case "dataCollectionRuleResourceId": + err = unpopulate(val, "DataCollectionRuleResourceID", &i.DataCollectionRuleResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ItsmReceiver. func (i ItsmReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "connectionId", i.ConnectionID) populate(objectMap, "name", i.Name) populate(objectMap, "region", i.Region) @@ -4124,7 +4517,7 @@ func (i *ItsmReceiver) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type LocalizableString. func (l LocalizableString) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "localizedValue", l.LocalizedValue) populate(objectMap, "value", l.Value) return json.Marshal(objectMap) @@ -4155,7 +4548,7 @@ func (l *LocalizableString) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type LocationThresholdRuleCondition. func (l LocationThresholdRuleCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "dataSource", l.DataSource) populate(objectMap, "failedLocationCount", l.FailedLocationCount) objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition" @@ -4194,7 +4587,7 @@ func (l *LocationThresholdRuleCondition) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type LogAnalyticsDestination. func (l LogAnalyticsDestination) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "name", l.Name) populate(objectMap, "workspaceId", l.WorkspaceID) populate(objectMap, "workspaceResourceId", l.WorkspaceResourceID) @@ -4229,7 +4622,7 @@ func (l *LogAnalyticsDestination) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type LogFileSettings. func (l LogFileSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "text", l.Text) return json.Marshal(objectMap) } @@ -4256,7 +4649,7 @@ func (l *LogFileSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type LogFileSettingsText. func (l LogFileSettingsText) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "recordStartTimestampFormat", l.RecordStartTimestampFormat) return json.Marshal(objectMap) } @@ -4283,7 +4676,7 @@ func (l *LogFileSettingsText) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type LogFileTextSettings. func (l LogFileTextSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "recordStartTimestampFormat", l.RecordStartTimestampFormat) return json.Marshal(objectMap) } @@ -4310,7 +4703,7 @@ func (l *LogFileTextSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type LogFilesDataSource. func (l LogFilesDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "filePatterns", l.FilePatterns) populate(objectMap, "format", l.Format) populate(objectMap, "name", l.Name) @@ -4353,7 +4746,7 @@ func (l *LogFilesDataSource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type LogFilesDataSourceSettings. func (l LogFilesDataSourceSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "text", l.Text) return json.Marshal(objectMap) } @@ -4380,7 +4773,7 @@ func (l *LogFilesDataSourceSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type LogProfileCollection. func (l LogProfileCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "value", l.Value) return json.Marshal(objectMap) } @@ -4407,7 +4800,7 @@ func (l *LogProfileCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type LogProfileProperties. func (l LogProfileProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "categories", l.Categories) populate(objectMap, "locations", l.Locations) populate(objectMap, "retentionPolicy", l.RetentionPolicy) @@ -4450,7 +4843,7 @@ func (l *LogProfileProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type LogProfileResource. func (l LogProfileResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", l.ID) populate(objectMap, "location", l.Location) populate(objectMap, "name", l.Name) @@ -4497,7 +4890,7 @@ func (l *LogProfileResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type LogProfileResourcePatch. func (l LogProfileResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", l.Properties) populate(objectMap, "tags", l.Tags) return json.Marshal(objectMap) @@ -4528,7 +4921,7 @@ func (l *LogProfileResourcePatch) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type LogSettings. func (l LogSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "category", l.Category) populate(objectMap, "categoryGroup", l.CategoryGroup) populate(objectMap, "enabled", l.Enabled) @@ -4567,7 +4960,7 @@ func (l *LogSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type LogicAppReceiver. func (l LogicAppReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "callbackUrl", l.CallbackURL) populate(objectMap, "name", l.Name) populate(objectMap, "resourceId", l.ResourceID) @@ -4606,7 +4999,7 @@ func (l *LogicAppReceiver) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type LogsIngestionEndpointSpec. func (l LogsIngestionEndpointSpec) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "endpoint", l.Endpoint) return json.Marshal(objectMap) } @@ -4633,7 +5026,7 @@ func (l *LogsIngestionEndpointSpec) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ManagementEventAggregationCondition. func (m ManagementEventAggregationCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "operator", m.Operator) populate(objectMap, "threshold", m.Threshold) populate(objectMap, "windowSize", m.WindowSize) @@ -4668,7 +5061,7 @@ func (m *ManagementEventAggregationCondition) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ManagementEventRuleCondition. func (m ManagementEventRuleCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "aggregation", m.Aggregation) populate(objectMap, "dataSource", m.DataSource) objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition" @@ -4703,7 +5096,7 @@ func (m *ManagementEventRuleCondition) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Metadata. func (m Metadata) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "provisionedBy", m.ProvisionedBy) return json.Marshal(objectMap) } @@ -4730,7 +5123,7 @@ func (m *Metadata) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetadataValue. func (m MetadataValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "name", m.Name) populate(objectMap, "value", m.Value) return json.Marshal(objectMap) @@ -4761,7 +5154,7 @@ func (m *MetadataValue) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Metric. func (m Metric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "displayDescription", m.DisplayDescription) populate(objectMap, "errorCode", m.ErrorCode) populate(objectMap, "errorMessage", m.ErrorMessage) @@ -4816,7 +5209,7 @@ func (m *Metric) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricAlertAction. func (m MetricAlertAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "actionGroupId", m.ActionGroupID) populate(objectMap, "webHookProperties", m.WebHookProperties) return json.Marshal(objectMap) @@ -4847,7 +5240,7 @@ func (m *MetricAlertAction) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricAlertCriteria. func (m MetricAlertCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["odata.type"] = m.ODataType if m.AdditionalProperties != nil { for key, val := range m.AdditionalProperties { @@ -4871,10 +5264,10 @@ func (m *MetricAlertCriteria) UnmarshalJSON(data []byte) error { delete(rawMsg, key) default: if m.AdditionalProperties == nil { - m.AdditionalProperties = map[string]interface{}{} + m.AdditionalProperties = map[string]any{} } if val != nil { - var aux interface{} + var aux any err = json.Unmarshal(val, &aux) m.AdditionalProperties[key] = aux } @@ -4889,7 +5282,7 @@ func (m *MetricAlertCriteria) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricAlertMultipleResourceMultipleMetricCriteria. func (m MetricAlertMultipleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "allOf", m.AllOf) objectMap["odata.type"] = OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria if m.AdditionalProperties != nil { @@ -4917,10 +5310,10 @@ func (m *MetricAlertMultipleResourceMultipleMetricCriteria) UnmarshalJSON(data [ delete(rawMsg, key) default: if m.AdditionalProperties == nil { - m.AdditionalProperties = map[string]interface{}{} + m.AdditionalProperties = map[string]any{} } if val != nil { - var aux interface{} + var aux any err = json.Unmarshal(val, &aux) m.AdditionalProperties[key] = aux } @@ -4935,7 +5328,7 @@ func (m *MetricAlertMultipleResourceMultipleMetricCriteria) UnmarshalJSON(data [ // MarshalJSON implements the json.Marshaller interface for type MetricAlertProperties. func (m MetricAlertProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "actions", m.Actions) populate(objectMap, "autoMitigate", m.AutoMitigate) populate(objectMap, "criteria", m.Criteria) @@ -5010,7 +5403,7 @@ func (m *MetricAlertProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricAlertPropertiesPatch. func (m MetricAlertPropertiesPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "actions", m.Actions) populate(objectMap, "autoMitigate", m.AutoMitigate) populate(objectMap, "criteria", m.Criteria) @@ -5085,7 +5478,7 @@ func (m *MetricAlertPropertiesPatch) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricAlertResource. func (m MetricAlertResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", m.ID) populate(objectMap, "location", m.Location) populate(objectMap, "name", m.Name) @@ -5132,7 +5525,7 @@ func (m *MetricAlertResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricAlertResourceCollection. func (m MetricAlertResourceCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "value", m.Value) return json.Marshal(objectMap) } @@ -5159,7 +5552,7 @@ func (m *MetricAlertResourceCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricAlertResourcePatch. func (m MetricAlertResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", m.Properties) populate(objectMap, "tags", m.Tags) return json.Marshal(objectMap) @@ -5190,7 +5583,7 @@ func (m *MetricAlertResourcePatch) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricAlertSingleResourceMultipleMetricCriteria. func (m MetricAlertSingleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "allOf", m.AllOf) objectMap["odata.type"] = OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria if m.AdditionalProperties != nil { @@ -5218,10 +5611,10 @@ func (m *MetricAlertSingleResourceMultipleMetricCriteria) UnmarshalJSON(data []b delete(rawMsg, key) default: if m.AdditionalProperties == nil { - m.AdditionalProperties = map[string]interface{}{} + m.AdditionalProperties = map[string]any{} } if val != nil { - var aux interface{} + var aux any err = json.Unmarshal(val, &aux) m.AdditionalProperties[key] = aux } @@ -5236,7 +5629,7 @@ func (m *MetricAlertSingleResourceMultipleMetricCriteria) UnmarshalJSON(data []b // MarshalJSON implements the json.Marshaller interface for type MetricAlertStatus. func (m MetricAlertStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", m.ID) populate(objectMap, "name", m.Name) populate(objectMap, "properties", m.Properties) @@ -5275,7 +5668,7 @@ func (m *MetricAlertStatus) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricAlertStatusCollection. func (m MetricAlertStatusCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "value", m.Value) return json.Marshal(objectMap) } @@ -5302,7 +5695,7 @@ func (m *MetricAlertStatusCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricAlertStatusProperties. func (m MetricAlertStatusProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "dimensions", m.Dimensions) populate(objectMap, "status", m.Status) populateTimeRFC3339(objectMap, "timestamp", m.Timestamp) @@ -5337,7 +5730,7 @@ func (m *MetricAlertStatusProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricAvailability. func (m MetricAvailability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "retention", m.Retention) populate(objectMap, "timeGrain", m.TimeGrain) return json.Marshal(objectMap) @@ -5368,7 +5761,7 @@ func (m *MetricAvailability) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricBaselinesProperties. func (m MetricBaselinesProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "baselines", m.Baselines) populate(objectMap, "interval", m.Interval) populate(objectMap, "namespace", m.Namespace) @@ -5407,7 +5800,7 @@ func (m *MetricBaselinesProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricBaselinesResponse. func (m MetricBaselinesResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "value", m.Value) return json.Marshal(objectMap) } @@ -5434,7 +5827,7 @@ func (m *MetricBaselinesResponse) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricCriteria. func (m MetricCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["criterionType"] = CriterionTypeStaticThresholdCriterion populate(objectMap, "dimensions", m.Dimensions) populate(objectMap, "metricName", m.MetricName) @@ -5490,10 +5883,10 @@ func (m *MetricCriteria) UnmarshalJSON(data []byte) error { delete(rawMsg, key) default: if m.AdditionalProperties == nil { - m.AdditionalProperties = map[string]interface{}{} + m.AdditionalProperties = map[string]any{} } if val != nil { - var aux interface{} + var aux any err = json.Unmarshal(val, &aux) m.AdditionalProperties[key] = aux } @@ -5508,7 +5901,7 @@ func (m *MetricCriteria) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricDefinition. func (m MetricDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "category", m.Category) populate(objectMap, "dimensions", m.Dimensions) populate(objectMap, "displayDescription", m.DisplayDescription) @@ -5583,7 +5976,7 @@ func (m *MetricDefinition) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricDefinitionCollection. func (m MetricDefinitionCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "value", m.Value) return json.Marshal(objectMap) } @@ -5610,7 +6003,7 @@ func (m *MetricDefinitionCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricDimension. func (m MetricDimension) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "name", m.Name) populate(objectMap, "operator", m.Operator) populate(objectMap, "values", m.Values) @@ -5645,7 +6038,7 @@ func (m *MetricDimension) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricNamespace. func (m MetricNamespace) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "classification", m.Classification) populate(objectMap, "id", m.ID) populate(objectMap, "name", m.Name) @@ -5688,7 +6081,7 @@ func (m *MetricNamespace) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricNamespaceCollection. func (m MetricNamespaceCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "value", m.Value) return json.Marshal(objectMap) } @@ -5715,7 +6108,7 @@ func (m *MetricNamespaceCollection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricNamespaceName. func (m MetricNamespaceName) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "metricNamespaceName", m.MetricNamespaceName) return json.Marshal(objectMap) } @@ -5742,7 +6135,7 @@ func (m *MetricNamespaceName) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricSettings. func (m MetricSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "category", m.Category) populate(objectMap, "enabled", m.Enabled) populate(objectMap, "retentionPolicy", m.RetentionPolicy) @@ -5781,7 +6174,7 @@ func (m *MetricSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricSingleDimension. func (m MetricSingleDimension) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "name", m.Name) populate(objectMap, "value", m.Value) return json.Marshal(objectMap) @@ -5812,7 +6205,7 @@ func (m *MetricSingleDimension) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricTrigger. func (m MetricTrigger) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "dimensions", m.Dimensions) populate(objectMap, "dividePerInstance", m.DividePerInstance) populate(objectMap, "metricName", m.MetricName) @@ -5883,7 +6276,7 @@ func (m *MetricTrigger) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricValue. func (m MetricValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "average", m.Average) populate(objectMap, "count", m.Count) populate(objectMap, "maximum", m.Maximum) @@ -5928,9 +6321,40 @@ func (m *MetricValue) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Metrics. +func (m Metrics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "internalId", m.InternalID) + populate(objectMap, "prometheusQueryEndpoint", m.PrometheusQueryEndpoint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Metrics. +func (m *Metrics) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "internalId": + err = unpopulate(val, "InternalID", &m.InternalID) + delete(rawMsg, key) + case "prometheusQueryEndpoint": + err = unpopulate(val, "PrometheusQueryEndpoint", &m.PrometheusQueryEndpoint) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type MultiMetricCriteria. func (m MultiMetricCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["criterionType"] = m.CriterionType populate(objectMap, "dimensions", m.Dimensions) populate(objectMap, "metricName", m.MetricName) @@ -5978,10 +6402,10 @@ func (m *MultiMetricCriteria) UnmarshalJSON(data []byte) error { delete(rawMsg, key) default: if m.AdditionalProperties == nil { - m.AdditionalProperties = map[string]interface{}{} + m.AdditionalProperties = map[string]any{} } if val != nil { - var aux interface{} + var aux any err = json.Unmarshal(val, &aux) m.AdditionalProperties[key] = aux } @@ -5996,7 +6420,7 @@ func (m *MultiMetricCriteria) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type NetworkRuleSet. func (n NetworkRuleSet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "publicNetworkAccess", n.PublicNetworkAccess) return json.Marshal(objectMap) } @@ -6023,7 +6447,7 @@ func (n *NetworkRuleSet) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type NotificationRequestBody. func (n NotificationRequestBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "alertType", n.AlertType) populate(objectMap, "armRoleReceivers", n.ArmRoleReceivers) populate(objectMap, "automationRunbookReceivers", n.AutomationRunbookReceivers) @@ -6094,7 +6518,7 @@ 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]interface{}) + objectMap := make(map[string]any) populate(objectMap, "display", o.Display) populate(objectMap, "name", o.Name) return json.Marshal(objectMap) @@ -6123,9 +6547,52 @@ func (o *Operation) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type OperationAutoGenerated. +func (o OperationAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationAutoGenerated. +func (o *OperationAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type OperationDisplay. func (o OperationDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "operation", o.Operation) populate(objectMap, "provider", o.Provider) populate(objectMap, "resource", o.Resource) @@ -6158,9 +6625,48 @@ func (o *OperationDisplay) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type OperationDisplayAutoGenerated. +func (o OperationDisplayAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplayAutoGenerated. +func (o *OperationDisplayAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type OperationListResult. func (o OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", o.NextLink) populate(objectMap, "value", o.Value) return json.Marshal(objectMap) @@ -6189,9 +6695,40 @@ func (o *OperationListResult) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type OperationListResultAutoGenerated. +func (o OperationListResultAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResultAutoGenerated. +func (o *OperationListResultAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type OperationStatus. func (o OperationStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "endTime", o.EndTime) populate(objectMap, "error", o.Error) populate(objectMap, "id", o.ID) @@ -6238,7 +6775,7 @@ func (o *OperationStatus) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PerfCounterDataSource. func (p PerfCounterDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "counterSpecifiers", p.CounterSpecifiers) populate(objectMap, "name", p.Name) populate(objectMap, "samplingFrequencyInSeconds", p.SamplingFrequencyInSeconds) @@ -6277,7 +6814,7 @@ func (p *PerfCounterDataSource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PredictiveAutoscalePolicy. func (p PredictiveAutoscalePolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "scaleLookAheadTime", p.ScaleLookAheadTime) populate(objectMap, "scaleMode", p.ScaleMode) return json.Marshal(objectMap) @@ -6308,7 +6845,7 @@ func (p *PredictiveAutoscalePolicy) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PredictiveResponse. func (p PredictiveResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "data", p.Data) populate(objectMap, "interval", p.Interval) populate(objectMap, "metricName", p.MetricName) @@ -6351,7 +6888,7 @@ func (p *PredictiveResponse) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PredictiveValue. func (p PredictiveValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "timeStamp", p.TimeStamp) populate(objectMap, "value", p.Value) return json.Marshal(objectMap) @@ -6382,7 +6919,7 @@ func (p *PredictiveValue) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PrivateEndpoint. func (p PrivateEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", p.ID) return json.Marshal(objectMap) } @@ -6409,7 +6946,7 @@ func (p *PrivateEndpoint) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) populate(objectMap, "properties", p.Properties) @@ -6448,7 +6985,7 @@ func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } @@ -6475,7 +7012,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]interface{}) + objectMap := make(map[string]any) populate(objectMap, "privateEndpoint", p.PrivateEndpoint) populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) populate(objectMap, "provisioningState", p.ProvisioningState) @@ -6510,7 +7047,7 @@ func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) populate(objectMap, "properties", p.Properties) @@ -6549,7 +7086,7 @@ func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } @@ -6576,7 +7113,7 @@ func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "groupId", p.GroupID) populate(objectMap, "requiredMembers", p.RequiredMembers) populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) @@ -6611,7 +7148,7 @@ func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState. func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "actionsRequired", p.ActionsRequired) populate(objectMap, "description", p.Description) populate(objectMap, "status", p.Status) @@ -6646,7 +7183,7 @@ func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ProxyResource. func (p ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) populate(objectMap, "type", p.Type) @@ -6681,7 +7218,7 @@ func (p *ProxyResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ProxyResourceAutoGenerated. func (p ProxyResourceAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) populate(objectMap, "type", p.Type) @@ -6716,7 +7253,7 @@ func (p *ProxyResourceAutoGenerated) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Recurrence. func (r Recurrence) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "frequency", r.Frequency) populate(objectMap, "schedule", r.Schedule) return json.Marshal(objectMap) @@ -6747,7 +7284,7 @@ func (r *Recurrence) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecurrentSchedule. func (r RecurrentSchedule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "days", r.Days) populate(objectMap, "hours", r.Hours) populate(objectMap, "minutes", r.Minutes) @@ -6786,7 +7323,7 @@ func (r *RecurrentSchedule) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Resource. func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) @@ -6833,7 +7370,7 @@ func (r *Resource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated. func (r ResourceAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) @@ -6876,7 +7413,7 @@ func (r *ResourceAutoGenerated) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated2. func (r ResourceAutoGenerated2) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) @@ -6919,7 +7456,7 @@ func (r *ResourceAutoGenerated2) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated3. func (r ResourceAutoGenerated3) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "name", r.Name) populate(objectMap, "type", r.Type) @@ -6954,7 +7491,7 @@ func (r *ResourceAutoGenerated3) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated4. func (r ResourceAutoGenerated4) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) @@ -6995,9 +7532,48 @@ func (r *ResourceAutoGenerated4) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated5. +func (r ResourceAutoGenerated5) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated5. +func (r *ResourceAutoGenerated5) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ResourceForUpdate. func (r ResourceForUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "tags", r.Tags) return json.Marshal(objectMap) } @@ -7024,7 +7600,7 @@ func (r *ResourceForUpdate) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Response. func (r Response) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "cost", r.Cost) populate(objectMap, "interval", r.Interval) populate(objectMap, "namespace", r.Namespace) @@ -7071,7 +7647,7 @@ func (r *Response) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResponseWithError. func (r ResponseWithError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "error", r.Error) return json.Marshal(objectMap) } @@ -7098,7 +7674,7 @@ func (r *ResponseWithError) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RetentionPolicy. func (r RetentionPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "days", r.Days) populate(objectMap, "enabled", r.Enabled) return json.Marshal(objectMap) @@ -7129,7 +7705,7 @@ func (r *RetentionPolicy) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RuleAction. func (r RuleAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["odata.type"] = r.ODataType return json.Marshal(objectMap) } @@ -7156,7 +7732,7 @@ func (r *RuleAction) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RuleCondition. func (r RuleCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "dataSource", r.DataSource) objectMap["odata.type"] = r.ODataType return json.Marshal(objectMap) @@ -7187,7 +7763,7 @@ func (r *RuleCondition) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RuleDataSource. func (r RuleDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "legacyResourceId", r.LegacyResourceID) populate(objectMap, "metricNamespace", r.MetricNamespace) objectMap["odata.type"] = r.ODataType @@ -7230,7 +7806,7 @@ func (r *RuleDataSource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RuleEmailAction. func (r RuleEmailAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "customEmails", r.CustomEmails) objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.RuleEmailAction" populate(objectMap, "sendToServiceOwners", r.SendToServiceOwners) @@ -7265,7 +7841,7 @@ func (r *RuleEmailAction) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RuleManagementEventClaimsDataSource. func (r RuleManagementEventClaimsDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "emailAddress", r.EmailAddress) return json.Marshal(objectMap) } @@ -7292,7 +7868,7 @@ func (r *RuleManagementEventClaimsDataSource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RuleManagementEventDataSource. func (r RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "claims", r.Claims) populate(objectMap, "eventName", r.EventName) populate(objectMap, "eventSource", r.EventSource) @@ -7371,7 +7947,7 @@ func (r *RuleManagementEventDataSource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RuleMetricDataSource. func (r RuleMetricDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "legacyResourceId", r.LegacyResourceID) populate(objectMap, "metricName", r.MetricName) populate(objectMap, "metricNamespace", r.MetricNamespace) @@ -7416,9 +7992,40 @@ func (r *RuleMetricDataSource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type RuleResolveConfiguration. +func (r RuleResolveConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "autoResolved", r.AutoResolved) + populate(objectMap, "timeToResolve", r.TimeToResolve) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RuleResolveConfiguration. +func (r *RuleResolveConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "autoResolved": + err = unpopulate(val, "AutoResolved", &r.AutoResolved) + delete(rawMsg, key) + case "timeToResolve": + err = unpopulate(val, "TimeToResolve", &r.TimeToResolve) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type RuleWebhookAction. func (r RuleWebhookAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction" populate(objectMap, "properties", r.Properties) populate(objectMap, "serviceUri", r.ServiceURI) @@ -7453,7 +8060,7 @@ func (r *RuleWebhookAction) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ScaleAction. func (s ScaleAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "cooldown", s.Cooldown) populate(objectMap, "direction", s.Direction) populate(objectMap, "type", s.Type) @@ -7492,7 +8099,7 @@ func (s *ScaleAction) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ScaleCapacity. func (s ScaleCapacity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "default", s.Default) populate(objectMap, "maximum", s.Maximum) populate(objectMap, "minimum", s.Minimum) @@ -7527,7 +8134,7 @@ func (s *ScaleCapacity) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ScaleRule. func (s ScaleRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "metricTrigger", s.MetricTrigger) populate(objectMap, "scaleAction", s.ScaleAction) return json.Marshal(objectMap) @@ -7558,7 +8165,7 @@ func (s *ScaleRule) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ScaleRuleMetricDimension. func (s ScaleRuleMetricDimension) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "DimensionName", s.DimensionName) populate(objectMap, "Operator", s.Operator) populate(objectMap, "Values", s.Values) @@ -7593,7 +8200,7 @@ func (s *ScaleRuleMetricDimension) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ScheduledQueryRuleCriteria. func (s ScheduledQueryRuleCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "allOf", s.AllOf) return json.Marshal(objectMap) } @@ -7620,7 +8227,7 @@ func (s *ScheduledQueryRuleCriteria) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ScheduledQueryRuleProperties. func (s ScheduledQueryRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "actions", s.Actions) populate(objectMap, "autoMitigate", s.AutoMitigate) populate(objectMap, "checkWorkspaceAlertsStorageConfigured", s.CheckWorkspaceAlertsStorageConfigured) @@ -7634,6 +8241,8 @@ func (s ScheduledQueryRuleProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "isWorkspaceAlertsStorageConfigured", s.IsWorkspaceAlertsStorageConfigured) populate(objectMap, "muteActionsDuration", s.MuteActionsDuration) populate(objectMap, "overrideQueryTimeRange", s.OverrideQueryTimeRange) + populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) + populate(objectMap, "ruleResolveConfiguration", s.RuleResolveConfiguration) populate(objectMap, "scopes", s.Scopes) populate(objectMap, "severity", s.Severity) populate(objectMap, "skipQueryValidation", s.SkipQueryValidation) @@ -7690,6 +8299,12 @@ func (s *ScheduledQueryRuleProperties) UnmarshalJSON(data []byte) error { case "overrideQueryTimeRange": err = unpopulate(val, "OverrideQueryTimeRange", &s.OverrideQueryTimeRange) delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &s.PublicNetworkAccess) + delete(rawMsg, key) + case "ruleResolveConfiguration": + err = unpopulate(val, "RuleResolveConfiguration", &s.RuleResolveConfiguration) + delete(rawMsg, key) case "scopes": err = unpopulate(val, "Scopes", &s.Scopes) delete(rawMsg, key) @@ -7715,9 +8330,10 @@ func (s *ScheduledQueryRuleProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ScheduledQueryRuleResource. func (s ScheduledQueryRuleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "etag", s.Etag) populate(objectMap, "id", s.ID) + populate(objectMap, "identity", s.Identity) populate(objectMap, "kind", s.Kind) populate(objectMap, "location", s.Location) populate(objectMap, "name", s.Name) @@ -7743,6 +8359,9 @@ func (s *ScheduledQueryRuleResource) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &s.Identity) + delete(rawMsg, key) case "kind": err = unpopulate(val, "Kind", &s.Kind) delete(rawMsg, key) @@ -7774,7 +8393,7 @@ func (s *ScheduledQueryRuleResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ScheduledQueryRuleResourceCollection. func (s ScheduledQueryRuleResourceCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) @@ -7805,7 +8424,8 @@ func (s *ScheduledQueryRuleResourceCollection) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type ScheduledQueryRuleResourcePatch. func (s ScheduledQueryRuleResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) + populate(objectMap, "identity", s.Identity) populate(objectMap, "properties", s.Properties) populate(objectMap, "tags", s.Tags) return json.Marshal(objectMap) @@ -7820,6 +8440,9 @@ func (s *ScheduledQueryRuleResourcePatch) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "identity": + err = unpopulate(val, "Identity", &s.Identity) + delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) @@ -7836,7 +8459,7 @@ func (s *ScheduledQueryRuleResourcePatch) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ScopedResource. func (s ScopedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", s.ID) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) @@ -7879,7 +8502,7 @@ func (s *ScopedResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ScopedResourceListResult. func (s ScopedResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) @@ -7910,7 +8533,7 @@ func (s *ScopedResourceListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ScopedResourceProperties. func (s ScopedResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "linkedResourceId", s.LinkedResourceID) populate(objectMap, "provisioningState", s.ProvisioningState) return json.Marshal(objectMap) @@ -7941,7 +8564,7 @@ func (s *ScopedResourceProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SenderAuthorization. func (s SenderAuthorization) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "action", s.Action) populate(objectMap, "role", s.Role) populate(objectMap, "scope", s.Scope) @@ -7976,7 +8599,7 @@ func (s *SenderAuthorization) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SingleBaseline. func (s SingleBaseline) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "highThresholds", s.HighThresholds) populate(objectMap, "lowThresholds", s.LowThresholds) populate(objectMap, "sensitivity", s.Sensitivity) @@ -8011,7 +8634,7 @@ func (s *SingleBaseline) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SingleMetricBaseline. func (s SingleMetricBaseline) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", s.ID) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) @@ -8050,7 +8673,7 @@ func (s *SingleMetricBaseline) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SmsReceiver. func (s SmsReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "countryCode", s.CountryCode) populate(objectMap, "name", s.Name) populate(objectMap, "phoneNumber", s.PhoneNumber) @@ -8089,7 +8712,7 @@ func (s *SmsReceiver) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type StreamDeclaration. func (s StreamDeclaration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "columns", s.Columns) return json.Marshal(objectMap) } @@ -8116,7 +8739,7 @@ func (s *StreamDeclaration) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SyslogDataSource. func (s SyslogDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "facilityNames", s.FacilityNames) populate(objectMap, "logLevels", s.LogLevels) populate(objectMap, "name", s.Name) @@ -8155,7 +8778,7 @@ func (s *SyslogDataSource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) @@ -8202,7 +8825,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TagsResource. func (t TagsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "tags", t.Tags) return json.Marshal(objectMap) } @@ -8229,7 +8852,7 @@ func (t *TagsResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TestNotificationDetailsResponse. func (t TestNotificationDetailsResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "actionDetails", t.ActionDetails) populate(objectMap, "completedTime", t.CompletedTime) populate(objectMap, "context", t.Context) @@ -8272,7 +8895,7 @@ func (t *TestNotificationDetailsResponse) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ThresholdRuleCondition. func (t ThresholdRuleCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "dataSource", t.DataSource) objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition" populate(objectMap, "operator", t.Operator) @@ -8319,7 +8942,7 @@ func (t *ThresholdRuleCondition) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TimeSeriesBaseline. func (t TimeSeriesBaseline) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "aggregation", t.Aggregation) populate(objectMap, "data", t.Data) populate(objectMap, "dimensions", t.Dimensions) @@ -8370,7 +8993,7 @@ func (t *TimeSeriesBaseline) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TimeSeriesElement. func (t TimeSeriesElement) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "data", t.Data) populate(objectMap, "metadatavalues", t.Metadatavalues) return json.Marshal(objectMap) @@ -8401,7 +9024,7 @@ func (t *TimeSeriesElement) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TimeWindow. func (t TimeWindow) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "end", t.End) populateTimeRFC3339(objectMap, "start", t.Start) populate(objectMap, "timeZone", t.TimeZone) @@ -8436,7 +9059,7 @@ func (t *TimeWindow) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TrackedResource. func (t TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", t.ID) populate(objectMap, "location", t.Location) populate(objectMap, "name", t.Name) @@ -8477,9 +9100,87 @@ func (t *TrackedResource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type TrackedResourceAutoGenerated. +func (t TrackedResourceAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResourceAutoGenerated. +func (t *TrackedResourceAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &t.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UserIdentityProperties. +func (u UserIdentityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserIdentityProperties. +func (u *UserIdentityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type VMInsightsOnboardingStatus. func (v VMInsightsOnboardingStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", v.ID) populate(objectMap, "name", v.Name) populate(objectMap, "properties", v.Properties) @@ -8518,7 +9219,7 @@ func (v *VMInsightsOnboardingStatus) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VMInsightsOnboardingStatusProperties. func (v VMInsightsOnboardingStatusProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "data", v.Data) populate(objectMap, "dataStatus", v.DataStatus) populate(objectMap, "onboardingStatus", v.OnboardingStatus) @@ -8557,7 +9258,7 @@ func (v *VMInsightsOnboardingStatusProperties) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type VoiceReceiver. func (v VoiceReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "countryCode", v.CountryCode) populate(objectMap, "name", v.Name) populate(objectMap, "phoneNumber", v.PhoneNumber) @@ -8592,7 +9293,7 @@ func (v *VoiceReceiver) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type WebhookNotification. func (w WebhookNotification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", w.Properties) populate(objectMap, "serviceUri", w.ServiceURI) return json.Marshal(objectMap) @@ -8623,7 +9324,7 @@ func (w *WebhookNotification) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type WebhookReceiver. func (w WebhookReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "identifierUri", w.IdentifierURI) populate(objectMap, "name", w.Name) populate(objectMap, "objectId", w.ObjectID) @@ -8674,7 +9375,7 @@ func (w *WebhookReceiver) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type WebtestLocationAvailabilityCriteria. func (w WebtestLocationAvailabilityCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "componentId", w.ComponentID) populate(objectMap, "failedLocationCount", w.FailedLocationCount) objectMap["odata.type"] = OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria @@ -8710,10 +9411,10 @@ func (w *WebtestLocationAvailabilityCriteria) UnmarshalJSON(data []byte) error { delete(rawMsg, key) default: if w.AdditionalProperties == nil { - w.AdditionalProperties = map[string]interface{}{} + w.AdditionalProperties = map[string]any{} } if val != nil { - var aux interface{} + var aux any err = json.Unmarshal(val, &aux) w.AdditionalProperties[key] = aux } @@ -8728,7 +9429,7 @@ func (w *WebtestLocationAvailabilityCriteria) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type WindowsEventLogDataSource. func (w WindowsEventLogDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "name", w.Name) populate(objectMap, "streams", w.Streams) populate(objectMap, "xPathQueries", w.XPathQueries) @@ -8763,7 +9464,7 @@ func (w *WindowsEventLogDataSource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type WorkspaceInfo. func (w WorkspaceInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", w.ID) populate(objectMap, "location", w.Location) populate(objectMap, "properties", w.Properties) @@ -8798,7 +9499,7 @@ func (w *WorkspaceInfo) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type WorkspaceInfoProperties. func (w WorkspaceInfoProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "customerId", w.CustomerID) return json.Marshal(objectMap) } @@ -8823,7 +9524,7 @@ func (w *WorkspaceInfoProperties) UnmarshalJSON(data []byte) error { return nil } -func populate(m map[string]interface{}, k string, v interface{}) { +func populate(m map[string]any, k string, v any) { if v == nil { return } else if azcore.IsNullValue(v) { @@ -8833,7 +9534,7 @@ func populate(m map[string]interface{}, k string, v interface{}) { } } -func unpopulate(data json.RawMessage, fn string, v interface{}) error { +func unpopulate(data json.RawMessage, fn string, v any) error { if data == nil { return nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/operations_client.go b/sdk/resourcemanager/monitor/armmonitor/operations_client.go index ab08746b4885..406f706ae1fc 100644 --- a/sdk/resourcemanager/monitor/armmonitor/operations_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/operations_client.go @@ -28,8 +28,8 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -51,8 +51,9 @@ 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 -// options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) List(ctx context.Context, options *OperationsClientListOptions) (OperationsClientListResponse, error) { req, err := client.listCreateRequest(ctx, options) if err != 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 5873363109f4..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/operations_client_example_test.go +++ /dev/null @@ -1,36 +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. - -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/tree/main/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() - client, err := armmonitor.NewOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/monitor/armmonitor/polymorphic_helpers.go b/sdk/resourcemanager/monitor/armmonitor/polymorphic_helpers.go index 6cb4a5b17403..2219d0c42ed9 100644 --- a/sdk/resourcemanager/monitor/armmonitor/polymorphic_helpers.go +++ b/sdk/resourcemanager/monitor/armmonitor/polymorphic_helpers.go @@ -15,7 +15,7 @@ func unmarshalMetricAlertCriteriaClassification(rawMsg json.RawMessage) (MetricA if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -37,7 +37,7 @@ func unmarshalMultiMetricCriteriaClassification(rawMsg json.RawMessage) (MultiMe if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -76,7 +76,7 @@ func unmarshalRuleActionClassification(rawMsg json.RawMessage) (RuleActionClassi if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -115,7 +115,7 @@ func unmarshalRuleConditionClassification(rawMsg json.RawMessage) (RuleCondition if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -137,7 +137,7 @@ func unmarshalRuleDataSourceClassification(rawMsg json.RawMessage) (RuleDataSour if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } diff --git a/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client.go b/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client.go index de3f1985cb87..ea761b4a0818 100644 --- a/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client.go @@ -32,9 +32,9 @@ type PredictiveMetricClient struct { } // NewPredictiveMetricClient creates a new instance of PredictiveMetricClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewPredictiveMetricClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PredictiveMetricClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,16 +57,17 @@ func NewPredictiveMetricClient(subscriptionID string, credential azcore.TokenCre // Get - get predictive autoscale metric future data // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2022-10-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// autoscaleSettingName - The autoscale setting name. -// timespan - The timespan of the query. It is a string with the following format 'startDateTimeISO/endDateTimeISO'. -// interval - The interval (i.e. timegrain) of the query. -// metricNamespace - Metric namespace to query metric definitions for. -// metricName - The names of the metrics (comma separated) to retrieve. Special case: If a metricname itself has a comma in -// it then use %2 to indicate it. Eg: 'Metric,Name1' should be 'Metric%2Name1' -// aggregation - The list of aggregation types (comma separated) to retrieve. -// options - PredictiveMetricClientGetOptions contains the optional parameters for the PredictiveMetricClient.Get method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - autoscaleSettingName - The autoscale setting name. +// - timespan - The timespan of the query. It is a string with the following format 'startDateTimeISO/endDateTimeISO'. +// - interval - The interval (i.e. timegrain) of the query. +// - metricNamespace - Metric namespace to query metric definitions for. +// - metricName - The names of the metrics (comma separated) to retrieve. Special case: If a metricname itself has a comma in +// it then use %2 to indicate it. Eg: 'Metric,Name1' should be 'Metric%2Name1' +// - aggregation - The list of aggregation types (comma separated) to retrieve. +// - options - PredictiveMetricClientGetOptions contains the optional parameters for the PredictiveMetricClient.Get method. func (client *PredictiveMetricClient) Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string, timespan string, interval string, metricNamespace string, metricName string, aggregation string, options *PredictiveMetricClientGetOptions) (PredictiveMetricClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, autoscaleSettingName, timespan, interval, metricNamespace, metricName, aggregation, options) if err != nil { diff --git a/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client_example_test.go deleted file mode 100644 index a26e30c4e994..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client_example_test.go +++ /dev/null @@ -1,36 +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. - -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/tree/main/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() - client, err := armmonitor.NewPredictiveMetricClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client.go b/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client.go index 0b82be0f22cb..22ded544addf 100644 --- a/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client.go @@ -32,9 +32,9 @@ type PrivateEndpointConnectionsClient struct { } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,12 +57,13 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // BeginCreateOrUpdate - Approve or reject a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-07-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// privateEndpointConnectionName - The name of the private endpoint connection. -// options - PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. +// - privateEndpointConnectionName - The name of the private endpoint connection. +// - options - PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate +// method. func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[PrivateEndpointConnectionsClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, scopeName, privateEndpointConnectionName, parameters, options) @@ -77,6 +78,7 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. // CreateOrUpdate - Approve or reject a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-07-01-preview func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, scopeName, privateEndpointConnectionName, parameters, options) @@ -125,12 +127,13 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx // BeginDelete - Deletes a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-07-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// privateEndpointConnectionName - The name of the private endpoint connection. -// options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. +// - privateEndpointConnectionName - The name of the private endpoint connection. +// - options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, scopeName, privateEndpointConnectionName, options) @@ -145,6 +148,7 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Deletes a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-07-01-preview func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, scopeName, privateEndpointConnectionName, options) @@ -193,12 +197,13 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Gets a private endpoint connection. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-07-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// privateEndpointConnectionName - The name of the private endpoint connection. -// options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. +// - privateEndpointConnectionName - The name of the private endpoint connection. +// - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, scopeName, privateEndpointConnectionName, options) if err != nil { @@ -255,11 +260,12 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // ListByPrivateLinkScope - Gets all private endpoint connections on a private link scope. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-07-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// options - PrivateEndpointConnectionsClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateEndpointConnectionsClient.ListByPrivateLinkScope -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. +// - options - PrivateEndpointConnectionsClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateEndpointConnectionsClient.ListByPrivateLinkScope +// method. func (client *PrivateEndpointConnectionsClient) ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateEndpointConnectionsClientListByPrivateLinkScopeOptions) (PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse, error) { req, err := client.listByPrivateLinkScopeCreateRequest(ctx, resourceGroupName, scopeName, options) if err != 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 39eab23cc340..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client_example_test.go +++ /dev/null @@ -1,107 +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. - -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/tree/main/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() - client, err := armmonitor.NewPrivateEndpointConnectionsClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "MyResourceGroup", "MyPrivateLinkScope", "private-endpoint-connection-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewPrivateEndpointConnectionsClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewPrivateEndpointConnectionsClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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/tree/main/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() - client, err := armmonitor.NewPrivateEndpointConnectionsClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListByPrivateLinkScope(ctx, "MyResourceGroup", "MyPrivateLinkScope", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client.go index f8e4890e48a8..a7c19ea1e33b 100644 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client.go @@ -32,9 +32,9 @@ type PrivateLinkResourcesClient struct { } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,12 +57,13 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // Get - Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-07-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// groupName - The name of the private link resource. -// options - PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. +// - groupName - The name of the private link resource. +// - options - PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get +// method. func (client *PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, scopeName string, groupName string, options *PrivateLinkResourcesClientGetOptions) (PrivateLinkResourcesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, scopeName, groupName, options) if err != nil { @@ -119,11 +120,12 @@ func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) // ListByPrivateLinkScope - Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-07-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// options - PrivateLinkResourcesClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByPrivateLinkScope -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. +// - options - PrivateLinkResourcesClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByPrivateLinkScope +// method. func (client *PrivateLinkResourcesClient) ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateLinkResourcesClientListByPrivateLinkScopeOptions) (PrivateLinkResourcesClientListByPrivateLinkScopeResponse, error) { req, err := client.listByPrivateLinkScopeCreateRequest(ctx, resourceGroupName, scopeName, options) if err != nil { diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client_example_test.go deleted file mode 100644 index ceb31611fa74..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client_example_test.go +++ /dev/null @@ -1,55 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -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/tree/main/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() - client, err := armmonitor.NewPrivateLinkResourcesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListByPrivateLinkScope(ctx, "MyResourceGroup", "MyPrivateLinkScope", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewPrivateLinkResourcesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "MyResourceGroup", "MyPrivateLinkScope", "azuremonitor", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client.go index 05f5a5b7b0a4..fde2ec1664de 100644 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client.go @@ -32,9 +32,9 @@ type PrivateLinkScopedResourcesClient struct { } // NewPrivateLinkScopedResourcesClient creates a new instance of PrivateLinkScopedResourcesClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewPrivateLinkScopedResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkScopedResourcesClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,12 +57,13 @@ func NewPrivateLinkScopedResourcesClient(subscriptionID string, credential azcor // BeginCreateOrUpdate - Approve or reject a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-07-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// name - The name of the scoped resource object. -// options - PrivateLinkScopedResourcesClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateLinkScopedResourcesClient.BeginCreateOrUpdate -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. +// - name - The name of the scoped resource object. +// - options - PrivateLinkScopedResourcesClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateLinkScopedResourcesClient.BeginCreateOrUpdate +// method. func (client *PrivateLinkScopedResourcesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, name string, parameters ScopedResource, options *PrivateLinkScopedResourcesClientBeginCreateOrUpdateOptions) (*runtime.Poller[PrivateLinkScopedResourcesClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, scopeName, name, parameters, options) @@ -77,6 +78,7 @@ func (client *PrivateLinkScopedResourcesClient) BeginCreateOrUpdate(ctx context. // CreateOrUpdate - Approve or reject a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-07-01-preview func (client *PrivateLinkScopedResourcesClient) createOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, name string, parameters ScopedResource, options *PrivateLinkScopedResourcesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, scopeName, name, parameters, options) @@ -125,12 +127,13 @@ func (client *PrivateLinkScopedResourcesClient) createOrUpdateCreateRequest(ctx // BeginDelete - Deletes a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-07-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// name - The name of the scoped resource object. -// options - PrivateLinkScopedResourcesClientBeginDeleteOptions contains the optional parameters for the PrivateLinkScopedResourcesClient.BeginDelete -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. +// - name - The name of the scoped resource object. +// - options - PrivateLinkScopedResourcesClientBeginDeleteOptions contains the optional parameters for the PrivateLinkScopedResourcesClient.BeginDelete +// method. func (client *PrivateLinkScopedResourcesClient) BeginDelete(ctx context.Context, resourceGroupName string, scopeName string, name string, options *PrivateLinkScopedResourcesClientBeginDeleteOptions) (*runtime.Poller[PrivateLinkScopedResourcesClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, scopeName, name, options) @@ -145,6 +148,7 @@ func (client *PrivateLinkScopedResourcesClient) BeginDelete(ctx context.Context, // Delete - Deletes a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-07-01-preview func (client *PrivateLinkScopedResourcesClient) deleteOperation(ctx context.Context, resourceGroupName string, scopeName string, name string, options *PrivateLinkScopedResourcesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, scopeName, name, options) @@ -193,12 +197,13 @@ func (client *PrivateLinkScopedResourcesClient) deleteCreateRequest(ctx context. // Get - Gets a scoped resource in a private link scope. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-07-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// name - The name of the scoped resource object. -// options - PrivateLinkScopedResourcesClientGetOptions contains the optional parameters for the PrivateLinkScopedResourcesClient.Get -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. +// - name - The name of the scoped resource object. +// - options - PrivateLinkScopedResourcesClientGetOptions contains the optional parameters for the PrivateLinkScopedResourcesClient.Get +// method. func (client *PrivateLinkScopedResourcesClient) Get(ctx context.Context, resourceGroupName string, scopeName string, name string, options *PrivateLinkScopedResourcesClientGetOptions) (PrivateLinkScopedResourcesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, scopeName, name, options) if err != nil { @@ -254,11 +259,12 @@ func (client *PrivateLinkScopedResourcesClient) getHandleResponse(resp *http.Res } // NewListByPrivateLinkScopePager - Gets all private endpoint connections on a private link scope. +// // Generated from API version 2021-07-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// options - PrivateLinkScopedResourcesClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateLinkScopedResourcesClient.ListByPrivateLinkScope -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. +// - options - PrivateLinkScopedResourcesClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateLinkScopedResourcesClient.NewListByPrivateLinkScopePager +// method. func (client *PrivateLinkScopedResourcesClient) NewListByPrivateLinkScopePager(resourceGroupName string, scopeName string, options *PrivateLinkScopedResourcesClientListByPrivateLinkScopeOptions) *runtime.Pager[PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse] { return runtime.NewPager(runtime.PagingHandler[PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse]{ More: func(page PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse) bool { 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 3b79b9399403..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client_example_test.go +++ /dev/null @@ -1,109 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -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/tree/main/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() - client, err := armmonitor.NewPrivateLinkScopedResourcesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "MyResourceGroup", "MyPrivateLinkScope", "scoped-resource-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewPrivateLinkScopedResourcesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewPrivateLinkScopedResourcesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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/tree/main/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() - client, err := armmonitor.NewPrivateLinkScopedResourcesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByPrivateLinkScopePager("MyResourceGroup", "MyPrivateLinkScope", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client.go index 5a8b14fb38c5..8faa55c301ca 100644 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client.go @@ -32,9 +32,9 @@ type PrivateLinkScopeOperationStatusClient struct { } // NewPrivateLinkScopeOperationStatusClient creates a new instance of PrivateLinkScopeOperationStatusClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewPrivateLinkScopeOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkScopeOperationStatusClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,11 +57,12 @@ func NewPrivateLinkScopeOperationStatusClient(subscriptionID string, credential // Get - Get the status of an azure asynchronous operation associated with a private link scope operation. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-07-01-preview -// asyncOperationID - The operation Id. -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - PrivateLinkScopeOperationStatusClientGetOptions contains the optional parameters for the PrivateLinkScopeOperationStatusClient.Get -// method. +// - asyncOperationID - The operation Id. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - PrivateLinkScopeOperationStatusClientGetOptions contains the optional parameters for the PrivateLinkScopeOperationStatusClient.Get +// method. func (client *PrivateLinkScopeOperationStatusClient) Get(ctx context.Context, asyncOperationID string, resourceGroupName string, options *PrivateLinkScopeOperationStatusClientGetOptions) (PrivateLinkScopeOperationStatusClientGetResponse, error) { req, err := client.getCreateRequest(ctx, asyncOperationID, resourceGroupName, options) if err != nil { diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client_example_test.go deleted file mode 100644 index 5a1e363d2e66..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client_example_test.go +++ /dev/null @@ -1,36 +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. - -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/tree/main/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() - client, err := armmonitor.NewPrivateLinkScopeOperationStatusClient("613192d7-503f-477a-9cfe-4efc3ee2bd60", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "713192d7-503f-477a-9cfe-4efc3ee2bd11", "MyResourceGroup", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client.go index b970e4c7e3b9..0ca51c6d3e04 100644 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client.go @@ -32,9 +32,9 @@ type PrivateLinkScopesClient struct { } // NewPrivateLinkScopesClient creates a new instance of PrivateLinkScopesClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewPrivateLinkScopesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkScopesClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -58,12 +58,13 @@ func NewPrivateLinkScopesClient(subscriptionID string, credential azcore.TokenCr // CreateOrUpdate - Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot specify a different value for // InstrumentationKey nor AppId in the Put operation. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-07-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// azureMonitorPrivateLinkScopePayload - Properties that need to be specified to create or update a Azure Monitor PrivateLinkScope. -// options - PrivateLinkScopesClientCreateOrUpdateOptions contains the optional parameters for the PrivateLinkScopesClient.CreateOrUpdate -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. +// - azureMonitorPrivateLinkScopePayload - Properties that need to be specified to create or update a Azure Monitor PrivateLinkScope. +// - options - PrivateLinkScopesClientCreateOrUpdateOptions contains the optional parameters for the PrivateLinkScopesClient.CreateOrUpdate +// method. func (client *PrivateLinkScopesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, azureMonitorPrivateLinkScopePayload AzureMonitorPrivateLinkScope, options *PrivateLinkScopesClientCreateOrUpdateOptions) (PrivateLinkScopesClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, scopeName, azureMonitorPrivateLinkScopePayload, options) if err != nil { @@ -116,11 +117,12 @@ func (client *PrivateLinkScopesClient) createOrUpdateHandleResponse(resp *http.R // BeginDelete - Deletes a Azure Monitor PrivateLinkScope. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-07-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// options - PrivateLinkScopesClientBeginDeleteOptions contains the optional parameters for the PrivateLinkScopesClient.BeginDelete -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. +// - options - PrivateLinkScopesClientBeginDeleteOptions contains the optional parameters for the PrivateLinkScopesClient.BeginDelete +// method. func (client *PrivateLinkScopesClient) BeginDelete(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateLinkScopesClientBeginDeleteOptions) (*runtime.Poller[PrivateLinkScopesClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, scopeName, options) @@ -135,6 +137,7 @@ func (client *PrivateLinkScopesClient) BeginDelete(ctx context.Context, resource // Delete - Deletes a Azure Monitor PrivateLinkScope. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-07-01-preview func (client *PrivateLinkScopesClient) deleteOperation(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateLinkScopesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, scopeName, options) @@ -179,10 +182,11 @@ func (client *PrivateLinkScopesClient) deleteCreateRequest(ctx context.Context, // Get - Returns a Azure Monitor PrivateLinkScope. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-07-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// options - PrivateLinkScopesClientGetOptions contains the optional parameters for the PrivateLinkScopesClient.Get method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. +// - options - PrivateLinkScopesClientGetOptions contains the optional parameters for the PrivateLinkScopesClient.Get method. func (client *PrivateLinkScopesClient) Get(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateLinkScopesClientGetOptions) (PrivateLinkScopesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, scopeName, options) if err != nil { @@ -234,8 +238,10 @@ func (client *PrivateLinkScopesClient) getHandleResponse(resp *http.Response) (P } // NewListPager - Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. +// // Generated from API version 2021-07-01-preview -// options - PrivateLinkScopesClientListOptions contains the optional parameters for the PrivateLinkScopesClient.List method. +// - options - PrivateLinkScopesClientListOptions contains the optional parameters for the PrivateLinkScopesClient.NewListPager +// method. func (client *PrivateLinkScopesClient) NewListPager(options *PrivateLinkScopesClientListOptions) *runtime.Pager[PrivateLinkScopesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[PrivateLinkScopesClientListResponse]{ More: func(page PrivateLinkScopesClientListResponse) bool { @@ -292,10 +298,11 @@ func (client *PrivateLinkScopesClient) listHandleResponse(resp *http.Response) ( } // NewListByResourceGroupPager - Gets a list of Azure Monitor PrivateLinkScopes within a resource group. +// // Generated from API version 2021-07-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - PrivateLinkScopesClientListByResourceGroupOptions contains the optional parameters for the PrivateLinkScopesClient.ListByResourceGroup -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - PrivateLinkScopesClientListByResourceGroupOptions contains the optional parameters for the PrivateLinkScopesClient.NewListByResourceGroupPager +// method. func (client *PrivateLinkScopesClient) NewListByResourceGroupPager(resourceGroupName string, options *PrivateLinkScopesClientListByResourceGroupOptions) *runtime.Pager[PrivateLinkScopesClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[PrivateLinkScopesClientListByResourceGroupResponse]{ More: func(page PrivateLinkScopesClientListByResourceGroupResponse) bool { @@ -357,12 +364,13 @@ func (client *PrivateLinkScopesClient) listByResourceGroupHandleResponse(resp *h // UpdateTags - Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate method. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2021-07-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// privateLinkScopeTags - Updated tag information to set into the PrivateLinkScope instance. -// options - PrivateLinkScopesClientUpdateTagsOptions contains the optional parameters for the PrivateLinkScopesClient.UpdateTags -// method. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. +// - privateLinkScopeTags - Updated tag information to set into the PrivateLinkScope instance. +// - options - PrivateLinkScopesClientUpdateTagsOptions contains the optional parameters for the PrivateLinkScopesClient.UpdateTags +// method. func (client *PrivateLinkScopesClient) UpdateTags(ctx context.Context, resourceGroupName string, scopeName string, privateLinkScopeTags TagsResource, options *PrivateLinkScopesClientUpdateTagsOptions) (PrivateLinkScopesClientUpdateTagsResponse, error) { req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, scopeName, privateLinkScopeTags, options) if err != nil { diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client_example_test.go deleted file mode 100644 index 4c964d618787..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client_example_test.go +++ /dev/null @@ -1,189 +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. - -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/tree/main/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() - client, err := armmonitor.NewPrivateLinkScopesClient("86dc51d3-92ed-4d7e-947a-775ea79b4919", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewPrivateLinkScopesClient("86dc51d3-92ed-4d7e-947a-775ea79b4919", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("my-resource-group", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewPrivateLinkScopesClient("86dc51d3-92ed-4d7e-947a-775ea79b4919", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.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/tree/main/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() - client, err := armmonitor.NewPrivateLinkScopesClient("86dc51d3-92ed-4d7e-947a-775ea79b4919", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "my-resource-group", "my-privatelinkscope", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewPrivateLinkScopesClient("86dc51d3-92ed-4d7e-947a-775ea79b4919", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewPrivateLinkScopesClient("86dc51d3-92ed-4d7e-947a-775ea79b4919", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewPrivateLinkScopesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/monitor/armmonitor/response_types.go b/sdk/resourcemanager/monitor/armmonitor/response_types.go index e253dc740da9..cb832fa81b16 100644 --- a/sdk/resourcemanager/monitor/armmonitor/response_types.go +++ b/sdk/resourcemanager/monitor/armmonitor/response_types.go @@ -9,12 +9,12 @@ package armmonitor -// ActionGroupsClientCreateNotificationsAtActionGroupResourceLevelResponse contains the response from method ActionGroupsClient.CreateNotificationsAtActionGroupResourceLevel. +// ActionGroupsClientCreateNotificationsAtActionGroupResourceLevelResponse contains the response from method ActionGroupsClient.BeginCreateNotificationsAtActionGroupResourceLevel. type ActionGroupsClientCreateNotificationsAtActionGroupResourceLevelResponse struct { TestNotificationDetailsResponse } -// ActionGroupsClientCreateNotificationsAtResourceGroupLevelResponse contains the response from method ActionGroupsClient.CreateNotificationsAtResourceGroupLevel. +// ActionGroupsClientCreateNotificationsAtResourceGroupLevelResponse contains the response from method ActionGroupsClient.BeginCreateNotificationsAtResourceGroupLevel. type ActionGroupsClientCreateNotificationsAtResourceGroupLevelResponse struct { TestNotificationDetailsResponse } @@ -54,17 +54,17 @@ type ActionGroupsClientGetTestNotificationsResponse struct { TestNotificationDetailsResponse } -// ActionGroupsClientListByResourceGroupResponse contains the response from method ActionGroupsClient.ListByResourceGroup. +// ActionGroupsClientListByResourceGroupResponse contains the response from method ActionGroupsClient.NewListByResourceGroupPager. type ActionGroupsClientListByResourceGroupResponse struct { ActionGroupList } -// ActionGroupsClientListBySubscriptionIDResponse contains the response from method ActionGroupsClient.ListBySubscriptionID. +// ActionGroupsClientListBySubscriptionIDResponse contains the response from method ActionGroupsClient.NewListBySubscriptionIDPager. type ActionGroupsClientListBySubscriptionIDResponse struct { ActionGroupList } -// ActionGroupsClientPostTestNotificationsResponse contains the response from method ActionGroupsClient.PostTestNotifications. +// ActionGroupsClientPostTestNotificationsResponse contains the response from method ActionGroupsClient.BeginPostTestNotifications. type ActionGroupsClientPostTestNotificationsResponse struct { TestNotificationDetailsResponse } @@ -89,12 +89,12 @@ type ActivityLogAlertsClientGetResponse struct { ActivityLogAlertResource } -// ActivityLogAlertsClientListByResourceGroupResponse contains the response from method ActivityLogAlertsClient.ListByResourceGroup. +// ActivityLogAlertsClientListByResourceGroupResponse contains the response from method ActivityLogAlertsClient.NewListByResourceGroupPager. type ActivityLogAlertsClientListByResourceGroupResponse struct { AlertRuleList } -// ActivityLogAlertsClientListBySubscriptionIDResponse contains the response from method ActivityLogAlertsClient.ListBySubscriptionID. +// ActivityLogAlertsClientListBySubscriptionIDResponse contains the response from method ActivityLogAlertsClient.NewListBySubscriptionIDPager. type ActivityLogAlertsClientListBySubscriptionIDResponse struct { AlertRuleList } @@ -104,7 +104,7 @@ type ActivityLogAlertsClientUpdateResponse struct { ActivityLogAlertResource } -// ActivityLogsClientListResponse contains the response from method ActivityLogsClient.List. +// ActivityLogsClientListResponse contains the response from method ActivityLogsClient.NewListPager. type ActivityLogsClientListResponse struct { EventDataCollection } @@ -114,7 +114,7 @@ type AlertRuleIncidentsClientGetResponse struct { Incident } -// AlertRuleIncidentsClientListByAlertRuleResponse contains the response from method AlertRuleIncidentsClient.ListByAlertRule. +// AlertRuleIncidentsClientListByAlertRuleResponse contains the response from method AlertRuleIncidentsClient.NewListByAlertRulePager. type AlertRuleIncidentsClientListByAlertRuleResponse struct { IncidentListResult } @@ -134,12 +134,12 @@ type AlertRulesClientGetResponse struct { AlertRuleResource } -// AlertRulesClientListByResourceGroupResponse contains the response from method AlertRulesClient.ListByResourceGroup. +// AlertRulesClientListByResourceGroupResponse contains the response from method AlertRulesClient.NewListByResourceGroupPager. type AlertRulesClientListByResourceGroupResponse struct { AlertRuleResourceCollection } -// AlertRulesClientListBySubscriptionResponse contains the response from method AlertRulesClient.ListBySubscription. +// AlertRulesClientListBySubscriptionResponse contains the response from method AlertRulesClient.NewListBySubscriptionPager. type AlertRulesClientListBySubscriptionResponse struct { AlertRuleResourceCollection } @@ -164,12 +164,12 @@ type AutoscaleSettingsClientGetResponse struct { AutoscaleSettingResource } -// AutoscaleSettingsClientListByResourceGroupResponse contains the response from method AutoscaleSettingsClient.ListByResourceGroup. +// AutoscaleSettingsClientListByResourceGroupResponse contains the response from method AutoscaleSettingsClient.NewListByResourceGroupPager. type AutoscaleSettingsClientListByResourceGroupResponse struct { AutoscaleSettingResourceCollection } -// AutoscaleSettingsClientListBySubscriptionResponse contains the response from method AutoscaleSettingsClient.ListBySubscription. +// AutoscaleSettingsClientListBySubscriptionResponse contains the response from method AutoscaleSettingsClient.NewListBySubscriptionPager. type AutoscaleSettingsClientListBySubscriptionResponse struct { AutoscaleSettingResourceCollection } @@ -179,11 +179,46 @@ type AutoscaleSettingsClientUpdateResponse struct { AutoscaleSettingResource } -// BaselinesClientListResponse contains the response from method BaselinesClient.List. +// AzureMonitorWorkspacesClientCreateResponse contains the response from method AzureMonitorWorkspacesClient.Create. +type AzureMonitorWorkspacesClientCreateResponse struct { + AzureMonitorWorkspaceResource +} + +// AzureMonitorWorkspacesClientDeleteResponse contains the response from method AzureMonitorWorkspacesClient.Delete. +type AzureMonitorWorkspacesClientDeleteResponse struct { + // placeholder for future response values +} + +// AzureMonitorWorkspacesClientGetResponse contains the response from method AzureMonitorWorkspacesClient.Get. +type AzureMonitorWorkspacesClientGetResponse struct { + AzureMonitorWorkspaceResource +} + +// AzureMonitorWorkspacesClientListByResourceGroupResponse contains the response from method AzureMonitorWorkspacesClient.NewListByResourceGroupPager. +type AzureMonitorWorkspacesClientListByResourceGroupResponse struct { + AzureMonitorWorkspaceResourceListResult +} + +// AzureMonitorWorkspacesClientListBySubscriptionResponse contains the response from method AzureMonitorWorkspacesClient.NewListBySubscriptionPager. +type AzureMonitorWorkspacesClientListBySubscriptionResponse struct { + AzureMonitorWorkspaceResourceListResult +} + +// AzureMonitorWorkspacesClientUpdateResponse contains the response from method AzureMonitorWorkspacesClient.Update. +type AzureMonitorWorkspacesClientUpdateResponse struct { + AzureMonitorWorkspaceResource +} + +// BaselinesClientListResponse contains the response from method BaselinesClient.NewListPager. type BaselinesClientListResponse struct { MetricBaselinesResponse } +// ClientOperationsListResponse contains the response from method Client.NewOperationsListPager. +type ClientOperationsListResponse struct { + OperationListResultAutoGenerated +} + // DataCollectionEndpointsClientCreateResponse contains the response from method DataCollectionEndpointsClient.Create. type DataCollectionEndpointsClientCreateResponse struct { DataCollectionEndpointResource @@ -199,12 +234,12 @@ type DataCollectionEndpointsClientGetResponse struct { DataCollectionEndpointResource } -// DataCollectionEndpointsClientListByResourceGroupResponse contains the response from method DataCollectionEndpointsClient.ListByResourceGroup. +// DataCollectionEndpointsClientListByResourceGroupResponse contains the response from method DataCollectionEndpointsClient.NewListByResourceGroupPager. type DataCollectionEndpointsClientListByResourceGroupResponse struct { DataCollectionEndpointResourceListResult } -// DataCollectionEndpointsClientListBySubscriptionResponse contains the response from method DataCollectionEndpointsClient.ListBySubscription. +// DataCollectionEndpointsClientListBySubscriptionResponse contains the response from method DataCollectionEndpointsClient.NewListBySubscriptionPager. type DataCollectionEndpointsClientListBySubscriptionResponse struct { DataCollectionEndpointResourceListResult } @@ -229,17 +264,17 @@ type DataCollectionRuleAssociationsClientGetResponse struct { DataCollectionRuleAssociationProxyOnlyResource } -// DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse contains the response from method DataCollectionRuleAssociationsClient.ListByDataCollectionEndpoint. +// DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse contains the response from method DataCollectionRuleAssociationsClient.NewListByDataCollectionEndpointPager. type DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse struct { DataCollectionRuleAssociationProxyOnlyResourceListResult } -// DataCollectionRuleAssociationsClientListByResourceResponse contains the response from method DataCollectionRuleAssociationsClient.ListByResource. +// DataCollectionRuleAssociationsClientListByResourceResponse contains the response from method DataCollectionRuleAssociationsClient.NewListByResourcePager. type DataCollectionRuleAssociationsClientListByResourceResponse struct { DataCollectionRuleAssociationProxyOnlyResourceListResult } -// DataCollectionRuleAssociationsClientListByRuleResponse contains the response from method DataCollectionRuleAssociationsClient.ListByRule. +// DataCollectionRuleAssociationsClientListByRuleResponse contains the response from method DataCollectionRuleAssociationsClient.NewListByRulePager. type DataCollectionRuleAssociationsClientListByRuleResponse struct { DataCollectionRuleAssociationProxyOnlyResourceListResult } @@ -259,12 +294,12 @@ type DataCollectionRulesClientGetResponse struct { DataCollectionRuleResource } -// DataCollectionRulesClientListByResourceGroupResponse contains the response from method DataCollectionRulesClient.ListByResourceGroup. +// DataCollectionRulesClientListByResourceGroupResponse contains the response from method DataCollectionRulesClient.NewListByResourceGroupPager. type DataCollectionRulesClientListByResourceGroupResponse struct { DataCollectionRuleResourceListResult } -// DataCollectionRulesClientListBySubscriptionResponse contains the response from method DataCollectionRulesClient.ListBySubscription. +// DataCollectionRulesClientListBySubscriptionResponse contains the response from method DataCollectionRulesClient.NewListBySubscriptionPager. type DataCollectionRulesClientListBySubscriptionResponse struct { DataCollectionRuleResourceListResult } @@ -279,7 +314,7 @@ type DiagnosticSettingsCategoryClientGetResponse struct { DiagnosticSettingsCategoryResource } -// DiagnosticSettingsCategoryClientListResponse contains the response from method DiagnosticSettingsCategoryClient.List. +// DiagnosticSettingsCategoryClientListResponse contains the response from method DiagnosticSettingsCategoryClient.NewListPager. type DiagnosticSettingsCategoryClientListResponse struct { DiagnosticSettingsCategoryResourceCollection } @@ -299,12 +334,12 @@ type DiagnosticSettingsClientGetResponse struct { DiagnosticSettingsResource } -// DiagnosticSettingsClientListResponse contains the response from method DiagnosticSettingsClient.List. +// DiagnosticSettingsClientListResponse contains the response from method DiagnosticSettingsClient.NewListPager. type DiagnosticSettingsClientListResponse struct { DiagnosticSettingsResourceCollection } -// EventCategoriesClientListResponse contains the response from method EventCategoriesClient.List. +// EventCategoriesClientListResponse contains the response from method EventCategoriesClient.NewListPager. type EventCategoriesClientListResponse struct { EventCategoryCollection } @@ -324,7 +359,7 @@ type LogProfilesClientGetResponse struct { LogProfileResource } -// LogProfilesClientListResponse contains the response from method LogProfilesClient.List. +// LogProfilesClientListResponse contains the response from method LogProfilesClient.NewListPager. type LogProfilesClientListResponse struct { LogProfileCollection } @@ -349,12 +384,12 @@ type MetricAlertsClientGetResponse struct { MetricAlertResource } -// MetricAlertsClientListByResourceGroupResponse contains the response from method MetricAlertsClient.ListByResourceGroup. +// MetricAlertsClientListByResourceGroupResponse contains the response from method MetricAlertsClient.NewListByResourceGroupPager. type MetricAlertsClientListByResourceGroupResponse struct { MetricAlertResourceCollection } -// MetricAlertsClientListBySubscriptionResponse contains the response from method MetricAlertsClient.ListBySubscription. +// MetricAlertsClientListBySubscriptionResponse contains the response from method MetricAlertsClient.NewListBySubscriptionPager. type MetricAlertsClientListBySubscriptionResponse struct { MetricAlertResourceCollection } @@ -374,12 +409,12 @@ type MetricAlertsStatusClientListResponse struct { MetricAlertStatusCollection } -// MetricDefinitionsClientListResponse contains the response from method MetricDefinitionsClient.List. +// MetricDefinitionsClientListResponse contains the response from method MetricDefinitionsClient.NewListPager. type MetricDefinitionsClientListResponse struct { MetricDefinitionCollection } -// MetricNamespacesClientListResponse contains the response from method MetricNamespacesClient.List. +// MetricNamespacesClientListResponse contains the response from method MetricNamespacesClient.NewListPager. type MetricNamespacesClientListResponse struct { MetricNamespaceCollection } @@ -399,12 +434,12 @@ type PredictiveMetricClientGetResponse struct { PredictiveResponse } -// PrivateEndpointConnectionsClientCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsClient.CreateOrUpdate. +// PrivateEndpointConnectionsClientCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsClient.BeginCreateOrUpdate. type PrivateEndpointConnectionsClientCreateOrUpdateResponse struct { PrivateEndpointConnection } -// PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.Delete. +// PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.BeginDelete. type PrivateEndpointConnectionsClientDeleteResponse struct { // placeholder for future response values } @@ -434,12 +469,12 @@ type PrivateLinkScopeOperationStatusClientGetResponse struct { OperationStatus } -// PrivateLinkScopedResourcesClientCreateOrUpdateResponse contains the response from method PrivateLinkScopedResourcesClient.CreateOrUpdate. +// PrivateLinkScopedResourcesClientCreateOrUpdateResponse contains the response from method PrivateLinkScopedResourcesClient.BeginCreateOrUpdate. type PrivateLinkScopedResourcesClientCreateOrUpdateResponse struct { ScopedResource } -// PrivateLinkScopedResourcesClientDeleteResponse contains the response from method PrivateLinkScopedResourcesClient.Delete. +// PrivateLinkScopedResourcesClientDeleteResponse contains the response from method PrivateLinkScopedResourcesClient.BeginDelete. type PrivateLinkScopedResourcesClientDeleteResponse struct { // placeholder for future response values } @@ -449,7 +484,7 @@ type PrivateLinkScopedResourcesClientGetResponse struct { ScopedResource } -// PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse contains the response from method PrivateLinkScopedResourcesClient.ListByPrivateLinkScope. +// PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse contains the response from method PrivateLinkScopedResourcesClient.NewListByPrivateLinkScopePager. type PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse struct { ScopedResourceListResult } @@ -459,7 +494,7 @@ type PrivateLinkScopesClientCreateOrUpdateResponse struct { AzureMonitorPrivateLinkScope } -// PrivateLinkScopesClientDeleteResponse contains the response from method PrivateLinkScopesClient.Delete. +// PrivateLinkScopesClientDeleteResponse contains the response from method PrivateLinkScopesClient.BeginDelete. type PrivateLinkScopesClientDeleteResponse struct { // placeholder for future response values } @@ -469,12 +504,12 @@ type PrivateLinkScopesClientGetResponse struct { AzureMonitorPrivateLinkScope } -// PrivateLinkScopesClientListByResourceGroupResponse contains the response from method PrivateLinkScopesClient.ListByResourceGroup. +// PrivateLinkScopesClientListByResourceGroupResponse contains the response from method PrivateLinkScopesClient.NewListByResourceGroupPager. type PrivateLinkScopesClientListByResourceGroupResponse struct { AzureMonitorPrivateLinkScopeListResult } -// PrivateLinkScopesClientListResponse contains the response from method PrivateLinkScopesClient.List. +// PrivateLinkScopesClientListResponse contains the response from method PrivateLinkScopesClient.NewListPager. type PrivateLinkScopesClientListResponse struct { AzureMonitorPrivateLinkScopeListResult } @@ -499,12 +534,12 @@ type ScheduledQueryRulesClientGetResponse struct { ScheduledQueryRuleResource } -// ScheduledQueryRulesClientListByResourceGroupResponse contains the response from method ScheduledQueryRulesClient.ListByResourceGroup. +// ScheduledQueryRulesClientListByResourceGroupResponse contains the response from method ScheduledQueryRulesClient.NewListByResourceGroupPager. type ScheduledQueryRulesClientListByResourceGroupResponse struct { ScheduledQueryRuleResourceCollection } -// ScheduledQueryRulesClientListBySubscriptionResponse contains the response from method ScheduledQueryRulesClient.ListBySubscription. +// ScheduledQueryRulesClientListBySubscriptionResponse contains the response from method ScheduledQueryRulesClient.NewListBySubscriptionPager. type ScheduledQueryRulesClientListBySubscriptionResponse struct { ScheduledQueryRuleResourceCollection } @@ -514,7 +549,7 @@ type ScheduledQueryRulesClientUpdateResponse struct { ScheduledQueryRuleResource } -// TenantActivityLogsClientListResponse contains the response from method TenantActivityLogsClient.List. +// TenantActivityLogsClientListResponse contains the response from method TenantActivityLogsClient.NewListPager. type TenantActivityLogsClientListResponse struct { EventDataCollection } diff --git a/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client.go b/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client.go index 5cd872e81383..5a803b129f4b 100644 --- a/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client.go @@ -32,9 +32,9 @@ type ScheduledQueryRulesClient struct { } // NewScheduledQueryRulesClient creates a new instance of ScheduledQueryRulesClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewScheduledQueryRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ScheduledQueryRulesClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,12 +57,13 @@ func NewScheduledQueryRulesClient(subscriptionID string, credential azcore.Token // CreateOrUpdate - Creates or updates a scheduled query rule. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-06-15 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// ruleName - The name of the rule. -// parameters - The parameters of the rule to create or update. -// options - ScheduledQueryRulesClientCreateOrUpdateOptions contains the optional parameters for the ScheduledQueryRulesClient.CreateOrUpdate -// method. +// +// Generated from API version 2022-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - ruleName - The name of the rule. +// - parameters - The parameters of the rule to create or update. +// - options - ScheduledQueryRulesClientCreateOrUpdateOptions contains the optional parameters for the ScheduledQueryRulesClient.CreateOrUpdate +// method. func (client *ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters ScheduledQueryRuleResource, options *ScheduledQueryRulesClientCreateOrUpdateOptions) (ScheduledQueryRulesClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, ruleName, parameters, options) if err != nil { @@ -98,7 +99,7 @@ func (client *ScheduledQueryRulesClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-15") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -115,11 +116,12 @@ func (client *ScheduledQueryRulesClient) createOrUpdateHandleResponse(resp *http // Delete - Deletes a scheduled query rule. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-06-15 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// ruleName - The name of the rule. -// options - ScheduledQueryRulesClientDeleteOptions contains the optional parameters for the ScheduledQueryRulesClient.Delete -// method. +// +// Generated from API version 2022-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - ruleName - The name of the rule. +// - options - ScheduledQueryRulesClientDeleteOptions contains the optional parameters for the ScheduledQueryRulesClient.Delete +// method. func (client *ScheduledQueryRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName string, options *ScheduledQueryRulesClientDeleteOptions) (ScheduledQueryRulesClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, ruleName, options) if err != nil { @@ -155,7 +157,7 @@ func (client *ScheduledQueryRulesClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-15") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -163,10 +165,11 @@ func (client *ScheduledQueryRulesClient) deleteCreateRequest(ctx context.Context // Get - Retrieve an scheduled query rule definition. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-06-15 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// ruleName - The name of the rule. -// options - ScheduledQueryRulesClientGetOptions contains the optional parameters for the ScheduledQueryRulesClient.Get method. +// +// Generated from API version 2022-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - ruleName - The name of the rule. +// - options - ScheduledQueryRulesClientGetOptions contains the optional parameters for the ScheduledQueryRulesClient.Get method. func (client *ScheduledQueryRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string, options *ScheduledQueryRulesClientGetOptions) (ScheduledQueryRulesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, ruleName, options) if err != nil { @@ -202,7 +205,7 @@ func (client *ScheduledQueryRulesClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-15") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -218,10 +221,11 @@ func (client *ScheduledQueryRulesClient) getHandleResponse(resp *http.Response) } // NewListByResourceGroupPager - Retrieve scheduled query rule definitions in a resource group. -// Generated from API version 2022-06-15 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - ScheduledQueryRulesClientListByResourceGroupOptions contains the optional parameters for the ScheduledQueryRulesClient.ListByResourceGroup -// method. +// +// Generated from API version 2022-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ScheduledQueryRulesClientListByResourceGroupOptions contains the optional parameters for the ScheduledQueryRulesClient.NewListByResourceGroupPager +// method. func (client *ScheduledQueryRulesClient) NewListByResourceGroupPager(resourceGroupName string, options *ScheduledQueryRulesClientListByResourceGroupOptions) *runtime.Pager[ScheduledQueryRulesClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[ScheduledQueryRulesClientListByResourceGroupResponse]{ More: func(page ScheduledQueryRulesClientListByResourceGroupResponse) bool { @@ -266,7 +270,7 @@ func (client *ScheduledQueryRulesClient) listByResourceGroupCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-15") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -282,9 +286,10 @@ func (client *ScheduledQueryRulesClient) listByResourceGroupHandleResponse(resp } // NewListBySubscriptionPager - Retrieve a scheduled query rule definitions in a subscription. -// Generated from API version 2022-06-15 -// options - ScheduledQueryRulesClientListBySubscriptionOptions contains the optional parameters for the ScheduledQueryRulesClient.ListBySubscription -// method. +// +// Generated from API version 2022-08-01-preview +// - options - ScheduledQueryRulesClientListBySubscriptionOptions contains the optional parameters for the ScheduledQueryRulesClient.NewListBySubscriptionPager +// method. func (client *ScheduledQueryRulesClient) NewListBySubscriptionPager(options *ScheduledQueryRulesClientListBySubscriptionOptions) *runtime.Pager[ScheduledQueryRulesClientListBySubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[ScheduledQueryRulesClientListBySubscriptionResponse]{ More: func(page ScheduledQueryRulesClientListBySubscriptionResponse) bool { @@ -325,7 +330,7 @@ func (client *ScheduledQueryRulesClient) listBySubscriptionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-15") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -342,12 +347,13 @@ func (client *ScheduledQueryRulesClient) listBySubscriptionHandleResponse(resp * // Update - Update a scheduled query rule. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-06-15 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// ruleName - The name of the rule. -// parameters - The parameters of the rule to update. -// options - ScheduledQueryRulesClientUpdateOptions contains the optional parameters for the ScheduledQueryRulesClient.Update -// method. +// +// Generated from API version 2022-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - ruleName - The name of the rule. +// - parameters - The parameters of the rule to update. +// - options - ScheduledQueryRulesClientUpdateOptions contains the optional parameters for the ScheduledQueryRulesClient.Update +// method. func (client *ScheduledQueryRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters ScheduledQueryRuleResourcePatch, options *ScheduledQueryRulesClientUpdateOptions) (ScheduledQueryRulesClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, ruleName, parameters, options) if err != nil { @@ -383,7 +389,7 @@ func (client *ScheduledQueryRulesClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-15") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) 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 0f307f9bafbf..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_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. - -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/tree/main/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-15/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() - client, err := armmonitor.NewScheduledQueryRulesClient("dd4bfc94-a096-412b-9c43-4bd13e35afbc", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-15/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() - client, err := armmonitor.NewScheduledQueryRulesClient("dd4bfc94-a096-412b-9c43-4bd13e35afbc", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("QueryResourceGroupName", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-15/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() - client, err := armmonitor.NewScheduledQueryRulesClient("dd4bfc94-a096-412b-9c43-4bd13e35afbc", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "QueryResourceGroupName", "perf", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-15/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() - client, err := armmonitor.NewScheduledQueryRulesClient("dd4bfc94-a096-412b-9c43-4bd13e35afbc", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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"), - }, - }, - AutoMitigate: to.Ptr(true), - 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"), - 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-15/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() - client, err := armmonitor.NewScheduledQueryRulesClient("dd4bfc94-a096-412b-9c43-4bd13e35afbc", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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"), - }, - }, - AutoMitigate: to.Ptr(true), - 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"), - 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-15/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() - client, err := armmonitor.NewScheduledQueryRulesClient("dd4bfc94-a096-412b-9c43-4bd13e35afbc", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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"), - }, - }, - AutoMitigate: to.Ptr(true), - 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"), - 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-15/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() - client, err := armmonitor.NewScheduledQueryRulesClient("dd4bfc94-a096-412b-9c43-4bd13e35afbc", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-15/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() - client, err := armmonitor.NewScheduledQueryRulesClient("dd4bfc94-a096-412b-9c43-4bd13e35afbc", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "QueryResourceGroupName", "heartbeat", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client.go b/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client.go index da1f349577d7..c7d09504b83c 100644 --- a/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client.go @@ -28,8 +28,8 @@ type TenantActivityLogsClient struct { } // NewTenantActivityLogsClient creates a new instance of TenantActivityLogsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewTenantActivityLogsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*TenantActivityLogsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -53,8 +53,10 @@ func NewTenantActivityLogsClient(credential azcore.TokenCredential, options *arm // for the subscription is applicable to this API (the parameters, $filter, etc.). One thing to // point out here is that this API does not retrieve the logs at the individual subscription of the tenant but only surfaces // the logs that were generated at the tenant level. +// // Generated from API version 2015-04-01 -// options - TenantActivityLogsClientListOptions contains the optional parameters for the TenantActivityLogsClient.List method. +// - options - TenantActivityLogsClientListOptions contains the optional parameters for the TenantActivityLogsClient.NewListPager +// method. func (client *TenantActivityLogsClient) NewListPager(options *TenantActivityLogsClientListOptions) *runtime.Pager[TenantActivityLogsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[TenantActivityLogsClientListResponse]{ More: func(page TenantActivityLogsClientListResponse) bool { 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 5dcc15707d27..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client_example_test.go +++ /dev/null @@ -1,122 +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. - -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/tree/main/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() - client, err := armmonitor.NewTenantActivityLogsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.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() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewTenantActivityLogsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.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() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewTenantActivityLogsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(&armmonitor.TenantActivityLogsClientListOptions{Filter: nil, - Select: to.Ptr("eventName,id,resourceGroupName,resourceProviderName,operationName,status,eventTimestamp,correlationId,submissionTimestamp,level"), - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewTenantActivityLogsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(&armmonitor.TenantActivityLogsClientListOptions{Filter: nil, - Select: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/time_rfc3339.go b/sdk/resourcemanager/monitor/armmonitor/time_rfc3339.go index 53fd0dd6f026..6136f88999b8 100644 --- a/sdk/resourcemanager/monitor/armmonitor/time_rfc3339.go +++ b/sdk/resourcemanager/monitor/armmonitor/time_rfc3339.go @@ -62,7 +62,7 @@ func (t *timeRFC3339) Parse(layout, value string) error { return err } -func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { +func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { diff --git a/sdk/resourcemanager/monitor/armmonitor/vminsights_client.go b/sdk/resourcemanager/monitor/armmonitor/vminsights_client.go index 75672a84ae81..5210d42225cc 100644 --- a/sdk/resourcemanager/monitor/armmonitor/vminsights_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/vminsights_client.go @@ -29,8 +29,8 @@ type VMInsightsClient struct { } // NewVMInsightsClient creates a new instance of VMInsightsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewVMInsightsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*VMInsightsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -52,10 +52,11 @@ func NewVMInsightsClient(credential azcore.TokenCredential, options *arm.ClientO // GetOnboardingStatus - Retrieves the VM Insights onboarding status for the specified resource or resource scope. // If the operation fails it returns an *azcore.ResponseError type. +// // Generated from API version 2018-11-27-preview -// resourceURI - The fully qualified Azure Resource manager identifier of the resource, or scope, whose status to retrieve. -// options - VMInsightsClientGetOnboardingStatusOptions contains the optional parameters for the VMInsightsClient.GetOnboardingStatus -// method. +// - resourceURI - The fully qualified Azure Resource manager identifier of the resource, or scope, whose status to retrieve. +// - options - VMInsightsClientGetOnboardingStatusOptions contains the optional parameters for the VMInsightsClient.GetOnboardingStatus +// method. func (client *VMInsightsClient) GetOnboardingStatus(ctx context.Context, resourceURI string, options *VMInsightsClientGetOnboardingStatusOptions) (VMInsightsClientGetOnboardingStatusResponse, error) { req, err := client.getOnboardingStatusCreateRequest(ctx, resourceURI, options) if err != nil { diff --git a/sdk/resourcemanager/monitor/armmonitor/vminsights_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/vminsights_client_example_test.go deleted file mode 100644 index d102a4b11324..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/vminsights_client_example_test.go +++ /dev/null @@ -1,112 +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. - -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/tree/main/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() - client, err := armmonitor.NewVMInsightsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewVMInsightsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewVMInsightsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewVMInsightsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armmonitor.NewVMInsightsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetOnboardingStatus(ctx, "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -}