From e4c7eb1753d4dc70380fbbd578682ac709d0d555 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 7 Mar 2023 02:59:07 +0000 Subject: [PATCH] CodeGen from PR 22939 in Azure/azure-rest-api-specs Merge 484c1d851bde866a2a242477d15822b4fdb2c804 into f6d16956a7d5b75e125a88d81d7bc9b6fecfd41a --- .../monitor/armmonitor/CHANGELOG.md | 86 + .../monitor/armmonitor/actiongroups_client.go | 350 +-- .../actiongroups_client_example_test.go | 677 ----- .../armmonitor/actiongroups_live_test.go | 122 - .../armmonitor/activitylogalerts_client.go | 56 +- .../activitylogalerts_client_example_test.go | 282 --- .../armmonitor/activitylogalerts_live_test.go | 127 - .../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 +- .../monitor/armmonitor/autoscale_live_test.go | 413 --- .../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/constants.go | 172 +- .../datacollectionendpoints_client.go | 54 +- ...collectionendpoints_client_example_test.go | 155 -- .../datacollectionendpoints_live_test.go | 130 - .../datacollectionruleassociations_client.go | 58 +- ...ionruleassociations_client_example_test.go | 150 -- .../armmonitor/datacollectionrules_client.go | 52 +- ...datacollectionrules_client_example_test.go | 229 -- .../datacollectionrules_live_test.go | 417 ---- .../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 | 18 +- sdk/resourcemanager/monitor/armmonitor/go.sum | 32 - .../monitor/armmonitor/logprofiles_client.go | 35 +- .../logprofiles_client_example_test.go | 151 -- .../armmonitor/logprofiles_live_test.go | 182 -- .../monitor/armmonitor/metricalerts_client.go | 52 +- .../metricalerts_client_example_test.go | 697 ------ .../armmonitor/metricalerts_live_test.go | 387 --- .../armmonitor/metricalertsstatus_client.go | 24 +- .../metricalertsstatus_client_example_test.go | 55 - .../armmonitor/metricdefinitions_client.go | 88 +- .../metricdefinitions_client_example_test.go | 90 - .../armmonitor/metricnamespaces_client.go | 10 +- .../metricnamespaces_client_example_test.go | 42 - .../monitor/armmonitor/metrics_client.go | 204 +- .../armmonitor/metrics_client_example_test.go | 102 - .../monitor/armmonitor/models.go | 894 ++++++- .../monitor/armmonitor/models_serde.go | 2215 ++++++++++++++--- .../monitor/armmonitor/operations_client.go | 7 +- .../operations_client_example_test.go | 36 - .../armmonitor/operationsformonitor_client.go | 106 + .../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 -- .../armmonitor/privatelinkscopes_live_test.go | 117 - .../monitor/armmonitor/response_types.go | 171 +- .../armmonitor/scheduledqueryrules_client.go | 80 +- ...scheduledqueryrules_client_example_test.go | 325 --- .../armmonitor/tenantactiongroups_client.go | 326 +++ .../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 - 79 files changed, 4670 insertions(+), 8077 deletions(-) delete mode 100644 sdk/resourcemanager/monitor/armmonitor/actiongroups_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/actiongroups_live_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/activitylogalerts_live_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/autoscale_live_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 delete mode 100644 sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_live_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/datacollectionrules_live_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/logprofiles_live_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/metricalerts_client_example_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/metricalerts_live_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 create mode 100644 sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client.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/privatelinkscopes_live_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client_example_test.go create mode 100644 sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client.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..efadca0efd06 100644 --- a/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md +++ b/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md @@ -1,5 +1,91 @@ # Release History +## 0.9.0 (2023-03-07) +### Breaking Changes + +- Function `NewMetricDefinitionsClient` parameter(s) have been changed from `(azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Function `NewMetricsClient` parameter(s) have been changed from `(azcore.TokenCredential, *arm.ClientOptions)` to `(string, azcore.TokenCredential, *arm.ClientOptions)` +- Type of `ErrorContract.Error` has been changed from `*ErrorResponseDetails` to `*ErrorResponse` +- Type of `Metric.Unit` has been changed from `*MetricUnit` to `*Unit` +- Function `*ActionGroupsClient.BeginCreateNotificationsAtResourceGroupLevel` has been removed +- Function `*ActionGroupsClient.GetTestNotifications` has been removed +- Function `*ActionGroupsClient.GetTestNotificationsAtResourceGroupLevel` has been removed +- Function `*ActionGroupsClient.BeginPostTestNotifications` has been removed + +### Features Added + +- New type alias `ActionType` with values `ActionTypeInternal` +- New type alias `IdentityType` with values `IdentityTypeNone`, `IdentityTypeSystemAssigned`, `IdentityTypeUserAssigned` +- New type alias `MetricAggregationType` with values `MetricAggregationTypeAverage`, `MetricAggregationTypeCount`, `MetricAggregationTypeMaximum`, `MetricAggregationTypeMinimum`, `MetricAggregationTypeNone`, `MetricAggregationTypeTotal` +- New type alias `MetricResultType` with values `MetricResultTypeData`, `MetricResultTypeMetadata` +- 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 type alias `Unit` with values `UnitBitsPerSecond`, `UnitByteSeconds`, `UnitBytes`, `UnitBytesPerSecond`, `UnitCores`, `UnitCount`, `UnitCountPerSecond`, `UnitMilliCores`, `UnitMilliSeconds`, `UnitNanoCores`, `UnitPercent`, `UnitSeconds`, `UnitUnspecified` +- 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 `*MetricDefinitionsClient.NewListAtSubscriptionScopePager(string, *MetricDefinitionsClientListAtSubscriptionScopeOptions) *runtime.Pager[MetricDefinitionsClientListAtSubscriptionScopeResponse]` +- New function `*MetricsClient.ListAtSubscriptionScope(context.Context, string, *MetricsClientListAtSubscriptionScopeOptions) (MetricsClientListAtSubscriptionScopeResponse, error)` +- New function `*MetricsClient.ListAtSubscriptionScopePost(context.Context, string, *MetricsClientListAtSubscriptionScopePostOptions) (MetricsClientListAtSubscriptionScopePostResponse, error)` +- New function `NewOperationsForMonitorClient(azcore.TokenCredential, *arm.ClientOptions) (*OperationsForMonitorClient, error)` +- New function `*OperationsForMonitorClient.NewListPager(*OperationsForMonitorClientListOptions) *runtime.Pager[OperationsForMonitorClientListResponse]` +- New function `NewTenantActionGroupsClient(azcore.TokenCredential, *arm.ClientOptions) (*TenantActionGroupsClient, error)` +- New function `*TenantActionGroupsClient.CreateOrUpdate(context.Context, string, string, string, TenantActionGroupResource, *TenantActionGroupsClientCreateOrUpdateOptions) (TenantActionGroupsClientCreateOrUpdateResponse, error)` +- New function `*TenantActionGroupsClient.Delete(context.Context, string, string, string, *TenantActionGroupsClientDeleteOptions) (TenantActionGroupsClientDeleteResponse, error)` +- New function `*TenantActionGroupsClient.Get(context.Context, string, string, string, *TenantActionGroupsClientGetOptions) (TenantActionGroupsClientGetResponse, error)` +- New function `*TenantActionGroupsClient.NewListByManagementGroupIDPager(string, string, *TenantActionGroupsClientListByManagementGroupIDOptions) *runtime.Pager[TenantActionGroupsClientListByManagementGroupIDResponse]` +- New function `*TenantActionGroupsClient.Update(context.Context, string, string, string, ActionGroupPatchBodyAutoGenerated, *TenantActionGroupsClientUpdateOptions) (TenantActionGroupsClientUpdateResponse, error)` +- New struct `ActionGroupPatchAutoGenerated` +- New struct `ActionGroupPatchBodyAutoGenerated` +- New struct `AzureAppPushReceiverAutoGenerated` +- 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 `EmailReceiverAutoGenerated` +- New struct `ErrorContractAutoGenerated` +- 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 `OperationsForMonitorClient` +- New struct `ResourceAutoGenerated5` +- New struct `RuleResolveConfiguration` +- New struct `SmsReceiverAutoGenerated` +- New struct `SubscriptionScopeMetric` +- New struct `SubscriptionScopeMetricDefinition` +- New struct `SubscriptionScopeMetricDefinitionCollection` +- New struct `SubscriptionScopeMetricResponse` +- New struct `SubscriptionScopeMetricsRequestBodyParameters` +- New struct `TenantActionGroup` +- New struct `TenantActionGroupList` +- New struct `TenantActionGroupResource` +- New struct `TenantActionGroupsClient` +- New struct `TrackedResourceAutoGenerated` +- New struct `UserIdentityProperties` +- New struct `VoiceReceiverAutoGenerated` +- New struct `WebhookReceiverAutoGenerated` +- New field `AutoAdjustTimegrain` in struct `MetricsClientListOptions` +- New field `ValidateDimensions` in struct `MetricsClientListOptions` +- 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..0f5aab22159e 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. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - actionGroupName - The name of the action group. +// - notificationRequest - The notification request body which includes the contact details +// - 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,7 +80,8 @@ 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 +// +// Generated from API version 2023-01-01 func (client *ActionGroupsClient) createNotificationsAtActionGroupResourceLevel(ctx context.Context, resourceGroupName string, actionGroupName string, notificationRequest NotificationRequestBody, options *ActionGroupsClientBeginCreateNotificationsAtActionGroupResourceLevelOptions) (*http.Response, error) { req, err := client.createNotificationsAtActionGroupResourceLevelCreateRequest(ctx, resourceGroupName, actionGroupName, notificationRequest, options) if err != nil { @@ -115,68 +117,7 @@ func (client *ActionGroupsClient) createNotificationsAtActionGroupResourceLevelC return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, notificationRequest) -} - -// 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. -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) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ActionGroupsClientCreateNotificationsAtResourceGroupLevelResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - } else { - return runtime.NewPollerFromResumeToken[ActionGroupsClientCreateNotificationsAtResourceGroupLevelResponse](options.ResumeToken, client.pl, nil) - } -} - -// 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) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// createNotificationsAtResourceGroupLevelCreateRequest creates the CreateNotificationsAtResourceGroupLevel request. -func (client *ActionGroupsClient) createNotificationsAtResourceGroupLevelCreateRequest(ctx context.Context, resourceGroupName string, notificationRequest NotificationRequestBody, options *ActionGroupsClientBeginCreateNotificationsAtResourceGroupLevelOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/createNotifications" - 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.MethodPost, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, notificationRequest) @@ -184,12 +125,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. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - actionGroupName - The name of the action group. +// - actionGroup - The action group to create or use for the update. +// - 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 { @@ -225,7 +167,7 @@ func (client *ActionGroupsClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, actionGroup) @@ -242,10 +184,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. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - actionGroupName - The name of the action group. +// - options - ActionGroupsClientDeleteOptions contains the optional parameters for the ActionGroupsClient.Delete method. 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 { @@ -281,7 +224,7 @@ func (client *ActionGroupsClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -290,12 +233,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. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - actionGroupName - The name of the action group. +// - enableRequest - The receiver to re-enable. +// - 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 { @@ -331,7 +275,7 @@ func (client *ActionGroupsClient) enableReceiverCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, enableRequest) @@ -339,10 +283,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. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - actionGroupName - The name of the action group. +// - options - ActionGroupsClientGetOptions contains the optional parameters for the ActionGroupsClient.Get method. 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 { @@ -378,7 +323,7 @@ func (client *ActionGroupsClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -393,66 +338,15 @@ func (client *ActionGroupsClient) getHandleResponse(resp *http.Response) (Action return result, nil } -// 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. -func (client *ActionGroupsClient) GetTestNotifications(ctx context.Context, notificationID string, options *ActionGroupsClientGetTestNotificationsOptions) (ActionGroupsClientGetTestNotificationsResponse, error) { - req, err := client.getTestNotificationsCreateRequest(ctx, notificationID, options) - if err != nil { - return ActionGroupsClientGetTestNotificationsResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ActionGroupsClientGetTestNotificationsResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ActionGroupsClientGetTestNotificationsResponse{}, runtime.NewResponseError(resp) - } - return client.getTestNotificationsHandleResponse(resp) -} - -// getTestNotificationsCreateRequest creates the GetTestNotifications request. -func (client *ActionGroupsClient) getTestNotificationsCreateRequest(ctx context.Context, notificationID string, options *ActionGroupsClientGetTestNotificationsOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/notificationStatus/{notificationId}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if notificationID == "" { - return nil, errors.New("parameter notificationID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{notificationId}", url.PathEscape(notificationID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getTestNotificationsHandleResponse handles the GetTestNotifications response. -func (client *ActionGroupsClient) getTestNotificationsHandleResponse(resp *http.Response) (ActionGroupsClientGetTestNotificationsResponse, error) { - result := ActionGroupsClientGetTestNotificationsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.TestNotificationDetailsResponse); err != nil { - return ActionGroupsClientGetTestNotificationsResponse{}, err - } - return result, nil -} - // GetTestNotificationsAtActionGroupResourceLevel - Get the test notifications by the notification id // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 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. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - actionGroupName - The name of the action group. +// - notificationID - The notification id +// - 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 { @@ -492,7 +386,7 @@ func (client *ActionGroupsClient) getTestNotificationsAtActionGroupResourceLevel return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -507,68 +401,12 @@ func (client *ActionGroupsClient) getTestNotificationsAtActionGroupResourceLevel return result, nil } -// 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. -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 { - return ActionGroupsClientGetTestNotificationsAtResourceGroupLevelResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ActionGroupsClientGetTestNotificationsAtResourceGroupLevelResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ActionGroupsClientGetTestNotificationsAtResourceGroupLevelResponse{}, runtime.NewResponseError(resp) - } - return client.getTestNotificationsAtResourceGroupLevelHandleResponse(resp) -} - -// getTestNotificationsAtResourceGroupLevelCreateRequest creates the GetTestNotificationsAtResourceGroupLevel request. -func (client *ActionGroupsClient) getTestNotificationsAtResourceGroupLevelCreateRequest(ctx context.Context, resourceGroupName string, notificationID string, options *ActionGroupsClientGetTestNotificationsAtResourceGroupLevelOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/notificationStatus/{notificationId}" - 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 notificationID == "" { - return nil, errors.New("parameter notificationID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{notificationId}", url.PathEscape(notificationID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getTestNotificationsAtResourceGroupLevelHandleResponse handles the GetTestNotificationsAtResourceGroupLevel response. -func (client *ActionGroupsClient) getTestNotificationsAtResourceGroupLevelHandleResponse(resp *http.Response) (ActionGroupsClientGetTestNotificationsAtResourceGroupLevelResponse, error) { - result := ActionGroupsClientGetTestNotificationsAtResourceGroupLevelResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.TestNotificationDetailsResponse); err != nil { - return ActionGroupsClientGetTestNotificationsAtResourceGroupLevelResponse{}, err - } - return result, nil -} - // 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. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ActionGroupsClientListByResourceGroupOptions contains the optional parameters for the ActionGroupsClient.NewListByResourceGroupPager +// method. func (client *ActionGroupsClient) NewListByResourceGroupPager(resourceGroupName string, options *ActionGroupsClientListByResourceGroupOptions) *runtime.Pager[ActionGroupsClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[ActionGroupsClientListByResourceGroupResponse]{ More: func(page ActionGroupsClientListByResourceGroupResponse) bool { @@ -607,7 +445,7 @@ func (client *ActionGroupsClient) listByResourceGroupCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -623,9 +461,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. +// +// Generated from API version 2023-01-01 +// - options - ActionGroupsClientListBySubscriptionIDOptions contains the optional parameters for the ActionGroupsClient.NewListBySubscriptionIDPager +// method. func (client *ActionGroupsClient) NewListBySubscriptionIDPager(options *ActionGroupsClientListBySubscriptionIDOptions) *runtime.Pager[ActionGroupsClientListBySubscriptionIDResponse] { return runtime.NewPager(runtime.PagingHandler[ActionGroupsClientListBySubscriptionIDResponse]{ More: func(page ActionGroupsClientListBySubscriptionIDResponse) bool { @@ -660,7 +499,7 @@ func (client *ActionGroupsClient) listBySubscriptionIDCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -675,69 +514,14 @@ func (client *ActionGroupsClient) listBySubscriptionIDHandleResponse(resp *http. return result, nil } -// 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. -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) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ActionGroupsClientPostTestNotificationsResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - } else { - return runtime.NewPollerFromResumeToken[ActionGroupsClientPostTestNotificationsResponse](options.ResumeToken, client.pl, nil) - } -} - -// 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) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// postTestNotificationsCreateRequest creates the PostTestNotifications request. -func (client *ActionGroupsClient) postTestNotificationsCreateRequest(ctx context.Context, notificationRequest NotificationRequestBody, options *ActionGroupsClientBeginPostTestNotificationsOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/createNotifications" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, notificationRequest) -} - // 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. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - actionGroupName - The name of the action group. +// - actionGroupPatch - Parameters supplied to the operation. +// - 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 { @@ -773,7 +557,7 @@ func (client *ActionGroupsClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, actionGroupPatch) 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/actiongroups_live_test.go b/sdk/resourcemanager/monitor/armmonitor/actiongroups_live_test.go deleted file mode 100644 index 155eb2fde4ca..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/actiongroups_live_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" - "fmt" - "testing" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/testutil" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "github.com/stretchr/testify/suite" -) - -type ActiongroupsTestSuite struct { - suite.Suite - - ctx context.Context - cred azcore.TokenCredential - options *arm.ClientOptions - actionGroupName string - location string - resourceGroupName string - subscriptionId string -} - -func (testsuite *ActiongroupsTestSuite) SetupSuite() { - testutil.StartRecording(testsuite.T(), "sdk/resourcemanager/monitor/armmonitor/testdata") - testsuite.ctx = context.Background() - testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T()) - testsuite.actionGroupName = testutil.GenerateAlphaNumericID(testsuite.T(), "actiongroupna", 6) - testsuite.location = testutil.GetEnv("LOCATION", "eastus") - testsuite.resourceGroupName = testutil.GetEnv("RESOURCE_GROUP_NAME", "scenarioTestTempGroup") - testsuite.subscriptionId = testutil.GetEnv("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - - resourceGroup, _, err := testutil.CreateResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.location) - testsuite.Require().NoError(err) - testsuite.resourceGroupName = *resourceGroup.Name -} - -func (testsuite *ActiongroupsTestSuite) TearDownSuite() { - _, err := testutil.DeleteResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName) - testsuite.Require().NoError(err) - testutil.StopRecording(testsuite.T()) -} - -func TestActiongroupsTestSuite(t *testing.T) { - suite.Run(t, new(ActiongroupsTestSuite)) -} - -// Microsoft.Insights/actionGroups -func (testsuite *ActiongroupsTestSuite) TestActiongroups() { - var err error - // From step ActionGroups_Create - fmt.Println("Call operation: ActionGroups_CreateOrUpdate") - actionGroupsClient, err := armmonitor.NewActionGroupsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - _, err = actionGroupsClient.CreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.actionGroupName, armmonitor.ActionGroupResource{ - Location: to.Ptr("Global"), - Properties: &armmonitor.ActionGroup{ - EmailReceivers: []*armmonitor.EmailReceiver{ - { - Name: to.Ptr("John Doe's email"), - EmailAddress: to.Ptr("johndoe@eamil.com"), - UseCommonAlertSchema: to.Ptr(false), - }}, - Enabled: to.Ptr(true), - GroupShortName: to.Ptr("sample"), - }, - }, nil) - testsuite.Require().NoError(err) - - // From step ActionGroups_Get - fmt.Println("Call operation: ActionGroups_Get") - _, err = actionGroupsClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.actionGroupName, nil) - testsuite.Require().NoError(err) - - // From step ActionGroups_Update - fmt.Println("Call operation: ActionGroups_Update") - _, err = actionGroupsClient.Update(testsuite.ctx, testsuite.resourceGroupName, testsuite.actionGroupName, armmonitor.ActionGroupPatchBody{ - Properties: &armmonitor.ActionGroupPatch{ - Enabled: to.Ptr(false), - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, nil) - testsuite.Require().NoError(err) - - // From step ActionGroups_ListBySubscriptionId - fmt.Println("Call operation: ActionGroups_ListBySubscriptionId") - actionGroupsClientNewListBySubscriptionIDPager := actionGroupsClient.NewListBySubscriptionIDPager(nil) - for actionGroupsClientNewListBySubscriptionIDPager.More() { - _, err := actionGroupsClientNewListBySubscriptionIDPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step ActionGroups_ListByResourceGroup - fmt.Println("Call operation: ActionGroups_ListByResourceGroup") - actionGroupsClientNewListByResourceGroupPager := actionGroupsClient.NewListByResourceGroupPager(testsuite.resourceGroupName, nil) - for actionGroupsClientNewListByResourceGroupPager.More() { - _, err := actionGroupsClientNewListByResourceGroupPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step ActionGroups_Delete - fmt.Println("Call operation: ActionGroups_Delete") - _, err = actionGroupsClient.Delete(testsuite.ctx, testsuite.resourceGroupName, testsuite.actionGroupName, nil) - testsuite.Require().NoError(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/activitylogalerts_live_test.go b/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_live_test.go deleted file mode 100644 index e3f53584e7c1..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_live_test.go +++ /dev/null @@ -1,127 +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" - "fmt" - "testing" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/testutil" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "github.com/stretchr/testify/suite" -) - -type ActivitylogalertsTestSuite struct { - suite.Suite - - ctx context.Context - cred azcore.TokenCredential - options *arm.ClientOptions - activityLogAlertName string - location string - resourceGroupName string - subscriptionId string -} - -func (testsuite *ActivitylogalertsTestSuite) SetupSuite() { - testutil.StartRecording(testsuite.T(), "sdk/resourcemanager/monitor/armmonitor/testdata") - testsuite.ctx = context.Background() - testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T()) - testsuite.activityLogAlertName = testutil.GenerateAlphaNumericID(testsuite.T(), "activitylogalertna", 6) - testsuite.location = testutil.GetEnv("LOCATION", "eastus") - testsuite.resourceGroupName = testutil.GetEnv("RESOURCE_GROUP_NAME", "scenarioTestTempGroup") - testsuite.subscriptionId = testutil.GetEnv("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - - resourceGroup, _, err := testutil.CreateResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.location) - testsuite.Require().NoError(err) - testsuite.resourceGroupName = *resourceGroup.Name -} - -func (testsuite *ActivitylogalertsTestSuite) TearDownSuite() { - _, err := testutil.DeleteResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName) - testsuite.Require().NoError(err) - testutil.StopRecording(testsuite.T()) -} - -func TestActivitylogalertsTestSuite(t *testing.T) { - suite.Run(t, new(ActivitylogalertsTestSuite)) -} - -// Microsoft.Insights/activityLogAlerts -func (testsuite *ActivitylogalertsTestSuite) TestActivitylogalert() { - var err error - // From step ActivityLogAlerts_Create - fmt.Println("Call operation: ActivityLogAlerts_CreateOrUpdate") - activityLogAlertsClient, err := armmonitor.NewActivityLogAlertsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - _, err = activityLogAlertsClient.CreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.activityLogAlertName, armmonitor.ActivityLogAlertResource{ - Location: to.Ptr("Global"), - Properties: &armmonitor.AlertRuleProperties{ - Condition: &armmonitor.AlertRuleAllOfCondition{ - AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - { - Equals: to.Ptr("Administrative"), - Field: to.Ptr("category"), - }, - { - Equals: to.Ptr("Error"), - Field: to.Ptr("level"), - }}, - }, - Scopes: []*string{ - to.Ptr("/subscriptions/" + testsuite.subscriptionId)}, - }, - }, nil) - testsuite.Require().NoError(err) - - // From step ActivityLogAlerts_ListBySubscriptionId - fmt.Println("Call operation: ActivityLogAlerts_ListBySubscriptionId") - activityLogAlertsClientNewListBySubscriptionIDPager := activityLogAlertsClient.NewListBySubscriptionIDPager(nil) - for activityLogAlertsClientNewListBySubscriptionIDPager.More() { - _, err := activityLogAlertsClientNewListBySubscriptionIDPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step ActivityLogAlerts_ListByResourceGroup - fmt.Println("Call operation: ActivityLogAlerts_ListByResourceGroup") - activityLogAlertsClientNewListByResourceGroupPager := activityLogAlertsClient.NewListByResourceGroupPager(testsuite.resourceGroupName, nil) - for activityLogAlertsClientNewListByResourceGroupPager.More() { - _, err := activityLogAlertsClientNewListByResourceGroupPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step ActivityLogAlerts_Get - fmt.Println("Call operation: ActivityLogAlerts_Get") - _, err = activityLogAlertsClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.activityLogAlertName, nil) - testsuite.Require().NoError(err) - - // From step ActivityLogAlerts_Update - fmt.Println("Call operation: ActivityLogAlerts_Update") - _, err = activityLogAlertsClient.Update(testsuite.ctx, testsuite.resourceGroupName, testsuite.activityLogAlertName, armmonitor.AlertRulePatchObject{ - Properties: &armmonitor.AlertRulePatchProperties{ - Enabled: to.Ptr(false), - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, nil) - testsuite.Require().NoError(err) - - // From step ActivityLogAlerts_Delete - fmt.Println("Call operation: ActivityLogAlerts_Delete") - _, err = activityLogAlertsClient.Delete(testsuite.ctx, testsuite.resourceGroupName, testsuite.activityLogAlertName, nil) - testsuite.Require().NoError(err) -} 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/autoscale_live_test.go b/sdk/resourcemanager/monitor/armmonitor/autoscale_live_test.go deleted file mode 100644 index 94598a040fb7..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/autoscale_live_test.go +++ /dev/null @@ -1,413 +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" - "fmt" - "testing" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/testutil" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" - "github.com/stretchr/testify/suite" -) - -type AutoscaleTestSuite struct { - suite.Suite - - ctx context.Context - cred azcore.TokenCredential - options *arm.ClientOptions - autoscaleSettingName string - subnetId string - vmssId string - adminPassword string - location string - resourceGroupName string - subscriptionId string -} - -func (testsuite *AutoscaleTestSuite) SetupSuite() { - testutil.StartRecording(testsuite.T(), "sdk/resourcemanager/monitor/armmonitor/testdata") - testsuite.ctx = context.Background() - testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T()) - testsuite.autoscaleSettingName = testutil.GenerateAlphaNumericID(testsuite.T(), "autoscalesettingna", 6) - testsuite.adminPassword = testutil.GetEnv("ADMIN_PASSWORD", "000000000000") - testsuite.location = testutil.GetEnv("LOCATION", "eastus") - testsuite.resourceGroupName = testutil.GetEnv("RESOURCE_GROUP_NAME", "scenarioTestTempGroup") - testsuite.subscriptionId = testutil.GetEnv("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - - resourceGroup, _, err := testutil.CreateResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.location) - testsuite.Require().NoError(err) - testsuite.resourceGroupName = *resourceGroup.Name - testsuite.Prepare() -} - -func (testsuite *AutoscaleTestSuite) TearDownSuite() { - _, err := testutil.DeleteResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName) - testsuite.Require().NoError(err) - testutil.StopRecording(testsuite.T()) -} - -func TestAutoscaleTestSuite(t *testing.T) { - suite.Run(t, new(AutoscaleTestSuite)) -} - -func (testsuite *AutoscaleTestSuite) Prepare() { - var err error - // From step NetworkAndSubnet_Create - template := map[string]interface{}{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", - "contentVersion": "1.0.0.0", - "outputs": map[string]interface{}{ - "subnetId": map[string]interface{}{ - "type": "string", - "value": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('virtualNetworksName'), 'vmsssubnet')]", - }, - }, - "parameters": map[string]interface{}{ - "location": map[string]interface{}{ - "type": "string", - "defaultValue": "$(location)", - }, - "virtualNetworksName": map[string]interface{}{ - "type": "string", - "defaultValue": "vmssvnet", - }, - }, - "resources": []interface{}{ - map[string]interface{}{ - "name": "[parameters('virtualNetworksName')]", - "type": "Microsoft.Network/virtualNetworks", - "apiVersion": "2021-05-01", - "location": "[parameters('location')]", - "properties": map[string]interface{}{ - "addressSpace": map[string]interface{}{ - "addressPrefixes": []interface{}{ - "10.0.0.0/16", - }, - }, - "subnets": []interface{}{ - map[string]interface{}{ - "name": "vmsssubnet", - "properties": map[string]interface{}{ - "addressPrefix": "10.0.0.0/24", - }, - }, - }, - }, - "tags": map[string]interface{}{}, - }, - }, - } - params := map[string]interface{}{ - "location": map[string]interface{}{"value": testsuite.location}, - } - deployment := armresources.Deployment{ - Properties: &armresources.DeploymentProperties{ - Template: template, - Parameters: params, - Mode: to.Ptr(armresources.DeploymentModeIncremental), - }, - } - deploymentExtend, err := testutil.CreateDeployment(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName, "NetworkAndSubnet_Create", &deployment) - testsuite.Require().NoError(err) - testsuite.subnetId = deploymentExtend.Properties.Outputs.(map[string]interface{})["subnetId"].(map[string]interface{})["value"].(string) - - // From step NetworkInterface_Create - template = map[string]interface{}{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", - "contentVersion": "1.0.0.0", - "parameters": map[string]interface{}{ - "location": map[string]interface{}{ - "type": "string", - "defaultValue": "$(location)", - }, - "subnetId": map[string]interface{}{ - "type": "string", - "defaultValue": "$(subnetId)", - }, - }, - "resources": []interface{}{ - map[string]interface{}{ - "name": "vmssnic", - "type": "Microsoft.Network/networkInterfaces", - "apiVersion": "2021-08-01", - "location": "[parameters('location')]", - "properties": map[string]interface{}{ - "ipConfigurations": []interface{}{ - map[string]interface{}{ - "name": "Ipv4config", - "properties": map[string]interface{}{ - "subnet": map[string]interface{}{ - "id": "[parameters('subnetId')]", - }, - }, - }, - }, - }, - "tags": map[string]interface{}{}, - }, - }, - } - params = map[string]interface{}{ - "location": map[string]interface{}{"value": testsuite.location}, - "subnetId": map[string]interface{}{"value": testsuite.subnetId}, - } - deployment = armresources.Deployment{ - Properties: &armresources.DeploymentProperties{ - Template: template, - Parameters: params, - Mode: to.Ptr(armresources.DeploymentModeIncremental), - }, - } - _, err = testutil.CreateDeployment(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName, "NetworkInterface_Create", &deployment) - testsuite.Require().NoError(err) - - // From step VMSS_Create - template = map[string]interface{}{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", - "contentVersion": "1.0.0.0", - "outputs": map[string]interface{}{ - "vmssId": map[string]interface{}{ - "type": "string", - "value": "[resourceId('Microsoft.Compute/virtualMachineScaleSets', parameters('virtualMachineScaleSetName'))]", - }, - }, - "parameters": map[string]interface{}{ - "adminPassword": map[string]interface{}{ - "type": "securestring", - "defaultValue": "$(adminPassword)", - }, - "location": map[string]interface{}{ - "type": "string", - "defaultValue": "$(location)", - }, - "subnetId": map[string]interface{}{ - "type": "string", - "defaultValue": "$(subnetId)", - }, - "virtualMachineScaleSetName": map[string]interface{}{ - "type": "string", - "defaultValue": "monitorvmss", - }, - }, - "resources": []interface{}{ - map[string]interface{}{ - "name": "[parameters('virtualMachineScaleSetName')]", - "type": "Microsoft.Compute/virtualMachineScaleSets", - "apiVersion": "2022-03-01", - "location": "[parameters('location')]", - "properties": map[string]interface{}{ - "scaleInPolicy": map[string]interface{}{ - "rules": []interface{}{ - "Default", - }, - }, - "singlePlacementGroup": false, - "upgradePolicy": map[string]interface{}{ - "mode": "Manual", - }, - "virtualMachineProfile": map[string]interface{}{ - "diagnosticsProfile": map[string]interface{}{ - "bootDiagnostics": map[string]interface{}{ - "enabled": true, - }, - }, - "networkProfile": map[string]interface{}{ - "networkInterfaceConfigurations": []interface{}{ - map[string]interface{}{ - "name": "[concat(parameters('virtualMachineScaleSetName'), 'vnet-nic01')]", - "properties": map[string]interface{}{ - "enableAcceleratedNetworking": true, - "enableIPForwarding": false, - "ipConfigurations": []interface{}{ - map[string]interface{}{ - "name": "[concat(parameters('virtualMachineScaleSetName'), 'vnet-nic01-defaultIpConfiguration')]", - "properties": map[string]interface{}{ - "primary": true, - "privateIPAddressVersion": "IPv4", - "subnet": map[string]interface{}{ - "id": "[parameters('subnetId')]", - }, - }, - }, - }, - "primary": true, - }, - }, - }, - }, - "osProfile": map[string]interface{}{ - "adminPassword": "[parameters('adminPassword')]", - "adminUsername": "azureuser", - "allowExtensionOperations": true, - "computerNamePrefix": "vmss", - "secrets": []interface{}{}, - "windowsConfiguration": map[string]interface{}{ - "enableAutomaticUpdates": true, - "provisionVMAgent": true, - }, - }, - "storageProfile": map[string]interface{}{ - "imageReference": map[string]interface{}{ - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2019-Datacenter", - "version": "latest", - }, - "osDisk": map[string]interface{}{ - "caching": "ReadWrite", - "createOption": "FromImage", - "diskSizeGB": float64(127), - "managedDisk": map[string]interface{}{ - "storageAccountType": "Premium_LRS", - }, - "osType": "Windows", - }, - }, - }, - }, - "sku": map[string]interface{}{ - "name": "Standard_DS1_v2", - "capacity": float64(2), - "tier": "Standard", - }, - }, - }, - "variables": map[string]interface{}{}, - } - params = map[string]interface{}{ - "adminPassword": map[string]interface{}{"value": testsuite.adminPassword}, - "location": map[string]interface{}{"value": testsuite.location}, - "subnetId": map[string]interface{}{"value": testsuite.subnetId}, - } - deployment = armresources.Deployment{ - Properties: &armresources.DeploymentProperties{ - Template: template, - Parameters: params, - Mode: to.Ptr(armresources.DeploymentModeIncremental), - }, - } - deploymentExtend, err = testutil.CreateDeployment(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName, "VMSS_Create", &deployment) - testsuite.Require().NoError(err) - testsuite.vmssId = deploymentExtend.Properties.Outputs.(map[string]interface{})["vmssId"].(map[string]interface{})["value"].(string) -} - -// Microsoft.Insights/autoscalesettings -func (testsuite *AutoscaleTestSuite) TestAutoscalesettings() { - var err error - // From step AutoscaleSettings_Create - fmt.Println("Call operation: AutoscaleSettings_CreateOrUpdate") - autoscaleSettingsClient, err := armmonitor.NewAutoscaleSettingsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - _, err = autoscaleSettingsClient.CreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.autoscaleSettingName, armmonitor.AutoscaleSettingResource{ - Location: to.Ptr(testsuite.location), - Tags: map[string]*string{}, - 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"), - }}, - 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"), - }, - }}, - TargetResourceURI: to.Ptr(testsuite.vmssId), - }, - }, nil) - testsuite.Require().NoError(err) - - // From step AutoscaleSettings_Update - fmt.Println("Call operation: AutoscaleSettings_Update") - _, err = autoscaleSettingsClient.Update(testsuite.ctx, testsuite.resourceGroupName, testsuite.autoscaleSettingName, armmonitor.AutoscaleSettingResourcePatch{ - Tags: map[string]*string{ - "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary"), - }, - }, nil) - testsuite.Require().NoError(err) - - // From step AutoscaleSettings_ListBySubscription - fmt.Println("Call operation: AutoscaleSettings_ListBySubscription") - autoscaleSettingsClientNewListBySubscriptionPager := autoscaleSettingsClient.NewListBySubscriptionPager(nil) - for autoscaleSettingsClientNewListBySubscriptionPager.More() { - _, err := autoscaleSettingsClientNewListBySubscriptionPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step AutoscaleSettings_ListByResourceGroup - fmt.Println("Call operation: AutoscaleSettings_ListByResourceGroup") - autoscaleSettingsClientNewListByResourceGroupPager := autoscaleSettingsClient.NewListByResourceGroupPager(testsuite.resourceGroupName, nil) - for autoscaleSettingsClientNewListByResourceGroupPager.More() { - _, err := autoscaleSettingsClientNewListByResourceGroupPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step AutoscaleSettings_Get - fmt.Println("Call operation: AutoscaleSettings_Get") - _, err = autoscaleSettingsClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.autoscaleSettingName, nil) - testsuite.Require().NoError(err) - - // From step AutoscaleSettings_Delete - fmt.Println("Call operation: AutoscaleSettings_Delete") - _, err = autoscaleSettingsClient.Delete(testsuite.ctx, testsuite.resourceGroupName, testsuite.autoscaleSettingName, nil) - testsuite.Require().NoError(err) -} - -// Microsoft.Insights/eventcategories -func (testsuite *AutoscaleTestSuite) TestEventcategories() { - var err error - // From step EventCategories_List - fmt.Println("Call operation: EventCategories_List") - eventCategoriesClient, err := armmonitor.NewEventCategoriesClient(testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - eventCategoriesClientNewListPager := eventCategoriesClient.NewListPager(nil) - for eventCategoriesClientNewListPager.More() { - _, err := eventCategoriesClientNewListPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } -} - -// Microsoft.Insights/operations -func (testsuite *AutoscaleTestSuite) TestOperations() { - var err error - // From step Operations_List - fmt.Println("Call operation: Operations_List") - operationsClient, err := armmonitor.NewOperationsClient(testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - _, err = operationsClient.List(testsuite.ctx, nil) - testsuite.Require().NoError(err) -} diff --git a/sdk/resourcemanager/monitor/armmonitor/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/constants.go b/sdk/resourcemanager/monitor/armmonitor/constants.go index 583be93bd909..12767ef40ec5 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 @@ -675,6 +707,30 @@ func PossibleKnownWindowsEventLogDataSourceStreamsValues() []KnownWindowsEventLo } } +// MetricAggregationType - the aggregation type of the metric. +type MetricAggregationType string + +const ( + MetricAggregationTypeAverage MetricAggregationType = "Average" + MetricAggregationTypeCount MetricAggregationType = "Count" + MetricAggregationTypeMaximum MetricAggregationType = "Maximum" + MetricAggregationTypeMinimum MetricAggregationType = "Minimum" + MetricAggregationTypeNone MetricAggregationType = "None" + MetricAggregationTypeTotal MetricAggregationType = "Total" +) + +// PossibleMetricAggregationTypeValues returns the possible values for the MetricAggregationType const type. +func PossibleMetricAggregationTypeValues() []MetricAggregationType { + return []MetricAggregationType{ + MetricAggregationTypeAverage, + MetricAggregationTypeCount, + MetricAggregationTypeMaximum, + MetricAggregationTypeMinimum, + MetricAggregationTypeNone, + MetricAggregationTypeTotal, + } +} + // MetricClass - The class of the metric. type MetricClass string @@ -697,6 +753,23 @@ func PossibleMetricClassValues() []MetricClass { } } +// MetricResultType - Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's +// description for details. +type MetricResultType string + +const ( + MetricResultTypeData MetricResultType = "Data" + MetricResultTypeMetadata MetricResultType = "Metadata" +) + +// PossibleMetricResultTypeValues returns the possible values for the MetricResultType const type. +func PossibleMetricResultTypeValues() []MetricResultType { + return []MetricResultType{ + MetricResultTypeData, + MetricResultTypeMetadata, + } +} + // MetricStatisticType - the metric statistic type. How the metrics from multiple instances are combined. type MetricStatisticType string @@ -834,6 +907,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 +982,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 @@ -1076,3 +1208,41 @@ func PossibleTimeAggregationTypeValues() []TimeAggregationType { TimeAggregationTypeLast, } } + +// Unit - The unit of the metric. +type Unit string + +const ( + UnitCount Unit = "Count" + UnitBytes Unit = "Bytes" + UnitSeconds Unit = "Seconds" + UnitCountPerSecond Unit = "CountPerSecond" + UnitBytesPerSecond Unit = "BytesPerSecond" + UnitPercent Unit = "Percent" + UnitMilliSeconds Unit = "MilliSeconds" + UnitByteSeconds Unit = "ByteSeconds" + UnitUnspecified Unit = "Unspecified" + UnitCores Unit = "Cores" + UnitMilliCores Unit = "MilliCores" + UnitNanoCores Unit = "NanoCores" + UnitBitsPerSecond Unit = "BitsPerSecond" +) + +// PossibleUnitValues returns the possible values for the Unit const type. +func PossibleUnitValues() []Unit { + return []Unit{ + UnitCount, + UnitBytes, + UnitSeconds, + UnitCountPerSecond, + UnitBytesPerSecond, + UnitPercent, + UnitMilliSeconds, + UnitByteSeconds, + UnitUnspecified, + UnitCores, + UnitMilliCores, + UnitNanoCores, + UnitBitsPerSecond, + } +} 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/datacollectionendpoints_live_test.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_live_test.go deleted file mode 100644 index e9d4abbd3136..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_live_test.go +++ /dev/null @@ -1,130 +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" - "fmt" - "testing" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/testutil" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "github.com/stretchr/testify/suite" -) - -type DatacollectionendpointsTestSuite struct { - suite.Suite - - ctx context.Context - cred azcore.TokenCredential - options *arm.ClientOptions - dataCollectionEndpointName string - location string - resourceGroupName string - subscriptionId string -} - -func (testsuite *DatacollectionendpointsTestSuite) SetupSuite() { - testutil.StartRecording(testsuite.T(), "sdk/resourcemanager/monitor/armmonitor/testdata") - testsuite.ctx = context.Background() - testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T()) - testsuite.dataCollectionEndpointName = testutil.GenerateAlphaNumericID(testsuite.T(), "datacollectionendpointna", 6) - testsuite.location = testutil.GetEnv("LOCATION", "eastus") - testsuite.resourceGroupName = testutil.GetEnv("RESOURCE_GROUP_NAME", "scenarioTestTempGroup") - testsuite.subscriptionId = testutil.GetEnv("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - - resourceGroup, _, err := testutil.CreateResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.location) - testsuite.Require().NoError(err) - testsuite.resourceGroupName = *resourceGroup.Name -} - -func (testsuite *DatacollectionendpointsTestSuite) TearDownSuite() { - _, err := testutil.DeleteResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName) - testsuite.Require().NoError(err) - testutil.StopRecording(testsuite.T()) -} - -func TestDatacollectionendpointsTestSuite(t *testing.T) { - suite.Run(t, new(DatacollectionendpointsTestSuite)) -} - -// Microsoft.Insights/dataCollectionEndpoints -func (testsuite *DatacollectionendpointsTestSuite) TestDatacollectionendpoint() { - var err error - // From step DataCollectionEndpoints_Create - fmt.Println("Call operation: DataCollectionEndpoints_Create") - dataCollectionEndpointsClient, err := armmonitor.NewDataCollectionEndpointsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - _, err = dataCollectionEndpointsClient.Create(testsuite.ctx, testsuite.resourceGroupName, testsuite.dataCollectionEndpointName, &armmonitor.DataCollectionEndpointsClientCreateOptions{ - Body: &armmonitor.DataCollectionEndpointResource{ - Location: to.Ptr(testsuite.location), - Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), - }, - }, - }, - }) - testsuite.Require().NoError(err) - - // From step DataCollectionEndpoints_ListBySubscription - fmt.Println("Call operation: DataCollectionEndpoints_ListBySubscription") - dataCollectionEndpointsClientNewListBySubscriptionPager := dataCollectionEndpointsClient.NewListBySubscriptionPager(nil) - for dataCollectionEndpointsClientNewListBySubscriptionPager.More() { - _, err := dataCollectionEndpointsClientNewListBySubscriptionPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step DataCollectionEndpoints_Get - fmt.Println("Call operation: DataCollectionEndpoints_Get") - _, err = dataCollectionEndpointsClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.dataCollectionEndpointName, nil) - testsuite.Require().NoError(err) - - // From step DataCollectionEndpoints_ListByResourceGroup - fmt.Println("Call operation: DataCollectionEndpoints_ListByResourceGroup") - dataCollectionEndpointsClientNewListByResourceGroupPager := dataCollectionEndpointsClient.NewListByResourceGroupPager(testsuite.resourceGroupName, nil) - for dataCollectionEndpointsClientNewListByResourceGroupPager.More() { - _, err := dataCollectionEndpointsClientNewListByResourceGroupPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step DataCollectionEndpoints_Update - fmt.Println("Call operation: DataCollectionEndpoints_Update") - _, err = dataCollectionEndpointsClient.Update(testsuite.ctx, testsuite.resourceGroupName, testsuite.dataCollectionEndpointName, &armmonitor.DataCollectionEndpointsClientUpdateOptions{ - Body: &armmonitor.ResourceForUpdate{ - Tags: map[string]*string{ - "tag1": to.Ptr("A"), - "tag2": to.Ptr("B"), - "tag3": to.Ptr("C"), - }, - }, - }) - testsuite.Require().NoError(err) - - // From step DataCollectionRuleAssociations_ListByDataCollectionEndpoint - fmt.Println("Call operation: DataCollectionRuleAssociations_ListByDataCollectionEndpoint") - dataCollectionRuleAssociationsClient, err := armmonitor.NewDataCollectionRuleAssociationsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - dataCollectionRuleAssociationsClientNewListByDataCollectionEndpointPager := dataCollectionRuleAssociationsClient.NewListByDataCollectionEndpointPager(testsuite.resourceGroupName, testsuite.dataCollectionEndpointName, nil) - for dataCollectionRuleAssociationsClientNewListByDataCollectionEndpointPager.More() { - _, err := dataCollectionRuleAssociationsClientNewListByDataCollectionEndpointPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step DataCollectionEndpoints_Delete - fmt.Println("Call operation: DataCollectionEndpoints_Delete") - _, err = dataCollectionEndpointsClient.Delete(testsuite.ctx, testsuite.resourceGroupName, testsuite.dataCollectionEndpointName, nil) - testsuite.Require().NoError(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/datacollectionrules_live_test.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_live_test.go deleted file mode 100644 index ec0555d24fae..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_live_test.go +++ /dev/null @@ -1,417 +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" - "fmt" - "testing" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/testutil" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" - "github.com/stretchr/testify/suite" -) - -type DatacollectionrulesTestSuite struct { - suite.Suite - - ctx context.Context - cred azcore.TokenCredential - options *arm.ClientOptions - dataCollectionRuleName string - managedClustersName string - resourceUri string - workspaceId string - azureClientId string - azureClientSecret string - location string - resourceGroupName string - subscriptionId string -} - -func (testsuite *DatacollectionrulesTestSuite) SetupSuite() { - testutil.StartRecording(testsuite.T(), "sdk/resourcemanager/monitor/armmonitor/testdata") - testsuite.ctx = context.Background() - testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T()) - testsuite.dataCollectionRuleName = testutil.GenerateAlphaNumericID(testsuite.T(), "datacollectionrulena", 6) - testsuite.managedClustersName = testutil.GenerateAlphaNumericID(testsuite.T(), "associationaks", 6) - testsuite.azureClientId = testutil.GetEnv("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") - testsuite.azureClientSecret = testutil.GetEnv("AZURE_CLIENT_SECRET", "000000000000") - testsuite.location = testutil.GetEnv("LOCATION", "eastus") - testsuite.resourceGroupName = testutil.GetEnv("RESOURCE_GROUP_NAME", "scenarioTestTempGroup") - testsuite.subscriptionId = testutil.GetEnv("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - - resourceGroup, _, err := testutil.CreateResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.location) - testsuite.Require().NoError(err) - testsuite.resourceGroupName = *resourceGroup.Name - testsuite.Prepare() -} - -func (testsuite *DatacollectionrulesTestSuite) TearDownSuite() { - _, err := testutil.DeleteResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName) - testsuite.Require().NoError(err) - testutil.StopRecording(testsuite.T()) -} - -func TestDatacollectionrulesTestSuite(t *testing.T) { - suite.Run(t, new(DatacollectionrulesTestSuite)) -} - -func (testsuite *DatacollectionrulesTestSuite) Prepare() { - var err error - // From step WorkSpaces_Create - template := map[string]interface{}{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", - "contentVersion": "1.0.0.0", - "outputs": map[string]interface{}{ - "workspaceId": map[string]interface{}{ - "type": "string", - "value": "[resourceId('Microsoft.OperationalInsights/workspaces','workspacena')]", - }, - }, - "parameters": map[string]interface{}{ - "location": map[string]interface{}{ - "type": "string", - "defaultValue": "$(location)", - }, - }, - "resources": []interface{}{ - map[string]interface{}{ - "name": "workspacena", - "type": "Microsoft.OperationalInsights/workspaces", - "apiVersion": "2021-12-01-preview", - "location": "[parameters('location')]", - "properties": map[string]interface{}{ - "retentionInDays": float64(30), - "sku": map[string]interface{}{ - "name": "PerNode", - }, - }, - "tags": map[string]interface{}{ - "tag1": "value1", - }, - }, - }, - } - params := map[string]interface{}{ - "location": map[string]interface{}{"value": testsuite.location}, - } - deployment := armresources.Deployment{ - Properties: &armresources.DeploymentProperties{ - Template: template, - Parameters: params, - Mode: to.Ptr(armresources.DeploymentModeIncremental), - }, - } - deploymentExtend, err := testutil.CreateDeployment(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName, "WorkSpaces_Create", &deployment) - testsuite.Require().NoError(err) - testsuite.workspaceId = deploymentExtend.Properties.Outputs.(map[string]interface{})["workspaceId"].(map[string]interface{})["value"].(string) - - // From step ContainerService_Create - template = map[string]interface{}{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", - "contentVersion": "1.0.0.0", - "outputs": map[string]interface{}{ - "resourceUri": map[string]interface{}{ - "type": "string", - "value": "[resourceId('Microsoft.ContainerService/managedClusters', parameters('managedClustersName'))]", - }, - }, - "parameters": map[string]interface{}{ - "azureClientId": map[string]interface{}{ - "type": "string", - "defaultValue": "$(azureClientId)", - }, - "azureClientSecret": map[string]interface{}{ - "type": "string", - "defaultValue": "$(azureClientSecret)", - }, - "location": map[string]interface{}{ - "type": "string", - "defaultValue": "$(location)", - }, - "managedClustersName": map[string]interface{}{ - "type": "string", - "defaultValue": "$(managedClustersName)", - }, - }, - "resources": []interface{}{ - map[string]interface{}{ - "name": "[parameters('managedClustersName')]", - "type": "Microsoft.ContainerService/managedClusters", - "apiVersion": "2022-06-02-preview", - "identity": map[string]interface{}{ - "type": "SystemAssigned", - }, - "location": "[parameters('location')]", - "properties": map[string]interface{}{ - "agentPoolProfiles": []interface{}{ - map[string]interface{}{ - "name": "agentpool", - "type": "VirtualMachineScaleSets", - "availabilityZones": []interface{}{ - "1", - "2", - "3", - }, - "count": float64(1), - "enableAutoScaling": true, - "enableFIPS": false, - "enableNodePublicIP": false, - "kubeletDiskType": "OS", - "maxCount": float64(5), - "maxPods": float64(110), - "minCount": float64(1), - "mode": "System", - "osDiskSizeGB": float64(128), - "osDiskType": "Managed", - "osSKU": "Ubuntu", - "osType": "Linux", - "powerState": map[string]interface{}{ - "code": "Running", - }, - "vmSize": "Standard_DS2_v2", - }, - map[string]interface{}{ - "name": "noodpool2", - "type": "VirtualMachineScaleSets", - "count": float64(1), - "enableAutoScaling": true, - "enableFIPS": false, - "enableNodePublicIP": false, - "kubeletDiskType": "OS", - "maxCount": float64(10), - "maxPods": float64(110), - "minCount": float64(1), - "mode": "User", - "osDiskSizeGB": float64(128), - "osDiskType": "Managed", - "osSKU": "Ubuntu", - "osType": "Linux", - "powerState": map[string]interface{}{ - "code": "Running", - }, - "scaleDownMode": "Delete", - "upgradeSettings": map[string]interface{}{}, - "vmSize": "Standard_DS2_v2", - }, - }, - "dnsPrefix": "[concat(parameters('managedClustersName'), '-dns')]", - "oidcIssuerProfile": map[string]interface{}{ - "enabled": false, - }, - "servicePrincipalProfile": map[string]interface{}{ - "clientId": "[parameters('azureClientId')]", - "secret": "[parameters('azureClientSecret')]", - }, - "storageProfile": map[string]interface{}{ - "diskCSIDriver": map[string]interface{}{ - "enabled": true, - "version": "v1", - }, - "fileCSIDriver": map[string]interface{}{ - "enabled": true, - }, - "snapshotController": map[string]interface{}{ - "enabled": true, - }, - }, - "workloadAutoScalerProfile": map[string]interface{}{}, - }, - "sku": map[string]interface{}{ - "name": "Basic", - "tier": "Paid", - }, - }, - }, - "variables": map[string]interface{}{}, - } - params = map[string]interface{}{ - "azureClientId": map[string]interface{}{"value": testsuite.azureClientId}, - "azureClientSecret": map[string]interface{}{"value": testsuite.azureClientSecret}, - "location": map[string]interface{}{"value": testsuite.location}, - "managedClustersName": map[string]interface{}{"value": testsuite.managedClustersName}, - } - deployment = armresources.Deployment{ - Properties: &armresources.DeploymentProperties{ - Template: template, - Parameters: params, - Mode: to.Ptr(armresources.DeploymentModeIncremental), - }, - } - deploymentExtend, err = testutil.CreateDeployment(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName, "ContainerService_Create", &deployment) - testsuite.Require().NoError(err) - testsuite.resourceUri = deploymentExtend.Properties.Outputs.(map[string]interface{})["resourceUri"].(map[string]interface{})["value"].(string) -} - -// Microsoft.Insights/dataCollectionRules -func (testsuite *DatacollectionrulesTestSuite) TestDatacollectionrule() { - associationName := "myAssociation" - var dataCollectionRuleId string - var err error - // From step DataCollectionRules_Create - fmt.Println("Call operation: DataCollectionRules_Create") - dataCollectionRulesClient, err := armmonitor.NewDataCollectionRulesClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - dataCollectionRulesClientCreateResponse, err := dataCollectionRulesClient.Create(testsuite.ctx, testsuite.resourceGroupName, testsuite.dataCollectionRuleName, &armmonitor.DataCollectionRulesClientCreateOptions{ - Body: &armmonitor.DataCollectionRuleResource{ - Location: to.Ptr(testsuite.location), - Properties: &armmonitor.DataCollectionRuleResourceProperties{ - DataFlows: []*armmonitor.DataFlow{ - { - Destinations: []*string{ - to.Ptr("centralWorkspace")}, - Streams: []*armmonitor.KnownDataFlowStreams{ - to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftSyslog)}, - }}, - DataSources: &armmonitor.DataCollectionRuleDataSources{ - PerformanceCounters: []*armmonitor.PerfCounterDataSource{ - { - Name: to.Ptr("cloudTeamCoreCounters"), - CounterSpecifiers: []*string{ - to.Ptr("\\Processor(_Total)\\% Processor Time"), - to.Ptr("\\Memory\\Committed Bytes"), - to.Ptr("\\LogicalDisk(_Total)\\Free Megabytes"), - to.Ptr("\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")}, - SamplingFrequencyInSeconds: to.Ptr[int32](15), - Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - }, - { - Name: to.Ptr("appTeamExtraCounters"), - CounterSpecifiers: []*string{ - to.Ptr("\\Process(_Total)\\Thread Count")}, - SamplingFrequencyInSeconds: to.Ptr[int32](30), - Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - }}, - Syslog: []*armmonitor.SyslogDataSource{ - { - Name: to.Ptr("cronSyslog"), - FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesCron)}, - LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsDebug), - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - }, - { - Name: to.Ptr("syslogBase"), - FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesSyslog)}, - LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsAlert), - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - }}, - }, - Destinations: &armmonitor.DataCollectionRuleDestinations{ - LogAnalytics: []*armmonitor.LogAnalyticsDestination{ - { - Name: to.Ptr("centralWorkspace"), - WorkspaceResourceID: to.Ptr(testsuite.workspaceId), - }}, - }, - }, - }, - }) - testsuite.Require().NoError(err) - dataCollectionRuleId = *dataCollectionRulesClientCreateResponse.ID - - // From step DataCollectionRules_ListBySubscription - fmt.Println("Call operation: DataCollectionRules_ListBySubscription") - dataCollectionRulesClientNewListBySubscriptionPager := dataCollectionRulesClient.NewListBySubscriptionPager(nil) - for dataCollectionRulesClientNewListBySubscriptionPager.More() { - _, err := dataCollectionRulesClientNewListBySubscriptionPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step DataCollectionRules_ListByResourceGroup - fmt.Println("Call operation: DataCollectionRules_ListByResourceGroup") - dataCollectionRulesClientNewListByResourceGroupPager := dataCollectionRulesClient.NewListByResourceGroupPager(testsuite.resourceGroupName, nil) - for dataCollectionRulesClientNewListByResourceGroupPager.More() { - _, err := dataCollectionRulesClientNewListByResourceGroupPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step DataCollectionRules_Get - fmt.Println("Call operation: DataCollectionRules_Get") - _, err = dataCollectionRulesClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.dataCollectionRuleName, nil) - testsuite.Require().NoError(err) - - // From step DataCollectionRules_Update - fmt.Println("Call operation: DataCollectionRules_Update") - _, err = dataCollectionRulesClient.Update(testsuite.ctx, testsuite.resourceGroupName, testsuite.dataCollectionRuleName, &armmonitor.DataCollectionRulesClientUpdateOptions{ - Body: &armmonitor.ResourceForUpdate{ - Tags: map[string]*string{ - "tag1": to.Ptr("A"), - "tag2": to.Ptr("B"), - "tag3": to.Ptr("C"), - }, - }, - }) - testsuite.Require().NoError(err) - - // From step DataCollectionRuleAssociations_Create - fmt.Println("Call operation: DataCollectionRuleAssociations_Create") - dataCollectionRuleAssociationsClient, err := armmonitor.NewDataCollectionRuleAssociationsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - _, err = dataCollectionRuleAssociationsClient.Create(testsuite.ctx, testsuite.resourceUri, associationName, &armmonitor.DataCollectionRuleAssociationsClientCreateOptions{ - Body: &armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ - Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - DataCollectionRuleID: to.Ptr(dataCollectionRuleId), - }, - }, - }) - testsuite.Require().NoError(err) - - // From step DataCollectionRuleAssociations_ListByResource - fmt.Println("Call operation: DataCollectionRuleAssociations_ListByResource") - dataCollectionRuleAssociationsClientNewListByResourcePager := dataCollectionRuleAssociationsClient.NewListByResourcePager(testsuite.resourceUri, nil) - for dataCollectionRuleAssociationsClientNewListByResourcePager.More() { - _, err := dataCollectionRuleAssociationsClientNewListByResourcePager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step DataCollectionRuleAssociations_ListByRule - fmt.Println("Call operation: DataCollectionRuleAssociations_ListByRule") - dataCollectionRuleAssociationsClientNewListByRulePager := dataCollectionRuleAssociationsClient.NewListByRulePager(testsuite.resourceGroupName, testsuite.dataCollectionRuleName, nil) - for dataCollectionRuleAssociationsClientNewListByRulePager.More() { - _, err := dataCollectionRuleAssociationsClientNewListByRulePager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step DataCollectionRuleAssociations_Get - fmt.Println("Call operation: DataCollectionRuleAssociations_Get") - _, err = dataCollectionRuleAssociationsClient.Get(testsuite.ctx, testsuite.resourceUri, associationName, nil) - testsuite.Require().NoError(err) - - // From step DataCollectionRuleAssociations_Delete - fmt.Println("Call operation: DataCollectionRuleAssociations_Delete") - _, err = dataCollectionRuleAssociationsClient.Delete(testsuite.ctx, testsuite.resourceUri, associationName, nil) - testsuite.Require().NoError(err) - - // From step DataCollectionRules_Delete - fmt.Println("Call operation: DataCollectionRules_Delete") - _, err = dataCollectionRulesClient.Delete(testsuite.ctx, testsuite.resourceGroupName, testsuite.dataCollectionRuleName, nil) - testsuite.Require().NoError(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 63def024c563..2d19e2df51f6 100644 --- a/sdk/resourcemanager/monitor/armmonitor/go.mod +++ b/sdk/resourcemanager/monitor/armmonitor/go.mod @@ -2,28 +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.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 - github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 - github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 - github.com/stretchr/testify v1.7.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.7.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/dnaeon/go-vcr v1.1.0 // indirect - github.com/golang-jwt/jwt/v4 v4.4.2 // 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 - github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect golang.org/x/text v0.7.0 // indirect - gopkg.in/yaml.v2 v2.4.0 // 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 b0f97586a165..b6bd7eaad1ba 100644 --- a/sdk/resourcemanager/monitor/armmonitor/go.sum +++ b/sdk/resourcemanager/monitor/armmonitor/go.sum @@ -1,47 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 h1:t/W5MYAuQy81cvM8VUNfRLzhtKpXhVUAN7Cd7KVbTyc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0/go.mod h1:NBanQUfSWiWn3QEpWDTCU0IjBECKOYvl2R8xdRtMtiM= github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 h1:mLY+pNLjCUeKhgnAJWAKhEUQM+RJQo2H1fuGSw1Ky1E= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2/go.mod h1:FbdwsQ2EzwvXxOPcMFYO8ogEc9uMMIj3YkmCdXdAFmk= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 h1:ECsQtyERDVz3NP3kvDOTLvbQhqWp/x9EsGKtb4ogUr8= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0/go.mod h1:s1tW/At+xHqjNFvWU4G0c0Qv33KOhvbGNj0RCTQDV8s= -github.com/AzureAD/microsoft-authentication-library-for-go v0.7.0 h1:VgSJlZH5u0k2qxSpqyghcFQKmvYckj46uymKK5XzkBM= -github.com/AzureAD/microsoft-authentication-library-for-go v0.7.0/go.mod h1:BDJ5qMFKx9DugEg3+uQSDCdbYPr5s9vBTrL9P8TpqOU= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= -github.com/golang-jwt/jwt/v4 v4.4.2 h1:rcc4lwaZgFMCZ5jxF9ABolDcIHdBytAFgqFPbSJQAYs= -github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -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/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= -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/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -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.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 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/logprofiles_live_test.go b/sdk/resourcemanager/monitor/armmonitor/logprofiles_live_test.go deleted file mode 100644 index d5fa3c32059b..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/logprofiles_live_test.go +++ /dev/null @@ -1,182 +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" - "fmt" - "testing" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/testutil" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" - "github.com/stretchr/testify/suite" -) - -type LogprofilesTestSuite struct { - suite.Suite - - ctx context.Context - cred azcore.TokenCredential - options *arm.ClientOptions - storageAccountId string - storageAccountName string - location string - resourceGroupName string - subscriptionId string -} - -func (testsuite *LogprofilesTestSuite) SetupSuite() { - testutil.StartRecording(testsuite.T(), "sdk/resourcemanager/monitor/armmonitor/testdata") - testsuite.ctx = context.Background() - testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T()) - testsuite.storageAccountName = "monitorsana" - testsuite.location = testutil.GetEnv("LOCATION", "eastus") - testsuite.resourceGroupName = testutil.GetEnv("RESOURCE_GROUP_NAME", "scenarioTestTempGroup") - testsuite.subscriptionId = testutil.GetEnv("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - - resourceGroup, _, err := testutil.CreateResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.location) - testsuite.Require().NoError(err) - testsuite.resourceGroupName = *resourceGroup.Name - testsuite.Prepare() -} - -func (testsuite *LogprofilesTestSuite) TearDownSuite() { - _, err := testutil.DeleteResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName) - testsuite.Require().NoError(err) - testutil.StopRecording(testsuite.T()) -} - -func TestLogprofilesTestSuite(t *testing.T) { - suite.Run(t, new(LogprofilesTestSuite)) -} - -func (testsuite *LogprofilesTestSuite) Prepare() { - var err error - // From step StorageAccount_Create - template := map[string]interface{}{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", - "contentVersion": "1.0.0.0", - "outputs": map[string]interface{}{ - "storageAccountId": map[string]interface{}{ - "type": "string", - "value": "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]", - }, - }, - "parameters": map[string]interface{}{ - "storageAccountName": map[string]interface{}{ - "type": "string", - "defaultValue": "$(storageAccountName)", - }, - }, - "resources": []interface{}{ - map[string]interface{}{ - "name": "[parameters('storageAccountName')]", - "type": "Microsoft.Storage/storageAccounts", - "apiVersion": "2022-05-01", - "kind": "StorageV2", - "location": "eastus", - "properties": map[string]interface{}{ - "accessTier": "Hot", - "allowBlobPublicAccess": true, - "allowCrossTenantReplication": true, - "allowSharedKeyAccess": true, - "defaultToOAuthAuthentication": false, - "dnsEndpointType": "Standard", - "encryption": map[string]interface{}{ - "keySource": "Microsoft.Storage", - "requireInfrastructureEncryption": false, - "services": map[string]interface{}{ - "blob": map[string]interface{}{ - "enabled": true, - "keyType": "Account", - }, - "file": map[string]interface{}{ - "enabled": true, - "keyType": "Account", - }, - }, - }, - "minimumTlsVersion": "TLS1_2", - "networkAcls": map[string]interface{}{ - "bypass": "AzureServices", - "defaultAction": "Allow", - "ipRules": []interface{}{}, - "virtualNetworkRules": []interface{}{}, - }, - "publicNetworkAccess": "Enabled", - "supportsHttpsTrafficOnly": true, - }, - "sku": map[string]interface{}{ - "name": "Standard_RAGRS", - "tier": "Standard", - }, - }, - }, - "variables": map[string]interface{}{}, - } - params := map[string]interface{}{ - "storageAccountName": map[string]interface{}{"value": testsuite.storageAccountName}, - } - deployment := armresources.Deployment{ - Properties: &armresources.DeploymentProperties{ - Template: template, - Parameters: params, - Mode: to.Ptr(armresources.DeploymentModeIncremental), - }, - } - deploymentExtend, err := testutil.CreateDeployment(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName, "StorageAccount_Create", &deployment) - testsuite.Require().NoError(err) - testsuite.storageAccountId = deploymentExtend.Properties.Outputs.(map[string]interface{})["storageAccountId"].(map[string]interface{})["value"].(string) -} - -// Microsoft.Insights/logprofiles -func (testsuite *LogprofilesTestSuite) TestLogprofiles() { - logProfileName := "logprofilena" - var err error - // From step LogProfiles_CreateOrUpdate - fmt.Println("Call operation: LogProfiles_CreateOrUpdate") - logProfilesClient, err := armmonitor.NewLogProfilesClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - _, err = logProfilesClient.CreateOrUpdate(testsuite.ctx, logProfileName, armmonitor.LogProfileResource{ - Location: to.Ptr(testsuite.location), - 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), - }, - StorageAccountID: to.Ptr(testsuite.storageAccountId), - }, - }, nil) - testsuite.Require().NoError(err) - - // From step LogProfiles_List - fmt.Println("Call operation: LogProfiles_List") - logProfilesClientNewListPager := logProfilesClient.NewListPager(nil) - for logProfilesClientNewListPager.More() { - _, err := logProfilesClientNewListPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step LogProfiles_Delete - fmt.Println("Call operation: LogProfiles_Delete") - _, err = logProfilesClient.Delete(testsuite.ctx, logProfileName, nil) - testsuite.Require().NoError(err) -} 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/metricalerts_live_test.go b/sdk/resourcemanager/monitor/armmonitor/metricalerts_live_test.go deleted file mode 100644 index af82f082f365..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metricalerts_live_test.go +++ /dev/null @@ -1,387 +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" - "fmt" - "testing" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/testutil" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" - "github.com/stretchr/testify/suite" -) - -type MetricalertsTestSuite struct { - suite.Suite - - ctx context.Context - cred azcore.TokenCredential - options *arm.ClientOptions - ruleName string - subnetId string - virtualMachineId string - vnicId string - adminPassword string - location string - resourceGroupName string - subscriptionId string -} - -func (testsuite *MetricalertsTestSuite) SetupSuite() { - testutil.StartRecording(testsuite.T(), "sdk/resourcemanager/monitor/armmonitor/testdata") - testsuite.ctx = context.Background() - testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T()) - testsuite.ruleName = testutil.GenerateAlphaNumericID(testsuite.T(), "metricalertna", 6) - testsuite.adminPassword = testutil.GetEnv("ADMIN_PASSWORD", "000000000000") - testsuite.location = testutil.GetEnv("LOCATION", "eastus") - testsuite.resourceGroupName = testutil.GetEnv("RESOURCE_GROUP_NAME", "scenarioTestTempGroup") - testsuite.subscriptionId = testutil.GetEnv("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - - resourceGroup, _, err := testutil.CreateResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.location) - testsuite.Require().NoError(err) - testsuite.resourceGroupName = *resourceGroup.Name - testsuite.Prepare() -} - -func (testsuite *MetricalertsTestSuite) TearDownSuite() { - _, err := testutil.DeleteResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName) - testsuite.Require().NoError(err) - testutil.StopRecording(testsuite.T()) -} - -func TestMetricalertsTestSuite(t *testing.T) { - suite.Run(t, new(MetricalertsTestSuite)) -} - -func (testsuite *MetricalertsTestSuite) Prepare() { - var err error - // From step VirtualNetwork_Create - template := map[string]interface{}{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", - "contentVersion": "1.0.0.0", - "outputs": map[string]interface{}{ - "subnetId": map[string]interface{}{ - "type": "string", - "value": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('virtualNetworksName'), 'vmsssubnet')]", - }, - }, - "parameters": map[string]interface{}{ - "location": map[string]interface{}{ - "type": "string", - "defaultValue": "$(location)", - }, - "virtualNetworksName": map[string]interface{}{ - "type": "string", - "defaultValue": "vmssvnet", - }, - }, - "resources": []interface{}{ - map[string]interface{}{ - "name": "[parameters('virtualNetworksName')]", - "type": "Microsoft.Network/virtualNetworks", - "apiVersion": "2021-05-01", - "location": "[parameters('location')]", - "properties": map[string]interface{}{ - "addressSpace": map[string]interface{}{ - "addressPrefixes": []interface{}{ - "10.0.0.0/16", - }, - }, - "subnets": []interface{}{ - map[string]interface{}{ - "name": "vmsssubnet", - "properties": map[string]interface{}{ - "addressPrefix": "10.0.0.0/24", - }, - }, - }, - }, - "tags": map[string]interface{}{}, - }, - }, - } - params := map[string]interface{}{ - "location": map[string]interface{}{"value": testsuite.location}, - } - deployment := armresources.Deployment{ - Properties: &armresources.DeploymentProperties{ - Template: template, - Parameters: params, - Mode: to.Ptr(armresources.DeploymentModeIncremental), - }, - } - deploymentExtend, err := testutil.CreateDeployment(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName, "VirtualNetwork_Create", &deployment) - testsuite.Require().NoError(err) - testsuite.subnetId = deploymentExtend.Properties.Outputs.(map[string]interface{})["subnetId"].(map[string]interface{})["value"].(string) - - // From step NetworkInterface_Create - template = map[string]interface{}{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", - "contentVersion": "1.0.0.0", - "outputs": map[string]interface{}{ - "vnicId": map[string]interface{}{ - "type": "string", - "value": "[resourceId('Microsoft.Network/networkInterfaces', 'vmnic')]", - }, - }, - "parameters": map[string]interface{}{ - "location": map[string]interface{}{ - "type": "string", - "defaultValue": "$(location)", - }, - "subnetId": map[string]interface{}{ - "type": "string", - "defaultValue": "$(subnetId)", - }, - }, - "resources": []interface{}{ - map[string]interface{}{ - "name": "vmnic", - "type": "Microsoft.Network/networkInterfaces", - "apiVersion": "2021-08-01", - "location": "[parameters('location')]", - "properties": map[string]interface{}{ - "ipConfigurations": []interface{}{ - map[string]interface{}{ - "name": "Ipv4config", - "properties": map[string]interface{}{ - "subnet": map[string]interface{}{ - "id": "[parameters('subnetId')]", - }, - }, - }, - }, - }, - "tags": map[string]interface{}{}, - }, - }, - } - params = map[string]interface{}{ - "location": map[string]interface{}{"value": testsuite.location}, - "subnetId": map[string]interface{}{"value": testsuite.subnetId}, - } - deployment = armresources.Deployment{ - Properties: &armresources.DeploymentProperties{ - Template: template, - Parameters: params, - Mode: to.Ptr(armresources.DeploymentModeIncremental), - }, - } - deploymentExtend, err = testutil.CreateDeployment(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName, "NetworkInterface_Create", &deployment) - testsuite.Require().NoError(err) - testsuite.vnicId = deploymentExtend.Properties.Outputs.(map[string]interface{})["vnicId"].(map[string]interface{})["value"].(string) - - // From step VirtualMachine_Create - template = map[string]interface{}{ - "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", - "contentVersion": "1.0.0.0", - "outputs": map[string]interface{}{ - "virtualMachineId": map[string]interface{}{ - "type": "string", - "value": "[resourceId('Microsoft.Compute/virtualMachines', 'scenariovm')]", - }, - }, - "parameters": map[string]interface{}{ - "adminPassword": map[string]interface{}{ - "type": "securestring", - "defaultValue": "$(adminPassword)", - }, - "location": map[string]interface{}{ - "type": "string", - "defaultValue": "$(location)", - }, - "vnicId": map[string]interface{}{ - "type": "string", - "defaultValue": "$(vnicId)", - }, - }, - "resources": []interface{}{ - map[string]interface{}{ - "name": "scenariovm", - "type": "Microsoft.Compute/virtualMachines", - "apiVersion": "2022-03-01", - "location": "[parameters('location')]", - "properties": map[string]interface{}{ - "diagnosticsProfile": map[string]interface{}{ - "bootDiagnostics": map[string]interface{}{ - "enabled": true, - }, - }, - "hardwareProfile": map[string]interface{}{ - "vmSize": "Standard_DS1_v2", - }, - "networkProfile": map[string]interface{}{ - "networkInterfaces": []interface{}{ - map[string]interface{}{ - "id": "[parameters('vnicId')]", - "properties": map[string]interface{}{ - "deleteOption": "Detach", - "primary": true, - }, - }, - }, - }, - "osProfile": map[string]interface{}{ - "adminPassword": "[parameters('adminPassword')]", - "adminUsername": "azureuser", - "allowExtensionOperations": true, - "computerName": "scenariovm", - "secrets": []interface{}{}, - "windowsConfiguration": map[string]interface{}{ - "enableAutomaticUpdates": true, - "patchSettings": map[string]interface{}{ - "assessmentMode": "ImageDefault", - "enableHotpatching": false, - "patchMode": "AutomaticByOS", - }, - "provisionVMAgent": true, - }, - }, - "storageProfile": map[string]interface{}{ - "dataDisks": []interface{}{}, - "imageReference": map[string]interface{}{ - "offer": "WindowsServer", - "publisher": "MicrosoftWindowsServer", - "sku": "2019-Datacenter", - "version": "latest", - }, - "osDisk": map[string]interface{}{ - "name": "[concat('scenariovm', 'osDisk')]", - "caching": "ReadWrite", - "createOption": "FromImage", - "deleteOption": "Delete", - "diskSizeGB": float64(127), - "managedDisk": map[string]interface{}{ - "storageAccountType": "Premium_LRS", - }, - "osType": "Windows", - }, - }, - }, - "zones": []interface{}{ - "1", - }, - }, - }, - "variables": map[string]interface{}{}, - } - params = map[string]interface{}{ - "adminPassword": map[string]interface{}{"value": testsuite.adminPassword}, - "location": map[string]interface{}{"value": testsuite.location}, - "vnicId": map[string]interface{}{"value": testsuite.vnicId}, - } - deployment = armresources.Deployment{ - Properties: &armresources.DeploymentProperties{ - Template: template, - Parameters: params, - Mode: to.Ptr(armresources.DeploymentModeIncremental), - }, - } - deploymentExtend, err = testutil.CreateDeployment(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName, "VirtualMachine_Create", &deployment) - testsuite.Require().NoError(err) - testsuite.virtualMachineId = deploymentExtend.Properties.Outputs.(map[string]interface{})["virtualMachineId"].(map[string]interface{})["value"].(string) -} - -// Microsoft.Insights/metricAlerts -func (testsuite *MetricalertsTestSuite) TestMetricalert() { - var statusName string - var err error - // From step MetricAlerts_Create - fmt.Println("Call operation: MetricAlerts_CreateOrUpdate") - metricAlertsClient, err := armmonitor.NewMetricAlertsClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - _, err = metricAlertsClient.CreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.ruleName, armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("This is the description of the rule1"), - 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), - 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(testsuite.virtualMachineId)}, - Severity: to.Ptr[int32](3), - TargetResourceRegion: to.Ptr(testsuite.location), - TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - WindowSize: to.Ptr("PT15M"), - }, - }, nil) - testsuite.Require().NoError(err) - - // From step MetricAlerts_ListBySubscription - fmt.Println("Call operation: MetricAlerts_ListBySubscription") - metricAlertsClientNewListBySubscriptionPager := metricAlertsClient.NewListBySubscriptionPager(nil) - for metricAlertsClientNewListBySubscriptionPager.More() { - _, err := metricAlertsClientNewListBySubscriptionPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step MetricAlerts_ListByResourceGroup - fmt.Println("Call operation: MetricAlerts_ListByResourceGroup") - metricAlertsClientNewListByResourceGroupPager := metricAlertsClient.NewListByResourceGroupPager(testsuite.resourceGroupName, nil) - for metricAlertsClientNewListByResourceGroupPager.More() { - _, err := metricAlertsClientNewListByResourceGroupPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step MetricAlerts_Get - fmt.Println("Call operation: MetricAlerts_Get") - _, err = metricAlertsClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.ruleName, nil) - testsuite.Require().NoError(err) - - // From step MetricAlerts_Update - fmt.Println("Call operation: MetricAlerts_Update") - _, err = metricAlertsClient.Update(testsuite.ctx, testsuite.resourceGroupName, testsuite.ruleName, armmonitor.MetricAlertResourcePatch{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - }, - }, nil) - testsuite.Require().NoError(err) - - // From step MetricAlertsStatus_List - fmt.Println("Call operation: MetricAlerts_List") - metricAlertsStatusClient, err := armmonitor.NewMetricAlertsStatusClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - metricAlertsStatusClientListResponse, err := metricAlertsStatusClient.List(testsuite.ctx, testsuite.resourceGroupName, testsuite.ruleName, nil) - testsuite.Require().NoError(err) - statusName = *metricAlertsStatusClientListResponse.Value[0].Name - - // From step MetricAlertsStatus_ListByName - fmt.Println("Call operation: MetricAlerts_ListByName") - _, err = metricAlertsStatusClient.ListByName(testsuite.ctx, testsuite.resourceGroupName, testsuite.ruleName, statusName, nil) - testsuite.Require().NoError(err) - - // From step MetricAlerts_Delete - fmt.Println("Call operation: MetricAlerts_Delete") - _, err = metricAlertsClient.Delete(testsuite.ctx, testsuite.resourceGroupName, testsuite.ruleName, nil) - testsuite.Require().NoError(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..88dddc1e48c5 100644 --- a/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client.go @@ -11,6 +11,7 @@ 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" @@ -18,20 +19,23 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" + "net/url" "strings" ) // MetricDefinitionsClient contains the methods for the MetricDefinitions group. // Don't use this type directly, use NewMetricDefinitionsClient() instead. type MetricDefinitionsClient struct { - host string - pl runtime.Pipeline + host string + subscriptionID string + pl runtime.Pipeline } // 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. -func NewMetricDefinitionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*MetricDefinitionsClient, error) { +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewMetricDefinitionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MetricDefinitionsClient, error) { if options == nil { options = &arm.ClientOptions{} } @@ -44,16 +48,19 @@ func NewMetricDefinitionsClient(credential azcore.TokenCredential, options *arm. return nil, err } client := &MetricDefinitionsClient{ - host: ep, - pl: pl, + subscriptionID: subscriptionID, + host: ep, + pl: pl, } return client, nil } // 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. +// +// Generated from API version 2021-05-01 +// - resourceURI - The identifier of the resource. +// - options - MetricDefinitionsClientListOptions contains the optional parameters for the MetricDefinitionsClient.NewListPager +// method. func (client *MetricDefinitionsClient) NewListPager(resourceURI string, options *MetricDefinitionsClientListOptions) *runtime.Pager[MetricDefinitionsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[MetricDefinitionsClientListResponse]{ More: func(page MetricDefinitionsClientListResponse) bool { @@ -85,7 +92,7 @@ func (client *MetricDefinitionsClient) listCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-01-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.Metricnamespace != nil { reqQP.Set("metricnamespace", *options.Metricnamespace) } @@ -102,3 +109,62 @@ func (client *MetricDefinitionsClient) listHandleResponse(resp *http.Response) ( } return result, nil } + +// NewListAtSubscriptionScopePager - Lists the metric definitions for the subscription. +// +// Generated from API version 2021-05-01 +// - region - The region where the metrics you want reside. +// - options - MetricDefinitionsClientListAtSubscriptionScopeOptions contains the optional parameters for the MetricDefinitionsClient.NewListAtSubscriptionScopePager +// method. +func (client *MetricDefinitionsClient) NewListAtSubscriptionScopePager(region string, options *MetricDefinitionsClientListAtSubscriptionScopeOptions) *runtime.Pager[MetricDefinitionsClientListAtSubscriptionScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[MetricDefinitionsClientListAtSubscriptionScopeResponse]{ + More: func(page MetricDefinitionsClientListAtSubscriptionScopeResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *MetricDefinitionsClientListAtSubscriptionScopeResponse) (MetricDefinitionsClientListAtSubscriptionScopeResponse, error) { + req, err := client.listAtSubscriptionScopeCreateRequest(ctx, region, options) + if err != nil { + return MetricDefinitionsClientListAtSubscriptionScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return MetricDefinitionsClientListAtSubscriptionScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return MetricDefinitionsClientListAtSubscriptionScopeResponse{}, runtime.NewResponseError(resp) + } + return client.listAtSubscriptionScopeHandleResponse(resp) + }, + }) +} + +// listAtSubscriptionScopeCreateRequest creates the ListAtSubscriptionScope request. +func (client *MetricDefinitionsClient) listAtSubscriptionScopeCreateRequest(ctx context.Context, region string, options *MetricDefinitionsClientListAtSubscriptionScopeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricDefinitions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + reqQP.Set("region", region) + if options != nil && options.Metricnamespace != nil { + reqQP.Set("metricnamespace", *options.Metricnamespace) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAtSubscriptionScopeHandleResponse handles the ListAtSubscriptionScope response. +func (client *MetricDefinitionsClient) listAtSubscriptionScopeHandleResponse(resp *http.Response) (MetricDefinitionsClientListAtSubscriptionScopeResponse, error) { + result := MetricDefinitionsClientListAtSubscriptionScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionScopeMetricDefinitionCollection); err != nil { + return MetricDefinitionsClientListAtSubscriptionScopeResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client_example_test.go deleted file mode 100644 index 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..e7ceb2c3c61f 100644 --- a/sdk/resourcemanager/monitor/armmonitor/metrics_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/metrics_client.go @@ -11,6 +11,7 @@ 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" @@ -18,6 +19,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" + "net/url" "strconv" "strings" ) @@ -25,14 +27,16 @@ import ( // MetricsClient contains the methods for the Metrics group. // Don't use this type directly, use NewMetricsClient() instead. type MetricsClient struct { - host string - pl runtime.Pipeline + host string + subscriptionID string + pl runtime.Pipeline } // 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. -func NewMetricsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*MetricsClient, error) { +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewMetricsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MetricsClient, error) { if options == nil { options = &arm.ClientOptions{} } @@ -45,17 +49,19 @@ func NewMetricsClient(credential azcore.TokenCredential, options *arm.ClientOpti return nil, err } client := &MetricsClient{ - host: ep, - pl: pl, + subscriptionID: subscriptionID, + host: ep, + pl: pl, } return client, nil } // List - Lists the metric values for a resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2018-01-01 -// resourceURI - The identifier of the resource. -// options - MetricsClientListOptions contains the optional parameters for the MetricsClient.List method. +// +// Generated from API version 2021-05-01 +// - resourceURI - The identifier of the resource. +// - options - MetricsClientListOptions contains the optional parameters for the MetricsClient.List method. func (client *MetricsClient) List(ctx context.Context, resourceURI string, options *MetricsClientListOptions) (MetricsClientListResponse, error) { req, err := client.listCreateRequest(ctx, resourceURI, options) if err != nil { @@ -104,10 +110,16 @@ func (client *MetricsClient) listCreateRequest(ctx context.Context, resourceURI if options != nil && options.ResultType != nil { reqQP.Set("resultType", string(*options.ResultType)) } - reqQP.Set("api-version", "2018-01-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.Metricnamespace != nil { reqQP.Set("metricnamespace", *options.Metricnamespace) } + if options != nil && options.AutoAdjustTimegrain != nil { + reqQP.Set("AutoAdjustTimegrain", strconv.FormatBool(*options.AutoAdjustTimegrain)) + } + if options != nil && options.ValidateDimensions != nil { + reqQP.Set("ValidateDimensions", strconv.FormatBool(*options.ValidateDimensions)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -121,3 +133,173 @@ func (client *MetricsClient) listHandleResponse(resp *http.Response) (MetricsCli } return result, nil } + +// ListAtSubscriptionScope - Lists the metric data for a subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-05-01 +// - region - The region where the metrics you want reside. +// - options - MetricsClientListAtSubscriptionScopeOptions contains the optional parameters for the MetricsClient.ListAtSubscriptionScope +// method. +func (client *MetricsClient) ListAtSubscriptionScope(ctx context.Context, region string, options *MetricsClientListAtSubscriptionScopeOptions) (MetricsClientListAtSubscriptionScopeResponse, error) { + req, err := client.listAtSubscriptionScopeCreateRequest(ctx, region, options) + if err != nil { + return MetricsClientListAtSubscriptionScopeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return MetricsClientListAtSubscriptionScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return MetricsClientListAtSubscriptionScopeResponse{}, runtime.NewResponseError(resp) + } + return client.listAtSubscriptionScopeHandleResponse(resp) +} + +// listAtSubscriptionScopeCreateRequest creates the ListAtSubscriptionScope request. +func (client *MetricsClient) listAtSubscriptionScopeCreateRequest(ctx context.Context, region string, options *MetricsClientListAtSubscriptionScopeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metrics" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + reqQP.Set("region", region) + if options != nil && options.Timespan != nil { + reqQP.Set("timespan", *options.Timespan) + } + if options != nil && options.Interval != nil { + reqQP.Set("interval", *options.Interval) + } + if options != nil && options.Metricnames != nil { + reqQP.Set("metricnames", *options.Metricnames) + } + if options != nil && options.Aggregation != nil { + reqQP.Set("aggregation", *options.Aggregation) + } + if options != nil && options.Top != nil { + reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Orderby != nil { + reqQP.Set("orderby", *options.Orderby) + } + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.ResultType != nil { + reqQP.Set("resultType", string(*options.ResultType)) + } + if options != nil && options.Metricnamespace != nil { + reqQP.Set("metricnamespace", *options.Metricnamespace) + } + if options != nil && options.AutoAdjustTimegrain != nil { + reqQP.Set("AutoAdjustTimegrain", strconv.FormatBool(*options.AutoAdjustTimegrain)) + } + if options != nil && options.ValidateDimensions != nil { + reqQP.Set("ValidateDimensions", strconv.FormatBool(*options.ValidateDimensions)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAtSubscriptionScopeHandleResponse handles the ListAtSubscriptionScope response. +func (client *MetricsClient) listAtSubscriptionScopeHandleResponse(resp *http.Response) (MetricsClientListAtSubscriptionScopeResponse, error) { + result := MetricsClientListAtSubscriptionScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionScopeMetricResponse); err != nil { + return MetricsClientListAtSubscriptionScopeResponse{}, err + } + return result, nil +} + +// ListAtSubscriptionScopePost - Lists the metric data for a subscription. Parameters can be specified on either query params +// or the body. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-05-01 +// - region - The region where the metrics you want reside. +// - options - MetricsClientListAtSubscriptionScopePostOptions contains the optional parameters for the MetricsClient.ListAtSubscriptionScopePost +// method. +func (client *MetricsClient) ListAtSubscriptionScopePost(ctx context.Context, region string, options *MetricsClientListAtSubscriptionScopePostOptions) (MetricsClientListAtSubscriptionScopePostResponse, error) { + req, err := client.listAtSubscriptionScopePostCreateRequest(ctx, region, options) + if err != nil { + return MetricsClientListAtSubscriptionScopePostResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return MetricsClientListAtSubscriptionScopePostResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return MetricsClientListAtSubscriptionScopePostResponse{}, runtime.NewResponseError(resp) + } + return client.listAtSubscriptionScopePostHandleResponse(resp) +} + +// listAtSubscriptionScopePostCreateRequest creates the ListAtSubscriptionScopePost request. +func (client *MetricsClient) listAtSubscriptionScopePostCreateRequest(ctx context.Context, region string, options *MetricsClientListAtSubscriptionScopePostOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metrics" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + reqQP.Set("region", region) + if options != nil && options.Timespan != nil { + reqQP.Set("timespan", *options.Timespan) + } + if options != nil && options.Interval != nil { + reqQP.Set("interval", *options.Interval) + } + if options != nil && options.Metricnames != nil { + reqQP.Set("metricnames", *options.Metricnames) + } + if options != nil && options.Aggregation != nil { + reqQP.Set("aggregation", *options.Aggregation) + } + if options != nil && options.Top != nil { + reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Orderby != nil { + reqQP.Set("orderby", *options.Orderby) + } + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.ResultType != nil { + reqQP.Set("resultType", string(*options.ResultType)) + } + if options != nil && options.Metricnamespace != nil { + reqQP.Set("metricnamespace", *options.Metricnamespace) + } + if options != nil && options.AutoAdjustTimegrain != nil { + reqQP.Set("AutoAdjustTimegrain", strconv.FormatBool(*options.AutoAdjustTimegrain)) + } + if options != nil && options.ValidateDimensions != nil { + reqQP.Set("ValidateDimensions", strconv.FormatBool(*options.ValidateDimensions)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Body != nil { + return req, runtime.MarshalAsJSON(req, *options.Body) + } + return req, nil +} + +// listAtSubscriptionScopePostHandleResponse handles the ListAtSubscriptionScopePost response. +func (client *MetricsClient) listAtSubscriptionScopePostHandleResponse(resp *http.Response) (MetricsClientListAtSubscriptionScopePostResponse, error) { + result := MetricsClientListAtSubscriptionScopePostResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionScopeMetricResponse); err != nil { + return MetricsClientListAtSubscriptionScopePostResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/monitor/armmonitor/metrics_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/metrics_client_example_test.go deleted file mode 100644 index 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..36cec6a94331 100644 --- a/sdk/resourcemanager/monitor/armmonitor/models.go +++ b/sdk/resourcemanager/monitor/armmonitor/models.go @@ -131,6 +131,13 @@ type ActionGroupPatch struct { Enabled *bool `json:"enabled,omitempty"` } +// ActionGroupPatchAutoGenerated - A tenant action group for patch operations. +type ActionGroupPatchAutoGenerated struct { + // Indicates whether this tenant action group is enabled. If a tenant action group is not enabled, then none of its actions + // will be activated. + Enabled *bool `json:"enabled,omitempty"` +} + // ActionGroupPatchBody - An action group object for the body of patch operations. type ActionGroupPatchBody struct { // The action group settings for an update operation. @@ -140,6 +147,15 @@ type ActionGroupPatchBody struct { Tags map[string]*string `json:"tags,omitempty"` } +// ActionGroupPatchBodyAutoGenerated - A tenant action group object for the body of patch operations. +type ActionGroupPatchBodyAutoGenerated struct { + // The action group settings for an update operation. + Properties *ActionGroupPatchAutoGenerated `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` +} + // ActionGroupResource - An action group resource. type ActionGroupResource struct { // REQUIRED; Resource location @@ -168,20 +184,6 @@ type ActionGroupsClientBeginCreateNotificationsAtActionGroupResourceLevelOptions ResumeToken string } -// ActionGroupsClientBeginCreateNotificationsAtResourceGroupLevelOptions contains the optional parameters for the ActionGroupsClient.BeginCreateNotificationsAtResourceGroupLevel -// method. -type ActionGroupsClientBeginCreateNotificationsAtResourceGroupLevelOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ActionGroupsClientBeginPostTestNotificationsOptions contains the optional parameters for the ActionGroupsClient.BeginPostTestNotifications -// method. -type ActionGroupsClientBeginPostTestNotificationsOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - // ActionGroupsClientCreateOrUpdateOptions contains the optional parameters for the ActionGroupsClient.CreateOrUpdate method. type ActionGroupsClientCreateOrUpdateOptions struct { // placeholder for future optional parameters @@ -208,25 +210,13 @@ type ActionGroupsClientGetTestNotificationsAtActionGroupResourceLevelOptions str // placeholder for future optional parameters } -// ActionGroupsClientGetTestNotificationsAtResourceGroupLevelOptions contains the optional parameters for the ActionGroupsClient.GetTestNotificationsAtResourceGroupLevel -// method. -type ActionGroupsClientGetTestNotificationsAtResourceGroupLevelOptions struct { - // placeholder for future optional parameters -} - -// ActionGroupsClientGetTestNotificationsOptions contains the optional parameters for the ActionGroupsClient.GetTestNotifications -// method. -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 +280,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 +297,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 +369,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 +488,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 +682,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 @@ -718,6 +708,16 @@ type AzureAppPushReceiver struct { Name *string `json:"name,omitempty"` } +// AzureAppPushReceiverAutoGenerated - The Azure mobile App push notification receiver. +type AzureAppPushReceiverAutoGenerated struct { + // REQUIRED; The email address registered for the Azure mobile app. + EmailAddress *string `json:"emailAddress,omitempty"` + + // REQUIRED; The name of the Azure mobile app push receiver. Names must be unique across all receivers within a tenant action + // group. + Name *string `json:"name,omitempty"` +} + // AzureFunctionReceiver - An azure function receiver. type AzureFunctionReceiver struct { // REQUIRED; The azure resource id of the function app. @@ -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 @@ -1073,13 +1199,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 +1362,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 +1524,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 +1655,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 +1701,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 +1767,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"` @@ -1709,6 +1835,21 @@ type EmailReceiver struct { Status *ReceiverStatus `json:"status,omitempty" azure:"ro"` } +// EmailReceiverAutoGenerated - An email receiver. +type EmailReceiverAutoGenerated struct { + // REQUIRED; The email address of this receiver. + EmailAddress *string `json:"emailAddress,omitempty"` + + // REQUIRED; The name of the email receiver. Names must be unique across all receivers within a tenant action group. + Name *string `json:"name,omitempty"` + + // Indicates whether to use common alert schema. + UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` + + // READ-ONLY; The receiver status of the e-mail. + Status *ReceiverStatus `json:"status,omitempty" azure:"ro"` +} + // EnableRequest - Describes a receiver that should be resubscribed. type EnableRequest struct { // REQUIRED; The name of the receiver to resubscribe. @@ -1727,14 +1868,21 @@ 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"` } -// ErrorContract - Describes the format of Error response. +// ErrorContract - Common error response for all Azure Resource Manager APIs to return error details for failed operations. +// (This also follows the OData error response format.) type ErrorContract struct { + // The error object. + Error *ErrorResponse `json:"error,omitempty"` +} + +// ErrorContractAutoGenerated - Describes the format of Error response. +type ErrorContractAutoGenerated struct { // The error details. Error *ErrorResponseDetails `json:"error,omitempty"` } @@ -1757,6 +1905,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 +1935,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 +1950,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 +1983,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 +2120,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 +2149,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 +2203,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 +2396,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 } @@ -2313,7 +2512,7 @@ type Metric struct { Type *string `json:"type,omitempty"` // REQUIRED; The unit of the metric. - Unit *MetricUnit `json:"unit,omitempty"` + Unit *Unit `json:"unit,omitempty"` // Detailed description of this metric. DisplayDescription *string `json:"displayDescription,omitempty"` @@ -2350,7 +2549,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 +2562,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 +2705,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 +2767,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 +2851,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"` @@ -2716,7 +2915,7 @@ type MetricDefinition struct { // the collection of what aggregation types are supported. SupportedAggregationTypes []*AggregationType `json:"supportedAggregationTypes,omitempty"` - // The unit of the metric. + // the unit of the metric. Unit *MetricUnit `json:"unit,omitempty"` } @@ -2726,9 +2925,16 @@ type MetricDefinitionCollection struct { Value []*MetricDefinition `json:"value,omitempty"` } -// MetricDefinitionsClientListOptions contains the optional parameters for the MetricDefinitionsClient.List method. +// MetricDefinitionsClientListAtSubscriptionScopeOptions contains the optional parameters for the MetricDefinitionsClient.NewListAtSubscriptionScopePager +// method. +type MetricDefinitionsClientListAtSubscriptionScopeOptions struct { + // Metric namespace where the metrics you want reside. + Metricnamespace *string +} + +// MetricDefinitionsClientListOptions contains the optional parameters for the MetricDefinitionsClient.NewListPager method. type MetricDefinitionsClientListOptions struct { - // Metric namespace to query metric definitions for. + // Metric namespace where the metrics you want reside. Metricnamespace *string } @@ -2774,7 +2980,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,27 +3075,127 @@ 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"` +} + +// MetricsClientListAtSubscriptionScopeOptions contains the optional parameters for the MetricsClient.ListAtSubscriptionScope +// method. +type MetricsClientListAtSubscriptionScopeOptions struct { + // The list of aggregation types (comma separated) to retrieve. + Aggregation *string + // When set to true, if the timespan passed in is not supported by this metric, the API will return the result using the closest + // supported timespan. When set to false, an error is returned for invalid + // timespan parameters. Defaults to false. + AutoAdjustTimegrain *bool + // The $filter is used to reduce the set of metric data returned. + // Example: + // Metric contains metadata A, B and C. + // - Return all time series of C where A = a1 and B = b1 or b2 + // $filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘’ + // - Invalid variant: + // $filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘’ or B = ‘b2’ + // This is invalid because the logical or operator cannot separate two different metadata names. + // - Return all time series where A = a1, B = b1 and C = c1: + // $filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’ + // - Return all time series where A = a1 + // $filter=A eq ‘a1’ and B eq ‘’ and C eq ‘’. + Filter *string + // The interval (i.e. timegrain) of the query. + Interval *string + // The names of the metrics (comma separated) to retrieve. + Metricnames *string + // Metric namespace where the metrics you want reside. + Metricnamespace *string + // The aggregation to use for sorting results and the direction of the sort. Only one order can be specified. Examples: sum + // asc. + Orderby *string + // Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details. + ResultType *MetricResultType + // The timespan of the query. It is a string with the following format 'startDateTimeISO/endDateTimeISO'. + Timespan *string + // The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10. + Top *int32 + // When set to false, invalid filter parameter values will be ignored. When set to true, an error is returned for invalid + // filter parameters. Defaults to true. + ValidateDimensions *bool +} + +// MetricsClientListAtSubscriptionScopePostOptions contains the optional parameters for the MetricsClient.ListAtSubscriptionScopePost +// method. +type MetricsClientListAtSubscriptionScopePostOptions struct { + // The list of aggregation types (comma separated) to retrieve. + Aggregation *string + // When set to true, if the timespan passed in is not supported by this metric, the API will return the result using the closest + // supported timespan. When set to false, an error is returned for invalid + // timespan parameters. Defaults to false. + AutoAdjustTimegrain *bool + // Parameters serialized in the body + Body *SubscriptionScopeMetricsRequestBodyParameters + // The $filter is used to reduce the set of metric data returned. + // Example: + // Metric contains metadata A, B and C. + // - Return all time series of C where A = a1 and B = b1 or b2 + // $filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘’ + // - Invalid variant: + // $filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘’ or B = ‘b2’ + // This is invalid because the logical or operator cannot separate two different metadata names. + // - Return all time series where A = a1, B = b1 and C = c1: + // $filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’ + // - Return all time series where A = a1 + // $filter=A eq ‘a1’ and B eq ‘’ and C eq ‘’. + Filter *string + // The interval (i.e. timegrain) of the query. + Interval *string + // The names of the metrics (comma separated) to retrieve. + Metricnames *string + // Metric namespace where the metrics you want reside. + Metricnamespace *string + // The aggregation to use for sorting results and the direction of the sort. Only one order can be specified. Examples: sum + // asc. + Orderby *string + // Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details. + ResultType *MetricResultType + // The timespan of the query. It is a string with the following format 'startDateTimeISO/endDateTimeISO'. + Timespan *string + // The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10. + Top *int32 + // When set to false, invalid filter parameter values will be ignored. When set to true, an error is returned for invalid + // filter parameters. Defaults to true. + ValidateDimensions *bool +} + // MetricsClientListOptions contains the optional parameters for the MetricsClient.List method. type MetricsClientListOptions struct { // The list of aggregation types (comma separated) to retrieve. Aggregation *string - // The $filter is used to reduce the set of metric data returned. Example: Metric contains metadata A, B and C. - Return all - // time series of C where A = a1 and B = b1 or b2 $filter=A eq 'a1' and B eq 'b1' - // or B eq 'b2' and C eq '' - Invalid variant: $filter=A eq 'a1' and B eq 'b1' and C eq '' or B = 'b2' This is invalid because - // the logical or operator cannot separate two different metadata names. - - // Return all time series where A = a1, B = b1 and C = c1: $filter=A eq 'a1' and B eq 'b1' and C eq 'c1' - Return all time - // series where A = a1 $filter=A eq 'a1' and B eq '' and C eq ''. Special case: - // When dimension name or dimension value uses round brackets. Eg: When dimension name is dim (test) 1 Instead of using $filter= - // "dim (test) 1 eq '' " use $filter= "dim %2528test%2529 1 eq '' " When - // dimension name is dim (test) 3 and dimension value is dim3 (test) val Instead of using $filter= "dim (test) 3 eq 'dim3 - // (test) val' " use $filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' " + // When set to true, if the timespan passed in is not supported by this metric, the API will return the result using the closest + // supported timespan. When set to false, an error is returned for invalid + // timespan parameters. Defaults to false. + AutoAdjustTimegrain *bool + // The $filter is used to reduce the set of metric data returned. + // Example: + // Metric contains metadata A, B and C. + // - Return all time series of C where A = a1 and B = b1 or b2 + // $filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘’ + // - Invalid variant: + // $filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘’ or B = ‘b2’ + // This is invalid because the logical or operator cannot separate two different metadata names. + // - Return all time series where A = a1, B = b1 and C = c1: + // $filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’ + // - Return all time series where A = a1 + // $filter=A eq ‘a1’ and B eq ‘’ and C eq ‘’. Filter *string // The interval (i.e. timegrain) of the query. Interval *string - // The names of the metrics (comma separated) to retrieve. Special case: If a metricname itself has a comma in it then use - // %2 to indicate it. Eg: 'Metric,Name1' should be 'Metric%2Name1' + // The names of the metrics (comma separated) to retrieve. Metricnames *string - // Metric namespace to query metric definitions for. + // Metric namespace where the metrics you want reside. Metricnamespace *string // The aggregation to use for sorting results and the direction of the sort. Only one order can be specified. Examples: sum // asc. @@ -2900,6 +3206,9 @@ type MetricsClientListOptions struct { Timespan *string // The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10. Top *int32 + // When set to false, invalid filter parameter values will be ignored. When set to true, an error is returned for invalid + // filter parameters. Defaults to true. + ValidateDimensions *bool } // MultiMetricCriteriaClassification provides polymorphic access to related types. @@ -2926,7 +3235,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 +3260,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 +3307,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 +3340,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 +3368,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. @@ -3046,6 +3404,12 @@ type OperationsClientListOptions struct { // placeholder for future optional parameters } +// OperationsForMonitorClientListOptions contains the optional parameters for the OperationsForMonitorClient.NewListPager +// method. +type OperationsForMonitorClientListOptions struct { + // placeholder for future optional parameters +} + // PerfCounterDataSource - Definition of which performance counters will be collected and how they will be collected by this // data collection rule. Collected from both Windows and Linux machines where the counter is present. type PerfCounterDataSource struct { @@ -3247,7 +3611,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 +3635,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 +3831,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 +4081,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 +4207,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 +4253,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 +4292,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 +4318,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 @@ -4025,12 +4426,184 @@ type SmsReceiver struct { Status *ReceiverStatus `json:"status,omitempty" azure:"ro"` } +// SmsReceiverAutoGenerated - An SMS receiver. +type SmsReceiverAutoGenerated struct { + // REQUIRED; The country code of the SMS receiver. + CountryCode *string `json:"countryCode,omitempty"` + + // REQUIRED; The name of the SMS receiver. Names must be unique across all receivers within a tenant action group. + Name *string `json:"name,omitempty"` + + // REQUIRED; The phone number of the SMS receiver. + PhoneNumber *string `json:"phoneNumber,omitempty"` + + // READ-ONLY; The status of the receiver. + Status *ReceiverStatus `json:"status,omitempty" azure:"ro"` +} + // StreamDeclaration - Declaration of a custom stream. type StreamDeclaration struct { // List of columns used by data in this stream. Columns []*ColumnDefinition `json:"columns,omitempty"` } +// SubscriptionScopeMetric - The result data of a query. +type SubscriptionScopeMetric struct { + // REQUIRED; the metric Id. + ID *string `json:"id,omitempty"` + + // REQUIRED; the name and the display name of the metric, i.e. it is localizable string. + Name *LocalizableString `json:"name,omitempty"` + + // REQUIRED; the time series returned when a data query is performed. + Timeseries []*TimeSeriesElement `json:"timeseries,omitempty"` + + // REQUIRED; the resource type of the metric resource. + Type *string `json:"type,omitempty"` + + // REQUIRED; The unit of the metric. + Unit *MetricUnit `json:"unit,omitempty"` + + // Detailed description of this metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + + // 'Success' or the error details on query failures for this metric. + ErrorCode *string `json:"errorCode,omitempty"` + + // Error message encountered querying this specific metric. + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +// SubscriptionScopeMetricDefinition - Metric definition class specifies the metadata for a metric. +type SubscriptionScopeMetricDefinition struct { + // Custom category name for this metric. + Category *string `json:"category,omitempty"` + + // the name and the display name of the dimension, i.e. it is a localizable string. + Dimensions []*LocalizableString `json:"dimensions,omitempty"` + + // Detailed description of this metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + + // the resource identifier of the metric definition. + ID *string `json:"id,omitempty"` + + // Flag to indicate whether the dimension is required. + IsDimensionRequired *bool `json:"isDimensionRequired,omitempty"` + + // the collection of what aggregation intervals are available to be queried. + MetricAvailabilities []*MetricAvailability `json:"metricAvailabilities,omitempty"` + + // The class of the metric. + MetricClass *MetricClass `json:"metricClass,omitempty"` + + // the name and the display name of the metric, i.e. it is a localizable string. + Name *LocalizableString `json:"name,omitempty"` + + // the namespace the metric belongs to. + Namespace *string `json:"namespace,omitempty"` + + // the primary aggregation type value defining how to use the values for display. + PrimaryAggregationType *MetricAggregationType `json:"primaryAggregationType,omitempty"` + + // the resource identifier of the resource that emitted the metric. + ResourceID *string `json:"resourceId,omitempty"` + + // the collection of what aggregation types are supported. + SupportedAggregationTypes []*MetricAggregationType `json:"supportedAggregationTypes,omitempty"` + + // the unit of the metric. + Unit *MetricUnit `json:"unit,omitempty"` +} + +// SubscriptionScopeMetricDefinitionCollection - Represents collection of metric definitions. +type SubscriptionScopeMetricDefinitionCollection struct { + // REQUIRED; The values for the metric definitions. + Value []*SubscriptionScopeMetricDefinition `json:"value,omitempty"` +} + +// SubscriptionScopeMetricResponse - The response to a subscription scope metrics query. +type SubscriptionScopeMetricResponse struct { + // REQUIRED; The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by + // '/'. This may be adjusted in the future and returned back from what was originally + // requested. + Timespan *string `json:"timespan,omitempty"` + + // REQUIRED; the value of the collection. + Value []*SubscriptionScopeMetric `json:"value,omitempty"` + + // The integer value representing the relative cost of the query. + Cost *int32 `json:"cost,omitempty"` + + // The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back + // from what was originally requested. This is not present if a metadata request + // was made. + Interval *string `json:"interval,omitempty"` + + // The namespace of the metrics being queried + Namespace *string `json:"namespace,omitempty"` + + // The region of the resource being queried for metrics. + Resourceregion *string `json:"resourceregion,omitempty"` +} + +// SubscriptionScopeMetricsRequestBodyParameters - Query parameters can also be specified in the body, specifying the same +// parameter in both the body and query parameters will result in an error. +type SubscriptionScopeMetricsRequestBodyParameters struct { + // The list of aggregation types (comma separated) to retrieve. + Aggregation *string `json:"aggregation,omitempty"` + + // When set to true, if the timespan passed in is not supported by this metric, the API will return the result using the closest + // supported timespan. When set to false, an error is returned for invalid + // timespan parameters. Defaults to false. + AutoAdjustTimegrain *bool `json:"autoAdjustTimegrain,omitempty"` + + // The $filter is used to reduce the set of metric data returned. + // Example: + // Metric contains metadata A, B and C. + // - Return all time series of C where A = a1 and B = b1 or b2 + // $filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘’ + // - Invalid variant: + // $filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘’ or B = ‘b2’ + // This is invalid because the logical or operator cannot separate two different metadata names. + // - Return all time series where A = a1, B = b1 and C = c1: + // $filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’ + // - Return all time series where A = a1 + // $filter=A eq ‘a1’ and B eq ‘’ and C eq ‘’. + Filter *string `json:"filter,omitempty"` + + // The interval (i.e. timegrain) of the query. + Interval *string `json:"interval,omitempty"` + + // The names of the metrics (comma separated) to retrieve. + MetricNames *string `json:"metricNames,omitempty"` + + // Metric namespace where the metrics you want reside. + MetricNamespace *string `json:"metricNamespace,omitempty"` + + // The aggregation to use for sorting results and the direction of the sort. Only one order can be specified. Examples: sum + // asc. + OrderBy *string `json:"orderBy,omitempty"` + + // Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details. + ResultType *MetricResultType `json:"resultType,omitempty"` + + // Dimension name(s) to rollup results by. For example if you only want to see metric values with a filter like 'City eq Seattle + // or City eq Tacoma' but don't want to see separate values for each city, + // you can specify 'RollUpBy=City' to see the results for Seattle and Tacoma rolled up into one timeseries. + RollUpBy *string `json:"rollUpBy,omitempty"` + + // The timespan of the query. It is a string with the following format 'startDateTimeISO/endDateTimeISO'. + Timespan *time.Time `json:"timespan,omitempty"` + + // The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10. + Top *int32 `json:"top,omitempty"` + + // When set to false, invalid filter parameter values will be ignored. When set to true, an error is returned for invalid + // filter parameters. Defaults to true. + ValidateDimensions *bool `json:"validateDimensions,omitempty"` +} + // SyslogDataSource - Definition of which syslog data will be collected and how it will be collected. Only collected from // Linux machines. type SyslogDataSource struct { @@ -4077,7 +4650,89 @@ type TagsResource struct { Tags map[string]*string `json:"tags,omitempty"` } -// TenantActivityLogsClientListOptions contains the optional parameters for the TenantActivityLogsClient.List method. +// TenantActionGroup - A tenant action group. +type TenantActionGroup struct { + // REQUIRED; Indicates whether this tenant action group is enabled. If a tenant action group is not enabled, then none of + // its receivers will receive communications. + Enabled *bool `json:"enabled,omitempty"` + + // REQUIRED; The short name of the action group. This will be used in SMS messages. + GroupShortName *string `json:"groupShortName,omitempty"` + + // The list of AzureAppPush receivers that are part of this tenant action group. + AzureAppPushReceivers []*AzureAppPushReceiverAutoGenerated `json:"azureAppPushReceivers,omitempty"` + + // The list of email receivers that are part of this tenant action group. + EmailReceivers []*EmailReceiverAutoGenerated `json:"emailReceivers,omitempty"` + + // The list of SMS receivers that are part of this tenant action group. + SmsReceivers []*SmsReceiverAutoGenerated `json:"smsReceivers,omitempty"` + + // The list of voice receivers that are part of this tenant action group. + VoiceReceivers []*VoiceReceiverAutoGenerated `json:"voiceReceivers,omitempty"` + + // The list of webhook receivers that are part of this tenant action group. + WebhookReceivers []*WebhookReceiverAutoGenerated `json:"webhookReceivers,omitempty"` +} + +// TenantActionGroupList - A list of tenant action groups. +type TenantActionGroupList struct { + // Provides the link to retrieve the next set of elements. + NextLink *string `json:"nextLink,omitempty"` + + // The list of tenant action groups. + Value []*TenantActionGroupResource `json:"value,omitempty"` +} + +// TenantActionGroupResource - A tenant action group resource. +type TenantActionGroupResource struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + + // The tenant action groups properties of the resource. + Properties *TenantActionGroup `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Azure resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// TenantActionGroupsClientCreateOrUpdateOptions contains the optional parameters for the TenantActionGroupsClient.CreateOrUpdate +// method. +type TenantActionGroupsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// TenantActionGroupsClientDeleteOptions contains the optional parameters for the TenantActionGroupsClient.Delete method. +type TenantActionGroupsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// TenantActionGroupsClientGetOptions contains the optional parameters for the TenantActionGroupsClient.Get method. +type TenantActionGroupsClientGetOptions struct { + // placeholder for future optional parameters +} + +// TenantActionGroupsClientListByManagementGroupIDOptions contains the optional parameters for the TenantActionGroupsClient.NewListByManagementGroupIDPager +// method. +type TenantActionGroupsClientListByManagementGroupIDOptions struct { + // placeholder for future optional parameters +} + +// TenantActionGroupsClientUpdateOptions contains the optional parameters for the TenantActionGroupsClient.Update method. +type TenantActionGroupsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// TenantActivityLogsClientListOptions contains the optional parameters for the TenantActivityLogsClient.NewListPager method. type TenantActivityLogsClientListOptions struct { // Reduces the set of data collected. // The $filter is very restricted and allows only the following patterns. @@ -4237,6 +4892,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 { @@ -4287,6 +4973,18 @@ type VoiceReceiver struct { PhoneNumber *string `json:"phoneNumber,omitempty"` } +// VoiceReceiverAutoGenerated - A voice receiver. +type VoiceReceiverAutoGenerated struct { + // REQUIRED; The country code of the voice receiver. + CountryCode *string `json:"countryCode,omitempty"` + + // REQUIRED; The name of the voice receiver. Names must be unique across all receivers within a tenant action group. + Name *string `json:"name,omitempty"` + + // REQUIRED; The phone number of the voice receiver. + PhoneNumber *string `json:"phoneNumber,omitempty"` +} + // WebhookNotification - Webhook notification of an autoscale event. type WebhookNotification struct { // a property bag of settings. This value can be empty. @@ -4320,6 +5018,30 @@ type WebhookReceiver struct { UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` } +// WebhookReceiverAutoGenerated - A webhook receiver. +type WebhookReceiverAutoGenerated struct { + // REQUIRED; The name of the webhook receiver. Names must be unique across all receivers within a tenant action group. + Name *string `json:"name,omitempty"` + + // REQUIRED; The URI where webhooks should be sent. + ServiceURI *string `json:"serviceUri,omitempty"` + + // Indicates the identifier uri for aad auth. + IdentifierURI *string `json:"identifierUri,omitempty"` + + // Indicates the webhook app object Id for aad auth. + ObjectID *string `json:"objectId,omitempty"` + + // Indicates the tenant id for aad auth. + TenantID *string `json:"tenantId,omitempty"` + + // Indicates whether or not use AAD authentication. + UseAADAuth *bool `json:"useAadAuth,omitempty"` + + // Indicates whether to use common alert schema. + UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` +} + // WebtestLocationAvailabilityCriteria - Specifies the metric alert rule criteria for a web test resource. type WebtestLocationAvailabilityCriteria struct { // REQUIRED; The Application Insights resource Id. @@ -4335,7 +5057,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..0f59c04a266f 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) } @@ -298,9 +298,36 @@ func (a *ActionGroupPatch) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ActionGroupPatchAutoGenerated. +func (a ActionGroupPatchAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enabled", a.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActionGroupPatchAutoGenerated. +func (a *ActionGroupPatchAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enabled": + err = unpopulate(val, "Enabled", &a.Enabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ActionGroupPatchBody. func (a ActionGroupPatchBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", a.Properties) populate(objectMap, "tags", a.Tags) return json.Marshal(objectMap) @@ -329,9 +356,40 @@ func (a *ActionGroupPatchBody) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ActionGroupPatchBodyAutoGenerated. +func (a ActionGroupPatchBodyAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "tags", a.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActionGroupPatchBodyAutoGenerated. +func (a *ActionGroupPatchBodyAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + 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 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 +436,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 +463,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 +494,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 +541,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 +596,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 +623,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 +662,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 +697,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 +728,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 +759,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 +786,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 +829,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 +876,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 +903,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 +934,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 +969,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 +1020,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 +1051,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 +1090,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 +1125,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 +1168,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 +1219,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 +1270,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 +1301,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 +1332,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) @@ -1303,9 +1361,40 @@ func (a *AzureAppPushReceiver) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AzureAppPushReceiverAutoGenerated. +func (a AzureAppPushReceiverAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "emailAddress", a.EmailAddress) + populate(objectMap, "name", a.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureAppPushReceiverAutoGenerated. +func (a *AzureAppPushReceiverAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "emailAddress": + err = unpopulate(val, "EmailAddress", &a.EmailAddress) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type AzureFunctionReceiver. func (a AzureFunctionReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "functionAppResourceId", a.FunctionAppResourceID) populate(objectMap, "functionName", a.FunctionName) populate(objectMap, "httpTriggerUrl", a.HTTPTriggerURL) @@ -1348,7 +1437,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 +1464,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 +1515,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 +1546,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,19 +1579,18 @@ func (a *AzureMonitorPrivateLinkScopeProperties) UnmarshalJSON(data []byte) erro return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureResource. -func (a AzureResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", a.ID) - populate(objectMap, "location", a.Location) - populate(objectMap, "name", a.Name) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) +// 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 AzureResource. -func (a *AzureResource) UnmarshalJSON(data []byte) error { +// 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) @@ -1510,20 +1598,17 @@ func (a *AzureResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &a.Location) + case "accountId": + err = unpopulate(val, "AccountID", &a.AccountID) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) + case "defaultIngestionSettings": + err = unpopulate(val, "DefaultIngestionSettings", &a.DefaultIngestionSettings) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) + case "metrics": + err = unpopulate(val, "Metrics", &a.Metrics) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) delete(rawMsg, key) } if err != nil { @@ -1533,19 +1618,16 @@ func (a *AzureResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureResourceAutoGenerated. -func (a AzureResourceAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", a.ID) - populate(objectMap, "location", a.Location) - populate(objectMap, "name", a.Name) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) +// 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 AzureResourceAutoGenerated. -func (a *AzureResourceAutoGenerated) UnmarshalJSON(data []byte) error { +// 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) @@ -1553,20 +1635,11 @@ func (a *AzureResourceAutoGenerated) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &a.Location) + case "dataCollectionEndpointResourceId": + err = unpopulate(val, "DataCollectionEndpointResourceID", &a.DataCollectionEndpointResourceID) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) + case "dataCollectionRuleResourceId": + err = unpopulate(val, "DataCollectionRuleResourceID", &a.DataCollectionRuleResourceID) delete(rawMsg, key) } if err != nil { @@ -1576,180 +1649,449 @@ func (a *AzureResourceAutoGenerated) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type BaselineMetadata. -func (b BaselineMetadata) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "name", b.Name) - populate(objectMap, "value", b.Value) +// 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 BaselineMetadata. -func (b *BaselineMetadata) UnmarshalJSON(data []byte) error { +// 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", b, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &b.Name) + case "internalId": + err = unpopulate(val, "InternalID", &a.InternalID) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &b.Value) + case "prometheusQueryEndpoint": + err = unpopulate(val, "PrometheusQueryEndpoint", &a.PrometheusQueryEndpoint) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ColumnDefinition. -func (c ColumnDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "name", c.Name) - populate(objectMap, "type", c.Type) +// 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 ColumnDefinition. -func (c *ColumnDefinition) UnmarshalJSON(data []byte) error { +// 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", c, err) + 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", &c.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", &c.Type) + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Condition. -func (c Condition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "dimensions", c.Dimensions) - populate(objectMap, "failingPeriods", c.FailingPeriods) - populate(objectMap, "metricMeasureColumn", c.MetricMeasureColumn) - populate(objectMap, "metricName", c.MetricName) - populate(objectMap, "operator", c.Operator) - populate(objectMap, "query", c.Query) - populate(objectMap, "resourceIdColumn", c.ResourceIDColumn) - populate(objectMap, "threshold", c.Threshold) - populate(objectMap, "timeAggregation", c.TimeAggregation) +// 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 Condition. -func (c *Condition) UnmarshalJSON(data []byte) error { +// 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", c, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "dimensions": - err = unpopulate(val, "Dimensions", &c.Dimensions) - delete(rawMsg, key) - case "failingPeriods": - err = unpopulate(val, "FailingPeriods", &c.FailingPeriods) - delete(rawMsg, key) - case "metricMeasureColumn": - err = unpopulate(val, "MetricMeasureColumn", &c.MetricMeasureColumn) - delete(rawMsg, key) - case "metricName": - err = unpopulate(val, "MetricName", &c.MetricName) - delete(rawMsg, key) - case "operator": - err = unpopulate(val, "Operator", &c.Operator) - delete(rawMsg, key) - case "query": - err = unpopulate(val, "Query", &c.Query) - delete(rawMsg, key) - case "resourceIdColumn": - err = unpopulate(val, "ResourceIDColumn", &c.ResourceIDColumn) - delete(rawMsg, key) - case "threshold": - err = unpopulate(val, "Threshold", &c.Threshold) - delete(rawMsg, key) - case "timeAggregation": - err = unpopulate(val, "TimeAggregation", &c.TimeAggregation) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ConditionFailingPeriods. -func (c ConditionFailingPeriods) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "minFailingPeriodsToAlert", c.MinFailingPeriodsToAlert) - populate(objectMap, "numberOfEvaluationPeriods", c.NumberOfEvaluationPeriods) +// 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 ConditionFailingPeriods. -func (c *ConditionFailingPeriods) UnmarshalJSON(data []byte) error { +// 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", c, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "minFailingPeriodsToAlert": - err = unpopulate(val, "MinFailingPeriodsToAlert", &c.MinFailingPeriodsToAlert) + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) delete(rawMsg, key) - case "numberOfEvaluationPeriods": - err = unpopulate(val, "NumberOfEvaluationPeriods", &c.NumberOfEvaluationPeriods) + case "value": + err = unpopulate(val, "Value", &a.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ConfigurationAccessEndpointSpec. -func (c ConfigurationAccessEndpointSpec) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "endpoint", c.Endpoint) +// 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 ConfigurationAccessEndpointSpec. -func (c *ConfigurationAccessEndpointSpec) UnmarshalJSON(data []byte) error { +// 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", c, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "endpoint": - err = unpopulate(val, "Endpoint", &c.Endpoint) + 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", c, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureResource. +func (a AzureResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResource. +func (a *AzureResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureResourceAutoGenerated. +func (a AzureResourceAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResourceAutoGenerated. +func (a *AzureResourceAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BaselineMetadata. +func (b BaselineMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", b.Name) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BaselineMetadata. +func (b *BaselineMetadata) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &b.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ColumnDefinition. +func (c ColumnDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", c.Name) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ColumnDefinition. +func (c *ColumnDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Condition. +func (c Condition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dimensions", c.Dimensions) + populate(objectMap, "failingPeriods", c.FailingPeriods) + populate(objectMap, "metricMeasureColumn", c.MetricMeasureColumn) + populate(objectMap, "metricName", c.MetricName) + populate(objectMap, "operator", c.Operator) + populate(objectMap, "query", c.Query) + populate(objectMap, "resourceIdColumn", c.ResourceIDColumn) + populate(objectMap, "threshold", c.Threshold) + populate(objectMap, "timeAggregation", c.TimeAggregation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Condition. +func (c *Condition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dimensions": + err = unpopulate(val, "Dimensions", &c.Dimensions) + delete(rawMsg, key) + case "failingPeriods": + err = unpopulate(val, "FailingPeriods", &c.FailingPeriods) + delete(rawMsg, key) + case "metricMeasureColumn": + err = unpopulate(val, "MetricMeasureColumn", &c.MetricMeasureColumn) + delete(rawMsg, key) + case "metricName": + err = unpopulate(val, "MetricName", &c.MetricName) + delete(rawMsg, key) + case "operator": + err = unpopulate(val, "Operator", &c.Operator) + delete(rawMsg, key) + case "query": + err = unpopulate(val, "Query", &c.Query) + delete(rawMsg, key) + case "resourceIdColumn": + err = unpopulate(val, "ResourceIDColumn", &c.ResourceIDColumn) + delete(rawMsg, key) + case "threshold": + err = unpopulate(val, "Threshold", &c.Threshold) + delete(rawMsg, key) + case "timeAggregation": + err = unpopulate(val, "TimeAggregation", &c.TimeAggregation) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConditionFailingPeriods. +func (c ConditionFailingPeriods) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "minFailingPeriodsToAlert", c.MinFailingPeriodsToAlert) + populate(objectMap, "numberOfEvaluationPeriods", c.NumberOfEvaluationPeriods) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConditionFailingPeriods. +func (c *ConditionFailingPeriods) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "minFailingPeriodsToAlert": + err = unpopulate(val, "MinFailingPeriodsToAlert", &c.MinFailingPeriodsToAlert) + delete(rawMsg, key) + case "numberOfEvaluationPeriods": + err = unpopulate(val, "NumberOfEvaluationPeriods", &c.NumberOfEvaluationPeriods) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConfigurationAccessEndpointSpec. +func (c ConfigurationAccessEndpointSpec) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "endpoint", c.Endpoint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationAccessEndpointSpec. +func (c *ConfigurationAccessEndpointSpec) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endpoint": + err = unpopulate(val, "Endpoint", &c.Endpoint) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil @@ -1757,7 +2099,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 +2130,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 +2177,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 +2204,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 +2231,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 +2258,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 +2317,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 +2348,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 +2395,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 +2442,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 +2501,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 +2544,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 +2571,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 +2618,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 +2649,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 +2692,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 +2739,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 +2786,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 +2817,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 +2844,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 +2903,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 +2934,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 +2993,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 +3040,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 +3067,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 +3106,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 +3153,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 +3180,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 +3211,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 +3238,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 +3297,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 +3328,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 +3371,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 +3398,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 +3441,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 +3468,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 +3503,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 +3567,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 +3585,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 +3616,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 +3651,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) @@ -3346,9 +3688,48 @@ func (e *EmailReceiver) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type EmailReceiverAutoGenerated. +func (e EmailReceiverAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "emailAddress", e.EmailAddress) + populate(objectMap, "name", e.Name) + populate(objectMap, "status", e.Status) + populate(objectMap, "useCommonAlertSchema", e.UseCommonAlertSchema) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EmailReceiverAutoGenerated. +func (e *EmailReceiverAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "emailAddress": + err = unpopulate(val, "EmailAddress", &e.EmailAddress) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &e.Status) + delete(rawMsg, key) + case "useCommonAlertSchema": + err = unpopulate(val, "UseCommonAlertSchema", &e.UseCommonAlertSchema) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type EnableRequest. func (e EnableRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "receiverName", e.ReceiverName) return json.Marshal(objectMap) } @@ -3375,7 +3756,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) @@ -3404,16 +3785,73 @@ func (e *Error) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. -func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "info", &e.Info) - populate(objectMap, "type", e.Type) +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "info", &e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorContract. +func (e ErrorContract) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorContract. +func (e *ErrorContract) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorContractAutoGenerated. +func (e ErrorContractAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", e.Error) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. -func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorContractAutoGenerated. +func (e *ErrorContractAutoGenerated) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) @@ -3421,11 +3859,8 @@ func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "info": - err = unpopulate(val, "Info", &e.Info) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) + case "error": + err = unpopulate(val, "Error", &e.Error) delete(rawMsg, key) } if err != nil { @@ -3435,15 +3870,19 @@ func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorContract. -func (e ErrorContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "error", e.Error) +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + 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 ErrorContract. -func (e *ErrorContract) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) @@ -3451,8 +3890,20 @@ func (e *ErrorContract) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) + 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 { @@ -3462,9 +3913,9 @@ func (e *ErrorContract) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. -func (e ErrorDetail) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) +// 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) @@ -3473,8 +3924,8 @@ func (e ErrorDetail) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. -func (e *ErrorDetail) UnmarshalJSON(data []byte) error { +// 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) @@ -3507,7 +3958,7 @@ func (e *ErrorDetail) UnmarshalJSON(data []byte) error { // 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 +3989,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 +4020,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 +4049,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 +4105,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 +4148,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 +4175,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 +4294,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 +4325,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 +4372,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 +4415,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) @@ -3974,9 +4452,48 @@ func (h *HTTPRequestInfo) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", i.PrincipalID) + populate(objectMap, "tenantId", i.TenantID) + populate(objectMap, "type", i.Type) + populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Identity. +func (i *Identity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &i.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &i.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &i.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type IisLogsDataSource. func (i IisLogsDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "logDirectories", i.LogDirectories) populate(objectMap, "name", i.Name) populate(objectMap, "streams", i.Streams) @@ -4011,7 +4528,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 +4571,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 +4596,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 +4672,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 +4703,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 +4742,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 +4777,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 +4804,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 +4831,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 +4858,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 +4901,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 +4928,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 +4955,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 +4998,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 +5045,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 +5076,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 +5115,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 +5154,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 +5181,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 +5216,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 +5251,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 +5278,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 +5309,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 +5364,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 +5395,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 +5419,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 +5437,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 +5465,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 +5483,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 +5558,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 +5633,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 +5680,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 +5707,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 +5738,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 +5766,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 +5784,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 +5823,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 +5850,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 +5885,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 +5916,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 +5955,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 +5982,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 +6038,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 +6056,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 +6131,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 +6158,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 +6193,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 +6236,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 +6263,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 +6290,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 +6329,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 +6360,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 +6431,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 +6476,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 +6557,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 +6575,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 +6602,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 +6673,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 +6702,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 +6780,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 +6850,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 +6930,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 +6969,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 +7000,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 +7043,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 +7074,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 +7101,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 +7140,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 +7167,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 +7202,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 +7241,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 +7268,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 +7303,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 +7338,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 +7373,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 +7408,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 +7439,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 +7478,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 +7525,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 +7568,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) @@ -6917,17 +7609,54 @@ func (r *ResourceAutoGenerated2) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated3. -func (r ResourceAutoGenerated3) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) +// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated3. +func (r ResourceAutoGenerated3) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated3. +func (r *ResourceAutoGenerated3) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated4. +func (r ResourceAutoGenerated4) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) + populate(objectMap, "tags", r.Tags) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated3. -func (r *ResourceAutoGenerated3) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated4. +func (r *ResourceAutoGenerated4) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -6938,9 +7667,15 @@ func (r *ResourceAutoGenerated3) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) @@ -6952,19 +7687,18 @@ func (r *ResourceAutoGenerated3) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated4. -func (r ResourceAutoGenerated4) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) +// 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, "location", r.Location) populate(objectMap, "name", r.Name) - populate(objectMap, "tags", r.Tags) + populate(objectMap, "systemData", r.SystemData) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated4. -func (r *ResourceAutoGenerated4) UnmarshalJSON(data []byte) error { +// 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) @@ -6975,14 +7709,11 @@ func (r *ResourceAutoGenerated4) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) @@ -6997,7 +7728,7 @@ func (r *ResourceAutoGenerated4) UnmarshalJSON(data []byte) error { // 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 +7755,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 +7802,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 +7829,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 +7860,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 +7887,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 +7918,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 +7961,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 +7996,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 +8023,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 +8102,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 +8147,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 +8215,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 +8254,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 +8289,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 +8320,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 +8355,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 +8382,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 +8396,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 +8454,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 +8485,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 +8514,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 +8548,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 +8579,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 +8595,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 +8614,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 +8657,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 +8688,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 +8719,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 +8754,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 +8789,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 +8828,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) @@ -8076,8 +8854,278 @@ func (s *SmsReceiver) UnmarshalJSON(data []byte) error { case "phoneNumber": err = unpopulate(val, "PhoneNumber", &s.PhoneNumber) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &s.Status) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SmsReceiverAutoGenerated. +func (s SmsReceiverAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "countryCode", s.CountryCode) + populate(objectMap, "name", s.Name) + populate(objectMap, "phoneNumber", s.PhoneNumber) + populate(objectMap, "status", s.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SmsReceiverAutoGenerated. +func (s *SmsReceiverAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "countryCode": + err = unpopulate(val, "CountryCode", &s.CountryCode) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "phoneNumber": + err = unpopulate(val, "PhoneNumber", &s.PhoneNumber) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StreamDeclaration. +func (s StreamDeclaration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "columns", s.Columns) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StreamDeclaration. +func (s *StreamDeclaration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "columns": + err = unpopulate(val, "Columns", &s.Columns) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SubscriptionScopeMetric. +func (s SubscriptionScopeMetric) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayDescription", s.DisplayDescription) + populate(objectMap, "errorCode", s.ErrorCode) + populate(objectMap, "errorMessage", s.ErrorMessage) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "timeseries", s.Timeseries) + populate(objectMap, "type", s.Type) + populate(objectMap, "unit", s.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionScopeMetric. +func (s *SubscriptionScopeMetric) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayDescription": + err = unpopulate(val, "DisplayDescription", &s.DisplayDescription) + delete(rawMsg, key) + case "errorCode": + err = unpopulate(val, "ErrorCode", &s.ErrorCode) + delete(rawMsg, key) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &s.ErrorMessage) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "timeseries": + err = unpopulate(val, "Timeseries", &s.Timeseries) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &s.Unit) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SubscriptionScopeMetricDefinition. +func (s SubscriptionScopeMetricDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "category", s.Category) + populate(objectMap, "dimensions", s.Dimensions) + populate(objectMap, "displayDescription", s.DisplayDescription) + populate(objectMap, "id", s.ID) + populate(objectMap, "isDimensionRequired", s.IsDimensionRequired) + populate(objectMap, "metricAvailabilities", s.MetricAvailabilities) + populate(objectMap, "metricClass", s.MetricClass) + populate(objectMap, "name", s.Name) + populate(objectMap, "namespace", s.Namespace) + populate(objectMap, "primaryAggregationType", s.PrimaryAggregationType) + populate(objectMap, "resourceId", s.ResourceID) + populate(objectMap, "supportedAggregationTypes", s.SupportedAggregationTypes) + populate(objectMap, "unit", s.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionScopeMetricDefinition. +func (s *SubscriptionScopeMetricDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "category": + err = unpopulate(val, "Category", &s.Category) + delete(rawMsg, key) + case "dimensions": + err = unpopulate(val, "Dimensions", &s.Dimensions) + delete(rawMsg, key) + case "displayDescription": + err = unpopulate(val, "DisplayDescription", &s.DisplayDescription) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "isDimensionRequired": + err = unpopulate(val, "IsDimensionRequired", &s.IsDimensionRequired) + delete(rawMsg, key) + case "metricAvailabilities": + err = unpopulate(val, "MetricAvailabilities", &s.MetricAvailabilities) + delete(rawMsg, key) + case "metricClass": + err = unpopulate(val, "MetricClass", &s.MetricClass) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "namespace": + err = unpopulate(val, "Namespace", &s.Namespace) + delete(rawMsg, key) + case "primaryAggregationType": + err = unpopulate(val, "PrimaryAggregationType", &s.PrimaryAggregationType) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &s.ResourceID) + delete(rawMsg, key) + case "supportedAggregationTypes": + err = unpopulate(val, "SupportedAggregationTypes", &s.SupportedAggregationTypes) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &s.Unit) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SubscriptionScopeMetricDefinitionCollection. +func (s SubscriptionScopeMetricDefinitionCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionScopeMetricDefinitionCollection. +func (s *SubscriptionScopeMetricDefinitionCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SubscriptionScopeMetricResponse. +func (s SubscriptionScopeMetricResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cost", s.Cost) + populate(objectMap, "interval", s.Interval) + populate(objectMap, "namespace", s.Namespace) + populate(objectMap, "resourceregion", s.Resourceregion) + populate(objectMap, "timespan", s.Timespan) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionScopeMetricResponse. +func (s *SubscriptionScopeMetricResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "cost": + err = unpopulate(val, "Cost", &s.Cost) + delete(rawMsg, key) + case "interval": + err = unpopulate(val, "Interval", &s.Interval) + delete(rawMsg, key) + case "namespace": + err = unpopulate(val, "Namespace", &s.Namespace) + delete(rawMsg, key) + case "resourceregion": + err = unpopulate(val, "Resourceregion", &s.Resourceregion) + delete(rawMsg, key) + case "timespan": + err = unpopulate(val, "Timespan", &s.Timespan) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) } if err != nil { @@ -8087,15 +9135,26 @@ func (s *SmsReceiver) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type StreamDeclaration. -func (s StreamDeclaration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "columns", s.Columns) +// MarshalJSON implements the json.Marshaller interface for type SubscriptionScopeMetricsRequestBodyParameters. +func (s SubscriptionScopeMetricsRequestBodyParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "aggregation", s.Aggregation) + populate(objectMap, "autoAdjustTimegrain", s.AutoAdjustTimegrain) + populate(objectMap, "filter", s.Filter) + populate(objectMap, "interval", s.Interval) + populate(objectMap, "metricNames", s.MetricNames) + populate(objectMap, "metricNamespace", s.MetricNamespace) + populate(objectMap, "orderBy", s.OrderBy) + populate(objectMap, "resultType", s.ResultType) + populate(objectMap, "rollUpBy", s.RollUpBy) + populate(objectMap, "timespan", s.Timespan) + populate(objectMap, "top", s.Top) + populate(objectMap, "validateDimensions", s.ValidateDimensions) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StreamDeclaration. -func (s *StreamDeclaration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionScopeMetricsRequestBodyParameters. +func (s *SubscriptionScopeMetricsRequestBodyParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -8103,8 +9162,41 @@ func (s *StreamDeclaration) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "columns": - err = unpopulate(val, "Columns", &s.Columns) + case "aggregation": + err = unpopulate(val, "Aggregation", &s.Aggregation) + delete(rawMsg, key) + case "autoAdjustTimegrain": + err = unpopulate(val, "AutoAdjustTimegrain", &s.AutoAdjustTimegrain) + delete(rawMsg, key) + case "filter": + err = unpopulate(val, "Filter", &s.Filter) + delete(rawMsg, key) + case "interval": + err = unpopulate(val, "Interval", &s.Interval) + delete(rawMsg, key) + case "metricNames": + err = unpopulate(val, "MetricNames", &s.MetricNames) + delete(rawMsg, key) + case "metricNamespace": + err = unpopulate(val, "MetricNamespace", &s.MetricNamespace) + delete(rawMsg, key) + case "orderBy": + err = unpopulate(val, "OrderBy", &s.OrderBy) + delete(rawMsg, key) + case "resultType": + err = unpopulate(val, "ResultType", &s.ResultType) + delete(rawMsg, key) + case "rollUpBy": + err = unpopulate(val, "RollUpBy", &s.RollUpBy) + delete(rawMsg, key) + case "timespan": + err = unpopulate(val, "Timespan", &s.Timespan) + delete(rawMsg, key) + case "top": + err = unpopulate(val, "Top", &s.Top) + delete(rawMsg, key) + case "validateDimensions": + err = unpopulate(val, "ValidateDimensions", &s.ValidateDimensions) delete(rawMsg, key) } if err != nil { @@ -8116,7 +9208,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 +9247,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 +9294,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) } @@ -8227,9 +9319,138 @@ func (t *TagsResource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type TenantActionGroup. +func (t TenantActionGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "azureAppPushReceivers", t.AzureAppPushReceivers) + populate(objectMap, "emailReceivers", t.EmailReceivers) + populate(objectMap, "enabled", t.Enabled) + populate(objectMap, "groupShortName", t.GroupShortName) + populate(objectMap, "smsReceivers", t.SmsReceivers) + populate(objectMap, "voiceReceivers", t.VoiceReceivers) + populate(objectMap, "webhookReceivers", t.WebhookReceivers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TenantActionGroup. +func (t *TenantActionGroup) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureAppPushReceivers": + err = unpopulate(val, "AzureAppPushReceivers", &t.AzureAppPushReceivers) + delete(rawMsg, key) + case "emailReceivers": + err = unpopulate(val, "EmailReceivers", &t.EmailReceivers) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &t.Enabled) + delete(rawMsg, key) + case "groupShortName": + err = unpopulate(val, "GroupShortName", &t.GroupShortName) + delete(rawMsg, key) + case "smsReceivers": + err = unpopulate(val, "SmsReceivers", &t.SmsReceivers) + delete(rawMsg, key) + case "voiceReceivers": + err = unpopulate(val, "VoiceReceivers", &t.VoiceReceivers) + delete(rawMsg, key) + case "webhookReceivers": + err = unpopulate(val, "WebhookReceivers", &t.WebhookReceivers) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TenantActionGroupList. +func (t TenantActionGroupList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TenantActionGroupList. +func (t *TenantActionGroupList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &t.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TenantActionGroupResource. +func (t TenantActionGroupResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TenantActionGroupResource. +func (t *TenantActionGroupResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &t.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type TestNotificationDetailsResponse. func (t TestNotificationDetailsResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "actionDetails", t.ActionDetails) populate(objectMap, "completedTime", t.CompletedTime) populate(objectMap, "context", t.Context) @@ -8272,7 +9493,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 +9540,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 +9591,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 +9622,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 +9657,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 +9698,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 +9817,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 +9856,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) @@ -8590,9 +9889,44 @@ func (v *VoiceReceiver) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type VoiceReceiverAutoGenerated. +func (v VoiceReceiverAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "countryCode", v.CountryCode) + populate(objectMap, "name", v.Name) + populate(objectMap, "phoneNumber", v.PhoneNumber) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VoiceReceiverAutoGenerated. +func (v *VoiceReceiverAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "countryCode": + err = unpopulate(val, "CountryCode", &v.CountryCode) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "phoneNumber": + err = unpopulate(val, "PhoneNumber", &v.PhoneNumber) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type WebhookNotification. func (w WebhookNotification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "properties", w.Properties) populate(objectMap, "serviceUri", w.ServiceURI) return json.Marshal(objectMap) @@ -8623,7 +9957,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) @@ -8672,9 +10006,60 @@ func (w *WebhookReceiver) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type WebhookReceiverAutoGenerated. +func (w WebhookReceiverAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identifierUri", w.IdentifierURI) + populate(objectMap, "name", w.Name) + populate(objectMap, "objectId", w.ObjectID) + populate(objectMap, "serviceUri", w.ServiceURI) + populate(objectMap, "tenantId", w.TenantID) + populate(objectMap, "useAadAuth", w.UseAADAuth) + populate(objectMap, "useCommonAlertSchema", w.UseCommonAlertSchema) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebhookReceiverAutoGenerated. +func (w *WebhookReceiverAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identifierUri": + err = unpopulate(val, "IdentifierURI", &w.IdentifierURI) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "objectId": + err = unpopulate(val, "ObjectID", &w.ObjectID) + delete(rawMsg, key) + case "serviceUri": + err = unpopulate(val, "ServiceURI", &w.ServiceURI) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &w.TenantID) + delete(rawMsg, key) + case "useAadAuth": + err = unpopulate(val, "UseAADAuth", &w.UseAADAuth) + delete(rawMsg, key) + case "useCommonAlertSchema": + err = unpopulate(val, "UseCommonAlertSchema", &w.UseCommonAlertSchema) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type 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 +10095,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 +10113,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 +10148,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 +10183,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 +10208,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 +10218,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/operationsformonitor_client.go b/sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client.go new file mode 100644 index 000000000000..e3e3733082c0 --- /dev/null +++ b/sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client.go @@ -0,0 +1,106 @@ +//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" +) + +// OperationsForMonitorClient contains the methods for the OperationsForMonitor group. +// Don't use this type directly, use NewOperationsForMonitorClient() instead. +type OperationsForMonitorClient struct { + host string + pl runtime.Pipeline +} + +// NewOperationsForMonitorClient creates a new instance of OperationsForMonitorClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOperationsForMonitorClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsForMonitorClient, error) { + 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 := &OperationsForMonitorClient{ + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - Lists available Operations for this Resource Provider +// +// Generated from API version 2021-06-03-preview +// - options - OperationsForMonitorClientListOptions contains the optional parameters for the OperationsForMonitorClient.NewListPager +// method. +func (client *OperationsForMonitorClient) NewListPager(options *OperationsForMonitorClientListOptions) *runtime.Pager[OperationsForMonitorClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[OperationsForMonitorClientListResponse]{ + More: func(page OperationsForMonitorClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OperationsForMonitorClientListResponse) (OperationsForMonitorClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return OperationsForMonitorClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OperationsForMonitorClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsForMonitorClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsForMonitorClient) listCreateRequest(ctx context.Context, options *OperationsForMonitorClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Monitor/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.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 +} + +// listHandleResponse handles the List response. +func (client *OperationsForMonitorClient) listHandleResponse(resp *http.Response) (OperationsForMonitorClientListResponse, error) { + result := OperationsForMonitorClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResultAutoGenerated); err != nil { + return OperationsForMonitorClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/monitor/armmonitor/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/privatelinkscopes_live_test.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_live_test.go deleted file mode 100644 index 4528420fdf15..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_live_test.go +++ /dev/null @@ -1,117 +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" - "fmt" - "testing" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/testutil" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "github.com/stretchr/testify/suite" -) - -type PrivatelinkscopesTestSuite struct { - suite.Suite - - ctx context.Context - cred azcore.TokenCredential - options *arm.ClientOptions - scopeName string - location string - resourceGroupName string - subscriptionId string -} - -func (testsuite *PrivatelinkscopesTestSuite) SetupSuite() { - testutil.StartRecording(testsuite.T(), "sdk/resourcemanager/monitor/armmonitor/testdata") - testsuite.ctx = context.Background() - testsuite.cred, testsuite.options = testutil.GetCredAndClientOptions(testsuite.T()) - testsuite.scopeName = testutil.GenerateAlphaNumericID(testsuite.T(), "linkscopena", 6) - testsuite.location = testutil.GetEnv("LOCATION", "eastus") - testsuite.resourceGroupName = testutil.GetEnv("RESOURCE_GROUP_NAME", "scenarioTestTempGroup") - testsuite.subscriptionId = testutil.GetEnv("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - - resourceGroup, _, err := testutil.CreateResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.location) - testsuite.Require().NoError(err) - testsuite.resourceGroupName = *resourceGroup.Name -} - -func (testsuite *PrivatelinkscopesTestSuite) TearDownSuite() { - _, err := testutil.DeleteResourceGroup(testsuite.ctx, testsuite.subscriptionId, testsuite.cred, testsuite.options, testsuite.resourceGroupName) - testsuite.Require().NoError(err) - testutil.StopRecording(testsuite.T()) -} - -func TestPrivatelinkscopesTestSuite(t *testing.T) { - suite.Run(t, new(PrivatelinkscopesTestSuite)) -} - -// microsoft.insights/privateLinkScopes -func (testsuite *PrivatelinkscopesTestSuite) TestPrivatelinkscope() { - var err error - // From step PrivateLinkScopes_Create - fmt.Println("Call operation: PrivateLinkScopes_CreateOrUpdate") - privateLinkScopesClient, err := armmonitor.NewPrivateLinkScopesClient(testsuite.subscriptionId, testsuite.cred, testsuite.options) - testsuite.Require().NoError(err) - _, err = privateLinkScopesClient.CreateOrUpdate(testsuite.ctx, testsuite.resourceGroupName, testsuite.scopeName, armmonitor.AzureMonitorPrivateLinkScope{ - Location: to.Ptr("Global"), - Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - AccessModeSettings: &armmonitor.AccessModeSettings{ - QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - IngestionAccessMode: to.Ptr(armmonitor.AccessModePrivateOnly), - }, - }, - }, nil) - testsuite.Require().NoError(err) - - // From step PrivateLinkScopes_List - fmt.Println("Call operation: PrivateLinkScopes_List") - privateLinkScopesClientNewListPager := privateLinkScopesClient.NewListPager(nil) - for privateLinkScopesClientNewListPager.More() { - _, err := privateLinkScopesClientNewListPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step PrivateLinkScopes_ListByResourceGroup - fmt.Println("Call operation: PrivateLinkScopes_ListByResourceGroup") - privateLinkScopesClientNewListByResourceGroupPager := privateLinkScopesClient.NewListByResourceGroupPager(testsuite.resourceGroupName, nil) - for privateLinkScopesClientNewListByResourceGroupPager.More() { - _, err := privateLinkScopesClientNewListByResourceGroupPager.NextPage(testsuite.ctx) - testsuite.Require().NoError(err) - break - } - - // From step PrivateLinkScopes_Get - fmt.Println("Call operation: PrivateLinkScopes_Get") - _, err = privateLinkScopesClient.Get(testsuite.ctx, testsuite.resourceGroupName, testsuite.scopeName, nil) - testsuite.Require().NoError(err) - - // From step PrivateLinkScopes_UpdateTags - fmt.Println("Call operation: PrivateLinkScopes_UpdateTags") - _, err = privateLinkScopesClient.UpdateTags(testsuite.ctx, testsuite.resourceGroupName, testsuite.scopeName, armmonitor.TagsResource{ - Tags: map[string]*string{ - "Tag1": to.Ptr("Value1"), - "Tag2": to.Ptr("Value2"), - }, - }, nil) - testsuite.Require().NoError(err) - - // From step PrivateLinkScopes_Delete - fmt.Println("Call operation: PrivateLinkScopes_Delete") - privateLinkScopesClientDeleteResponsePoller, err := privateLinkScopesClient.BeginDelete(testsuite.ctx, testsuite.resourceGroupName, testsuite.scopeName, nil) - testsuite.Require().NoError(err) - _, err = testutil.PollForTest(testsuite.ctx, privateLinkScopesClientDeleteResponsePoller) - testsuite.Require().NoError(err) -} diff --git a/sdk/resourcemanager/monitor/armmonitor/response_types.go b/sdk/resourcemanager/monitor/armmonitor/response_types.go index e253dc740da9..1f4b4a4cfd5b 100644 --- a/sdk/resourcemanager/monitor/armmonitor/response_types.go +++ b/sdk/resourcemanager/monitor/armmonitor/response_types.go @@ -9,16 +9,11 @@ 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. -type ActionGroupsClientCreateNotificationsAtResourceGroupLevelResponse struct { - TestNotificationDetailsResponse -} - // ActionGroupsClientCreateOrUpdateResponse contains the response from method ActionGroupsClient.CreateOrUpdate. type ActionGroupsClientCreateOrUpdateResponse struct { ActionGroupResource @@ -44,31 +39,16 @@ type ActionGroupsClientGetTestNotificationsAtActionGroupResourceLevelResponse st TestNotificationDetailsResponse } -// ActionGroupsClientGetTestNotificationsAtResourceGroupLevelResponse contains the response from method ActionGroupsClient.GetTestNotificationsAtResourceGroupLevel. -type ActionGroupsClientGetTestNotificationsAtResourceGroupLevelResponse struct { - TestNotificationDetailsResponse -} - -// ActionGroupsClientGetTestNotificationsResponse contains the response from method ActionGroupsClient.GetTestNotifications. -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. -type ActionGroupsClientPostTestNotificationsResponse struct { - TestNotificationDetailsResponse -} - // ActionGroupsClientUpdateResponse contains the response from method ActionGroupsClient.Update. type ActionGroupsClientUpdateResponse struct { ActionGroupResource @@ -89,12 +69,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 +84,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 +94,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 +114,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 +144,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,7 +159,37 @@ 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 } @@ -199,12 +209,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 +239,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 +269,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 +289,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 +309,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 +334,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 +359,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,16 +384,31 @@ type MetricAlertsStatusClientListResponse struct { MetricAlertStatusCollection } -// MetricDefinitionsClientListResponse contains the response from method MetricDefinitionsClient.List. +// MetricDefinitionsClientListAtSubscriptionScopeResponse contains the response from method MetricDefinitionsClient.NewListAtSubscriptionScopePager. +type MetricDefinitionsClientListAtSubscriptionScopeResponse struct { + SubscriptionScopeMetricDefinitionCollection +} + +// 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 } +// MetricsClientListAtSubscriptionScopePostResponse contains the response from method MetricsClient.ListAtSubscriptionScopePost. +type MetricsClientListAtSubscriptionScopePostResponse struct { + SubscriptionScopeMetricResponse +} + +// MetricsClientListAtSubscriptionScopeResponse contains the response from method MetricsClient.ListAtSubscriptionScope. +type MetricsClientListAtSubscriptionScopeResponse struct { + SubscriptionScopeMetricResponse +} + // MetricsClientListResponse contains the response from method MetricsClient.List. type MetricsClientListResponse struct { Response @@ -394,17 +419,22 @@ type OperationsClientListResponse struct { OperationListResult } +// OperationsForMonitorClientListResponse contains the response from method OperationsForMonitorClient.NewListPager. +type OperationsForMonitorClientListResponse struct { + OperationListResultAutoGenerated +} + // PredictiveMetricClientGetResponse contains the response from method PredictiveMetricClient.Get. 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 +464,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 +479,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 +489,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 +499,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 +529,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 +544,32 @@ type ScheduledQueryRulesClientUpdateResponse struct { ScheduledQueryRuleResource } -// TenantActivityLogsClientListResponse contains the response from method TenantActivityLogsClient.List. +// TenantActionGroupsClientCreateOrUpdateResponse contains the response from method TenantActionGroupsClient.CreateOrUpdate. +type TenantActionGroupsClientCreateOrUpdateResponse struct { + TenantActionGroupResource +} + +// TenantActionGroupsClientDeleteResponse contains the response from method TenantActionGroupsClient.Delete. +type TenantActionGroupsClientDeleteResponse struct { + // placeholder for future response values +} + +// TenantActionGroupsClientGetResponse contains the response from method TenantActionGroupsClient.Get. +type TenantActionGroupsClientGetResponse struct { + TenantActionGroupResource +} + +// TenantActionGroupsClientListByManagementGroupIDResponse contains the response from method TenantActionGroupsClient.NewListByManagementGroupIDPager. +type TenantActionGroupsClientListByManagementGroupIDResponse struct { + TenantActionGroupList +} + +// TenantActionGroupsClientUpdateResponse contains the response from method TenantActionGroupsClient.Update. +type TenantActionGroupsClientUpdateResponse struct { + TenantActionGroupResource +} + +// 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/tenantactiongroups_client.go b/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client.go new file mode 100644 index 000000000000..d41b5114ac8d --- /dev/null +++ b/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client.go @@ -0,0 +1,326 @@ +//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" +) + +// TenantActionGroupsClient contains the methods for the TenantActionGroups group. +// Don't use this type directly, use NewTenantActionGroupsClient() instead. +type TenantActionGroupsClient struct { + host string + pl runtime.Pipeline +} + +// NewTenantActionGroupsClient creates a new instance of TenantActionGroupsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewTenantActionGroupsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*TenantActionGroupsClient, error) { + 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 := &TenantActionGroupsClient{ + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Create a new tenant action group or update an existing one. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - managementGroupID - The management group id. +// - tenantActionGroupName - The name of the action group. +// - xmsClientTenantID - The tenant ID of the client making the request. +// - actionGroup - The tenant action group to create or use for the update. +// - options - TenantActionGroupsClientCreateOrUpdateOptions contains the optional parameters for the TenantActionGroupsClient.CreateOrUpdate +// method. +func (client *TenantActionGroupsClient) CreateOrUpdate(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, actionGroup TenantActionGroupResource, options *TenantActionGroupsClientCreateOrUpdateOptions) (TenantActionGroupsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, managementGroupID, tenantActionGroupName, xmsClientTenantID, actionGroup, options) + if err != nil { + return TenantActionGroupsClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return TenantActionGroupsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return TenantActionGroupsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *TenantActionGroupsClient) createOrUpdateCreateRequest(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, actionGroup TenantActionGroupResource, options *TenantActionGroupsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/tenantActionGroups/{tenantActionGroupName}" + if managementGroupID == "" { + return nil, errors.New("parameter managementGroupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) + if tenantActionGroupName == "" { + return nil, errors.New("parameter tenantActionGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tenantActionGroupName}", url.PathEscape(tenantActionGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["x-ms-client-tenant-id"] = []string{xmsClientTenantID} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, actionGroup) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *TenantActionGroupsClient) createOrUpdateHandleResponse(resp *http.Response) (TenantActionGroupsClientCreateOrUpdateResponse, error) { + result := TenantActionGroupsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TenantActionGroupResource); err != nil { + return TenantActionGroupsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete a tenant action group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - managementGroupID - The management group id. +// - tenantActionGroupName - The name of the action group. +// - xmsClientTenantID - The tenant ID of the client making the request. +// - options - TenantActionGroupsClientDeleteOptions contains the optional parameters for the TenantActionGroupsClient.Delete +// method. +func (client *TenantActionGroupsClient) Delete(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, options *TenantActionGroupsClientDeleteOptions) (TenantActionGroupsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, managementGroupID, tenantActionGroupName, xmsClientTenantID, options) + if err != nil { + return TenantActionGroupsClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return TenantActionGroupsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return TenantActionGroupsClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return TenantActionGroupsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *TenantActionGroupsClient) deleteCreateRequest(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, options *TenantActionGroupsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/tenantActionGroups/{tenantActionGroupName}" + if managementGroupID == "" { + return nil, errors.New("parameter managementGroupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) + if tenantActionGroupName == "" { + return nil, errors.New("parameter tenantActionGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tenantActionGroupName}", url.PathEscape(tenantActionGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["x-ms-client-tenant-id"] = []string{xmsClientTenantID} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a tenant action group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - managementGroupID - The management group id. +// - tenantActionGroupName - The name of the action group. +// - xmsClientTenantID - The tenant ID of the client making the request. +// - options - TenantActionGroupsClientGetOptions contains the optional parameters for the TenantActionGroupsClient.Get method. +func (client *TenantActionGroupsClient) Get(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, options *TenantActionGroupsClientGetOptions) (TenantActionGroupsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, managementGroupID, tenantActionGroupName, xmsClientTenantID, options) + if err != nil { + return TenantActionGroupsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return TenantActionGroupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return TenantActionGroupsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *TenantActionGroupsClient) getCreateRequest(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, options *TenantActionGroupsClientGetOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/tenantActionGroups/{tenantActionGroupName}" + if managementGroupID == "" { + return nil, errors.New("parameter managementGroupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) + if tenantActionGroupName == "" { + return nil, errors.New("parameter tenantActionGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tenantActionGroupName}", url.PathEscape(tenantActionGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["x-ms-client-tenant-id"] = []string{xmsClientTenantID} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *TenantActionGroupsClient) getHandleResponse(resp *http.Response) (TenantActionGroupsClientGetResponse, error) { + result := TenantActionGroupsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TenantActionGroupResource); err != nil { + return TenantActionGroupsClientGetResponse{}, err + } + return result, nil +} + +// NewListByManagementGroupIDPager - Get a list of all tenant action groups in a management group. +// +// Generated from API version 2023-03-01-preview +// - managementGroupID - The management group id. +// - xmsClientTenantID - The tenant ID of the client making the request. +// - options - TenantActionGroupsClientListByManagementGroupIDOptions contains the optional parameters for the TenantActionGroupsClient.NewListByManagementGroupIDPager +// method. +func (client *TenantActionGroupsClient) NewListByManagementGroupIDPager(managementGroupID string, xmsClientTenantID string, options *TenantActionGroupsClientListByManagementGroupIDOptions) *runtime.Pager[TenantActionGroupsClientListByManagementGroupIDResponse] { + return runtime.NewPager(runtime.PagingHandler[TenantActionGroupsClientListByManagementGroupIDResponse]{ + More: func(page TenantActionGroupsClientListByManagementGroupIDResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *TenantActionGroupsClientListByManagementGroupIDResponse) (TenantActionGroupsClientListByManagementGroupIDResponse, error) { + req, err := client.listByManagementGroupIDCreateRequest(ctx, managementGroupID, xmsClientTenantID, options) + if err != nil { + return TenantActionGroupsClientListByManagementGroupIDResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return TenantActionGroupsClientListByManagementGroupIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return TenantActionGroupsClientListByManagementGroupIDResponse{}, runtime.NewResponseError(resp) + } + return client.listByManagementGroupIDHandleResponse(resp) + }, + }) +} + +// listByManagementGroupIDCreateRequest creates the ListByManagementGroupID request. +func (client *TenantActionGroupsClient) listByManagementGroupIDCreateRequest(ctx context.Context, managementGroupID string, xmsClientTenantID string, options *TenantActionGroupsClientListByManagementGroupIDOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/tenantActionGroups" + if managementGroupID == "" { + return nil, errors.New("parameter managementGroupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["x-ms-client-tenant-id"] = []string{xmsClientTenantID} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByManagementGroupIDHandleResponse handles the ListByManagementGroupID response. +func (client *TenantActionGroupsClient) listByManagementGroupIDHandleResponse(resp *http.Response) (TenantActionGroupsClientListByManagementGroupIDResponse, error) { + result := TenantActionGroupsClientListByManagementGroupIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TenantActionGroupList); err != nil { + return TenantActionGroupsClientListByManagementGroupIDResponse{}, err + } + return result, nil +} + +// Update - Updates an existing tenant action group's tags. To update other fields use the CreateOrUpdate method. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - managementGroupID - The management group id. +// - tenantActionGroupName - The name of the action group. +// - xmsClientTenantID - The tenant ID of the client making the request. +// - tenantActionGroupPatch - Parameters supplied to the operation. +// - options - TenantActionGroupsClientUpdateOptions contains the optional parameters for the TenantActionGroupsClient.Update +// method. +func (client *TenantActionGroupsClient) Update(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, tenantActionGroupPatch ActionGroupPatchBodyAutoGenerated, options *TenantActionGroupsClientUpdateOptions) (TenantActionGroupsClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, managementGroupID, tenantActionGroupName, xmsClientTenantID, tenantActionGroupPatch, options) + if err != nil { + return TenantActionGroupsClientUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return TenantActionGroupsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return TenantActionGroupsClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *TenantActionGroupsClient) updateCreateRequest(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, tenantActionGroupPatch ActionGroupPatchBodyAutoGenerated, options *TenantActionGroupsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/tenantActionGroups/{tenantActionGroupName}" + if managementGroupID == "" { + return nil, errors.New("parameter managementGroupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) + if tenantActionGroupName == "" { + return nil, errors.New("parameter tenantActionGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tenantActionGroupName}", url.PathEscape(tenantActionGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["x-ms-client-tenant-id"] = []string{xmsClientTenantID} + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, tenantActionGroupPatch) +} + +// updateHandleResponse handles the Update response. +func (client *TenantActionGroupsClient) updateHandleResponse(resp *http.Response) (TenantActionGroupsClientUpdateResponse, error) { + result := TenantActionGroupsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TenantActionGroupResource); err != nil { + return TenantActionGroupsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/monitor/armmonitor/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 -}