From 90170bd04aa36f2ab15704a6bfd1fba693fc751f Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 21 Jul 2022 06:08:03 +0000 Subject: [PATCH] CodeGen from PR 19652 in Azure/azure-rest-api-specs Merge 581d2598ef61936e120d03263100d5b920bf18a6 into 9ae616c4a5447e9cae43752b68f089bff2e46398 --- .../monitor/armmonitor/CHANGELOG.md | 118 + ...roups_client.go => actiongroups_client.go} | 7 +- ..._client.go => activitylogalerts_client.go} | 1 + ...ylogs_client.go => activitylogs_client.go} | 1 + ...client.go => alertruleincidents_client.go} | 1 + ...rtrules_client.go => alertrules_client.go} | 1 + .../monitor/armmonitor/autorest.md | 6 +- ..._client.go => autoscalesettings_client.go} | 25 +- ...aselines_client.go => baselines_client.go} | 1 + ...zz_generated_constants.go => constants.go} | 168 +- ...t.go => datacollectionendpoints_client.go} | 25 +- ... datacollectionruleassociations_client.go} | 13 +- ...lient.go => datacollectionrules_client.go} | 25 +- ...client.go => diagnosticsettings_client.go} | 1 + ...o => diagnosticsettingscategory_client.go} | 1 + ...es_client.go => eventcategories_client.go} | 1 + sdk/resourcemanager/monitor/armmonitor/go.mod | 14 +- sdk/resourcemanager/monitor/armmonitor/go.sum | 24 +- ...ofiles_client.go => logprofiles_client.go} | 1 + ...lerts_client.go => metricalerts_client.go} | 1 + ...client.go => metricalertsstatus_client.go} | 1 + ..._client.go => metricdefinitions_client.go} | 1 + ...s_client.go => metricnamespaces_client.go} | 1 + ...ed_metrics_client.go => metrics_client.go} | 1 + .../{zz_generated_models.go => models.go} | 638 +- .../monitor/armmonitor/models_serde.go | 8739 +++++++++++++++++ ...rations_client.go => operations_client.go} | 1 + ...phic_helpers.go => polymorphic_helpers.go} | 21 +- .../armmonitor/predictivemetric_client.go | 123 + ...o => privateendpointconnections_client.go} | 1 + ...ient.go => privatelinkresources_client.go} | 1 + ...o => privatelinkscopedresources_client.go} | 1 + ...privatelinkscopeoperationstatus_client.go} | 1 + ..._client.go => privatelinkscopes_client.go} | 1 + ...ed_response_types.go => response_types.go} | 22 +- ...lient.go => scheduledqueryrules_client.go} | 115 +- ...client.go => tenantactivitylogs_client.go} | 1 + ...erated_time_rfc3339.go => time_rfc3339.go} | 1 + ...nsights_client.go => vminsights_client.go} | 1 + ...erated_example_actiongroups_client_test.go | 708 -- ...d_example_activitylogalerts_client_test.go | 168 - ...erated_example_activitylogs_client_test.go | 42 - ..._example_alertruleincidents_client_test.go | 66 - ...enerated_example_alertrules_client_test.go | 198 - ...d_example_autoscalesettings_client_test.go | 428 - ...generated_example_baselines_client_test.go | 51 - ...ple_datacollectionendpoints_client_test.go | 168 - ...acollectionruleassociations_client_test.go | 164 - ...example_datacollectionrules_client_test.go | 242 - ..._example_diagnosticsettings_client_test.go | 130 - ..._diagnosticsettingscategory_client_test.go | 60 - ...ted_example_eventcategories_client_test.go | 41 - ...nerated_example_logprofiles_client_test.go | 161 - ...erated_example_metricalerts_client_test.go | 230 - ..._example_metricalertsstatus_client_test.go | 62 - ...d_example_metricdefinitions_client_test.go | 43 - ...ed_example_metricnamespaces_client_test.go | 43 - ...e_generated_example_metrics_client_test.go | 48 - ...enerated_example_operations_client_test.go | 37 - ..._privateendpointconnections_client_test.go | 127 - ...xample_privatelinkresources_client_test.go | 66 - ..._privatelinkscopedresources_client_test.go | 124 - ...atelinkscopeoperationstatus_client_test.go | 39 - ...d_example_privatelinkscopes_client_test.go | 167 - ...example_scheduledqueryrules_client_test.go | 194 - ..._example_tenantactivitylogs_client_test.go | 44 - ...enerated_example_vminsights_client_test.go | 38 - .../armmonitor/zz_generated_models_serde.go | 2265 ----- 68 files changed, 9574 insertions(+), 6686 deletions(-) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_actiongroups_client.go => actiongroups_client.go} (99%) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_activitylogalerts_client.go => activitylogalerts_client.go} (99%) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_activitylogs_client.go => activitylogs_client.go} (99%) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_alertruleincidents_client.go => alertruleincidents_client.go} (99%) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_alertrules_client.go => alertrules_client.go} (99%) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_autoscalesettings_client.go => autoscalesettings_client.go} (97%) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_baselines_client.go => baselines_client.go} (99%) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_constants.go => constants.go} (92%) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_datacollectionendpoints_client.go => datacollectionendpoints_client.go} (96%) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_datacollectionruleassociations_client.go => datacollectionruleassociations_client.go} (97%) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_datacollectionrules_client.go => datacollectionrules_client.go} (95%) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_diagnosticsettings_client.go => diagnosticsettings_client.go} (99%) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_diagnosticsettingscategory_client.go => diagnosticsettingscategory_client.go} (99%) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_eventcategories_client.go => eventcategories_client.go} (99%) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_logprofiles_client.go => logprofiles_client.go} (99%) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_metricalerts_client.go => metricalerts_client.go} (99%) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_metricalertsstatus_client.go => metricalertsstatus_client.go} (99%) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_metricdefinitions_client.go => metricdefinitions_client.go} (99%) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_metricnamespaces_client.go => metricnamespaces_client.go} (99%) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_metrics_client.go => metrics_client.go} (99%) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_models.go => models.go} (92%) create mode 100644 sdk/resourcemanager/monitor/armmonitor/models_serde.go rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_operations_client.go => operations_client.go} (99%) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_polymorphic_helpers.go => polymorphic_helpers.go} (86%) create mode 100644 sdk/resourcemanager/monitor/armmonitor/predictivemetric_client.go rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_privateendpointconnections_client.go => privateendpointconnections_client.go} (99%) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_privatelinkresources_client.go => privatelinkresources_client.go} (99%) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_privatelinkscopedresources_client.go => privatelinkscopedresources_client.go} (99%) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_privatelinkscopeoperationstatus_client.go => privatelinkscopeoperationstatus_client.go} (99%) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_privatelinkscopes_client.go => privatelinkscopes_client.go} (99%) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_response_types.go => response_types.go} (97%) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_scheduledqueryrules_client.go => scheduledqueryrules_client.go} (85%) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_tenantactivitylogs_client.go => tenantactivitylogs_client.go} (99%) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_time_rfc3339.go => time_rfc3339.go} (99%) rename sdk/resourcemanager/monitor/armmonitor/{zz_generated_vminsights_client.go => vminsights_client.go} (99%) delete mode 100644 sdk/resourcemanager/monitor/armmonitor/ze_generated_example_actiongroups_client_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/ze_generated_example_activitylogalerts_client_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/ze_generated_example_activitylogs_client_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/ze_generated_example_alertruleincidents_client_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/ze_generated_example_alertrules_client_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/ze_generated_example_autoscalesettings_client_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/ze_generated_example_baselines_client_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/ze_generated_example_datacollectionendpoints_client_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/ze_generated_example_datacollectionruleassociations_client_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/ze_generated_example_datacollectionrules_client_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/ze_generated_example_diagnosticsettings_client_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/ze_generated_example_diagnosticsettingscategory_client_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/ze_generated_example_eventcategories_client_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/ze_generated_example_logprofiles_client_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/ze_generated_example_metricalerts_client_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/ze_generated_example_metricalertsstatus_client_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/ze_generated_example_metricdefinitions_client_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/ze_generated_example_metricnamespaces_client_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/ze_generated_example_metrics_client_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/ze_generated_example_operations_client_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/ze_generated_example_privateendpointconnections_client_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/ze_generated_example_privatelinkresources_client_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/ze_generated_example_privatelinkscopedresources_client_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/ze_generated_example_privatelinkscopeoperationstatus_client_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/ze_generated_example_privatelinkscopes_client_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/ze_generated_example_scheduledqueryrules_client_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/ze_generated_example_tenantactivitylogs_client_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/ze_generated_example_vminsights_client_test.go delete mode 100644 sdk/resourcemanager/monitor/armmonitor/zz_generated_models_serde.go diff --git a/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md b/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md index c58dc93717e6..be2116d7b66a 100644 --- a/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md +++ b/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md @@ -1,5 +1,123 @@ # Release History +## 0.8.0 (2022-07-21) +### Breaking Changes + +- Function `*DataCollectionEndpointsClient.Create` parameter(s) have been changed from `(context.Context, string, string, *DataCollectionEndpointsClientCreateOptions)` to `(context.Context, string, string, DataCollectionEndpointResource, *DataCollectionEndpointsClientCreateOptions)` +- Function `*DataCollectionRulesClient.Update` parameter(s) have been changed from `(context.Context, string, string, *DataCollectionRulesClientUpdateOptions)` to `(context.Context, string, string, ResourceForUpdate, *DataCollectionRulesClientUpdateOptions)` +- Function `*DataCollectionEndpointsClient.Update` parameter(s) have been changed from `(context.Context, string, string, *DataCollectionEndpointsClientUpdateOptions)` to `(context.Context, string, string, ResourceForUpdate, *DataCollectionEndpointsClientUpdateOptions)` +- Function `*DataCollectionRulesClient.Create` parameter(s) have been changed from `(context.Context, string, string, *DataCollectionRulesClientCreateOptions)` to `(context.Context, string, string, DataCollectionRuleResource, *DataCollectionRulesClientCreateOptions)` +- Function `*ScheduledQueryRulesClient.CreateOrUpdate` parameter(s) have been changed from `(context.Context, string, string, LogSearchRuleResource, *ScheduledQueryRulesClientCreateOrUpdateOptions)` to `(context.Context, string, string, ScheduledQueryRuleResource, *ScheduledQueryRulesClientCreateOrUpdateOptions)` +- Function `*DataCollectionRuleAssociationsClient.Create` parameter(s) have been changed from `(context.Context, string, string, *DataCollectionRuleAssociationsClientCreateOptions)` to `(context.Context, string, string, DataCollectionRuleAssociationProxyOnlyResource, *DataCollectionRuleAssociationsClientCreateOptions)` +- Function `*ScheduledQueryRulesClient.Update` parameter(s) have been changed from `(context.Context, string, string, LogSearchRuleResourcePatch, *ScheduledQueryRulesClientUpdateOptions)` to `(context.Context, string, string, ScheduledQueryRuleResourcePatch, *ScheduledQueryRulesClientUpdateOptions)` +- Type of `Dimension.Operator` has been changed from `*Operator` to `*DimensionOperator` +- Type of `ErrorContract.Error` has been changed from `*ErrorResponse` to `*ErrorResponseDetails` +- Const `ConditionalOperatorGreaterThanOrEqual` has been removed +- Const `ConditionalOperatorEqual` has been removed +- Const `MetricTriggerTypeConsecutive` has been removed +- Const `ProvisioningStateSucceeded` has been removed +- Const `QueryTypeResultCount` has been removed +- Const `ProvisioningStateCanceled` has been removed +- Const `EnabledTrue` has been removed +- Const `ProvisioningStateFailed` has been removed +- Const `ConditionalOperatorLessThan` has been removed +- Const `ProvisioningStateDeploying` has been removed +- Const `ConditionalOperatorGreaterThan` has been removed +- Const `OperatorInclude` has been removed +- Const `MetricTriggerTypeTotal` has been removed +- Const `EnabledFalse` has been removed +- Const `ConditionalOperatorLessThanOrEqual` has been removed +- Function `*LogToMetricAction.GetAction` has been removed +- Function `PossibleMetricTriggerTypeValues` has been removed +- Function `PossibleQueryTypeValues` has been removed +- Function `*AlertingAction.GetAction` has been removed +- Function `PossibleEnabledValues` has been removed +- Function `PossibleProvisioningStateValues` has been removed +- Function `PossibleConditionalOperatorValues` has been removed +- Function `*Action.GetAction` has been removed +- Struct `Action` has been removed +- Struct `AlertingAction` has been removed +- Struct `AzNsActionGroup` has been removed +- Struct `Criteria` has been removed +- Struct `LogMetricTrigger` has been removed +- Struct `LogSearchRule` has been removed +- Struct `LogSearchRulePatch` has been removed +- Struct `LogSearchRuleResource` has been removed +- Struct `LogSearchRuleResourceCollection` has been removed +- Struct `LogSearchRuleResourcePatch` has been removed +- Struct `LogToMetricAction` has been removed +- Struct `Schedule` has been removed +- Struct `Source` has been removed +- Struct `TrackedEntityResource` has been removed +- Struct `TriggerCondition` has been removed +- Field `LogSearchRuleResource` of struct `ScheduledQueryRulesClientCreateOrUpdateResponse` has been removed +- Field `LogSearchRuleResource` of struct `ScheduledQueryRulesClientUpdateResponse` has been removed +- Field `LogSearchRuleResourceCollection` of struct `ScheduledQueryRulesClientListBySubscriptionResponse` has been removed +- Field `LogSearchRuleResourceCollection` of struct `ScheduledQueryRulesClientListByResourceGroupResponse` has been removed +- Field `Body` of struct `DataCollectionEndpointsClientUpdateOptions` has been removed +- Field `Filter` of struct `ScheduledQueryRulesClientListByResourceGroupOptions` has been removed +- Field `Body` of struct `DataCollectionRuleAssociationsClientCreateOptions` has been removed +- Field `Body` of struct `DataCollectionRulesClientCreateOptions` has been removed +- Field `LogSearchRuleResource` of struct `ScheduledQueryRulesClientGetResponse` has been removed +- Field `Body` of struct `DataCollectionEndpointsClientCreateOptions` has been removed +- Field `Filter` of struct `ScheduledQueryRulesClientListBySubscriptionOptions` has been removed +- Field `Body` of struct `DataCollectionRulesClientUpdateOptions` has been removed + +### Features Added + +- New const `DimensionOperatorInclude` +- New const `TimeAggregationMinimum` +- New const `PredictiveAutoscalePolicyScaleModeForecastOnly` +- New const `TimeAggregationTotal` +- New const `ConditionOperatorEquals` +- New const `PredictiveAutoscalePolicyScaleModeDisabled` +- New const `PredictiveAutoscalePolicyScaleModeEnabled` +- New const `TimeAggregationCount` +- New const `TimeAggregationAverage` +- New const `KindLogAlert` +- New const `TimeAggregationMaximum` +- New const `DimensionOperatorExclude` +- New const `KindLogToMetric` +- New function `PossibleDimensionOperatorValues() []DimensionOperator` +- New function `PossiblePredictiveAutoscalePolicyScaleModeValues() []PredictiveAutoscalePolicyScaleMode` +- New function `NewPredictiveMetricClient(string, azcore.TokenCredential, *arm.ClientOptions) (*PredictiveMetricClient, error)` +- New function `*PredictiveMetricClient.Get(context.Context, string, string, string, string, string, string, string, *PredictiveMetricClientGetOptions) (PredictiveMetricClientGetResponse, error)` +- New function `PossibleTimeAggregationValues() []TimeAggregation` +- New function `PossibleKindValues() []Kind` +- New struct `Actions` +- New struct `AutoscaleErrorResponse` +- New struct `AutoscaleErrorResponseError` +- New struct `Condition` +- New struct `ConditionFailingPeriods` +- New struct `ErrorResponseAdditionalInfo` +- New struct `ErrorResponseDetails` +- New struct `PredictiveAutoscalePolicy` +- New struct `PredictiveMetricClient` +- New struct `PredictiveMetricClientGetOptions` +- New struct `PredictiveMetricClientGetResponse` +- New struct `PredictiveResponse` +- New struct `PredictiveValue` +- New struct `ResourceAutoGenerated` +- New struct `ResourceAutoGenerated2` +- New struct `ResourceAutoGenerated3` +- New struct `ScheduledQueryRuleCriteria` +- New struct `ScheduledQueryRuleProperties` +- New struct `ScheduledQueryRuleResource` +- New struct `ScheduledQueryRuleResourceCollection` +- New struct `ScheduledQueryRuleResourcePatch` +- New field `SystemData` in struct `Resource` +- New anonymous field `ScheduledQueryRuleResource` in struct `ScheduledQueryRulesClientGetResponse` +- New field `PredictiveAutoscalePolicy` in struct `AutoscaleSetting` +- New anonymous field `ScheduledQueryRuleResource` in struct `ScheduledQueryRulesClientUpdateResponse` +- New anonymous field `ScheduledQueryRuleResource` in struct `ScheduledQueryRulesClientCreateOrUpdateResponse` +- New anonymous field `TestNotificationDetailsResponse` in struct `ActionGroupsClientCreateNotificationsAtResourceGroupLevelResponse` +- New anonymous field `TestNotificationDetailsResponse` in struct `ActionGroupsClientPostTestNotificationsResponse` +- New anonymous field `ScheduledQueryRuleResourceCollection` in struct `ScheduledQueryRulesClientListByResourceGroupResponse` +- New field `SystemData` in struct `AutoscaleSettingResource` +- New anonymous field `ScheduledQueryRuleResourceCollection` in struct `ScheduledQueryRulesClientListBySubscriptionResponse` +- New anonymous field `TestNotificationDetailsResponse` in struct `ActionGroupsClientCreateNotificationsAtActionGroupResourceLevelResponse` + + ## 0.7.0 (2022-05-17) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 0.7.0, which contains breaking changes. diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_actiongroups_client.go b/sdk/resourcemanager/monitor/armmonitor/actiongroups_client.go similarity index 99% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_actiongroups_client.go rename to sdk/resourcemanager/monitor/armmonitor/actiongroups_client.go index 38d2225334a9..e165d461364a 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_actiongroups_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/actiongroups_client.go @@ -5,6 +5,7 @@ // 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 @@ -88,7 +89,7 @@ func (client *ActionGroupsClient) createNotificationsAtActionGroupResourceLevel( if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, runtime.NewResponseError(resp) } return resp, nil @@ -153,7 +154,7 @@ func (client *ActionGroupsClient) createNotificationsAtResourceGroupLevel(ctx co if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, runtime.NewResponseError(resp) } return resp, nil @@ -708,7 +709,7 @@ func (client *ActionGroupsClient) postTestNotifications(ctx context.Context, not if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, runtime.NewResponseError(resp) } return resp, nil diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_activitylogalerts_client.go b/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client.go similarity index 99% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_activitylogalerts_client.go rename to sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client.go index 4cd54a91ef24..01ff5f1a7a97 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_activitylogalerts_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client.go @@ -5,6 +5,7 @@ // 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 diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_activitylogs_client.go b/sdk/resourcemanager/monitor/armmonitor/activitylogs_client.go similarity index 99% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_activitylogs_client.go rename to sdk/resourcemanager/monitor/armmonitor/activitylogs_client.go index c36fd37a13c2..c3d813b299a2 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_activitylogs_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/activitylogs_client.go @@ -5,6 +5,7 @@ // 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 diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_alertruleincidents_client.go b/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client.go similarity index 99% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_alertruleincidents_client.go rename to sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client.go index 12f912fa64e0..f0796ddab254 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_alertruleincidents_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client.go @@ -5,6 +5,7 @@ // 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 diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_alertrules_client.go b/sdk/resourcemanager/monitor/armmonitor/alertrules_client.go similarity index 99% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_alertrules_client.go rename to sdk/resourcemanager/monitor/armmonitor/alertrules_client.go index 97b1a5e847bc..a4e0ff2ff86d 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_alertrules_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/alertrules_client.go @@ -5,6 +5,7 @@ // 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 diff --git a/sdk/resourcemanager/monitor/armmonitor/autorest.md b/sdk/resourcemanager/monitor/armmonitor/autorest.md index 887854abbc69..8f782a70ea38 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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/monitor/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/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.7.0 +module-version: 0.8.0 ``` diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_autoscalesettings_client.go b/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client.go similarity index 97% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_autoscalesettings_client.go rename to sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client.go index 9d3125da47dd..6de479c8a809 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_autoscalesettings_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client.go @@ -5,6 +5,7 @@ // 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 @@ -56,7 +57,7 @@ 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 2015-04-01 +// 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. @@ -97,7 +98,7 @@ func (client *AutoscaleSettingsClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-04-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -114,7 +115,7 @@ 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 2015-04-01 +// 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 @@ -154,7 +155,7 @@ func (client *AutoscaleSettingsClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-04-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -162,7 +163,7 @@ 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 2015-04-01 +// 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. @@ -201,7 +202,7 @@ func (client *AutoscaleSettingsClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-04-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -218,7 +219,7 @@ func (client *AutoscaleSettingsClient) getHandleResponse(resp *http.Response) (A // NewListByResourceGroupPager - Lists the autoscale settings for a resource group // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2015-04-01 +// 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. @@ -266,7 +267,7 @@ func (client *AutoscaleSettingsClient) listByResourceGroupCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-04-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -283,7 +284,7 @@ func (client *AutoscaleSettingsClient) listByResourceGroupHandleResponse(resp *h // NewListBySubscriptionPager - Lists the autoscale settings for a subscription // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2015-04-01 +// Generated from API version 2022-10-01 // options - AutoscaleSettingsClientListBySubscriptionOptions contains the optional parameters for the AutoscaleSettingsClient.ListBySubscription // method. func (client *AutoscaleSettingsClient) NewListBySubscriptionPager(options *AutoscaleSettingsClientListBySubscriptionOptions) *runtime.Pager[AutoscaleSettingsClientListBySubscriptionResponse] { @@ -326,7 +327,7 @@ func (client *AutoscaleSettingsClient) listBySubscriptionCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-04-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -343,7 +344,7 @@ 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 2015-04-01 +// 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. @@ -384,7 +385,7 @@ func (client *AutoscaleSettingsClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-04-01") + reqQP.Set("api-version", "2022-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, autoscaleSettingResource) diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_baselines_client.go b/sdk/resourcemanager/monitor/armmonitor/baselines_client.go similarity index 99% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_baselines_client.go rename to sdk/resourcemanager/monitor/armmonitor/baselines_client.go index 430b7f1ca98e..66747e146160 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_baselines_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/baselines_client.go @@ -5,6 +5,7 @@ // 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 diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_constants.go b/sdk/resourcemanager/monitor/armmonitor/constants.go similarity index 92% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_constants.go rename to sdk/resourcemanager/monitor/armmonitor/constants.go index 47f710600dfc..52d472939bba 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_constants.go +++ b/sdk/resourcemanager/monitor/armmonitor/constants.go @@ -5,12 +5,13 @@ // 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 const ( moduleName = "armmonitor" - moduleVersion = "v0.7.0" + moduleVersion = "v0.8.0" ) // AggregationType - the aggregation type of the metric. @@ -59,15 +60,16 @@ func PossibleAggregationTypeEnumValues() []AggregationTypeEnum { } } -// AlertSeverity - Severity Level of Alert -type AlertSeverity string +// AlertSeverity - Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. Relevant and required +// only for rules of the kind LogAlert. +type AlertSeverity int64 const ( - AlertSeverityFour AlertSeverity = "4" - AlertSeverityOne AlertSeverity = "1" - AlertSeverityThree AlertSeverity = "3" - AlertSeverityTwo AlertSeverity = "2" - AlertSeverityZero AlertSeverity = "0" + AlertSeverityFour AlertSeverity = 4 + AlertSeverityOne AlertSeverity = 1 + AlertSeverityThree AlertSeverity = 3 + AlertSeverityTwo AlertSeverity = 2 + AlertSeverityZero AlertSeverity = 0 ) // PossibleAlertSeverityValues returns the possible values for the AlertSeverity const type. @@ -147,6 +149,7 @@ const ( ConditionOperatorGreaterThanOrEqual ConditionOperator = "GreaterThanOrEqual" ConditionOperatorLessThan ConditionOperator = "LessThan" ConditionOperatorLessThanOrEqual ConditionOperator = "LessThanOrEqual" + ConditionOperatorEquals ConditionOperator = "Equals" ) // PossibleConditionOperatorValues returns the possible values for the ConditionOperator const type. @@ -156,28 +159,7 @@ func PossibleConditionOperatorValues() []ConditionOperator { ConditionOperatorGreaterThanOrEqual, ConditionOperatorLessThan, ConditionOperatorLessThanOrEqual, - } -} - -// ConditionalOperator - Result Condition Evaluation criteria. -type ConditionalOperator string - -const ( - ConditionalOperatorEqual ConditionalOperator = "Equal" - ConditionalOperatorGreaterThan ConditionalOperator = "GreaterThan" - ConditionalOperatorGreaterThanOrEqual ConditionalOperator = "GreaterThanOrEqual" - ConditionalOperatorLessThan ConditionalOperator = "LessThan" - ConditionalOperatorLessThanOrEqual ConditionalOperator = "LessThanOrEqual" -) - -// PossibleConditionalOperatorValues returns the possible values for the ConditionalOperator const type. -func PossibleConditionalOperatorValues() []ConditionalOperator { - return []ConditionalOperator{ - ConditionalOperatorEqual, - ConditionalOperatorGreaterThan, - ConditionalOperatorGreaterThanOrEqual, - ConditionalOperatorLessThan, - ConditionalOperatorLessThanOrEqual, + ConditionOperatorEquals, } } @@ -234,6 +216,22 @@ func PossibleDataStatusValues() []DataStatus { } } +// DimensionOperator - Operator for dimension values +type DimensionOperator string + +const ( + DimensionOperatorExclude DimensionOperator = "Exclude" + DimensionOperatorInclude DimensionOperator = "Include" +) + +// PossibleDimensionOperatorValues returns the possible values for the DimensionOperator const type. +func PossibleDimensionOperatorValues() []DimensionOperator { + return []DimensionOperator{ + DimensionOperatorExclude, + DimensionOperatorInclude, + } +} + // DynamicThresholdOperator - The operator used to compare the metric value against the threshold. type DynamicThresholdOperator string @@ -271,22 +269,6 @@ func PossibleDynamicThresholdSensitivityValues() []DynamicThresholdSensitivity { } } -// Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false -type Enabled string - -const ( - EnabledFalse Enabled = "false" - EnabledTrue Enabled = "true" -) - -// PossibleEnabledValues returns the possible values for the Enabled const type. -func PossibleEnabledValues() []Enabled { - return []Enabled{ - EnabledFalse, - EnabledTrue, - } -} - // EventLevel - the event level type EventLevel string @@ -309,6 +291,22 @@ func PossibleEventLevelValues() []EventLevel { } } +// Kind - Indicates the type of scheduled query rule. The default is LogAlert. +type Kind string + +const ( + KindLogAlert Kind = "LogAlert" + KindLogToMetric Kind = "LogToMetric" +) + +// PossibleKindValues returns the possible values for the Kind const type. +func PossibleKindValues() []Kind { + return []Kind{ + KindLogAlert, + KindLogToMetric, + } +} + // KnownColumnDefinitionType - The type of the column data. type KnownColumnDefinitionType string @@ -705,22 +703,6 @@ func PossibleMetricStatisticTypeValues() []MetricStatisticType { } } -// MetricTriggerType - Metric Trigger Evaluation Type -type MetricTriggerType string - -const ( - MetricTriggerTypeConsecutive MetricTriggerType = "Consecutive" - MetricTriggerTypeTotal MetricTriggerType = "Total" -) - -// PossibleMetricTriggerTypeValues returns the possible values for the MetricTriggerType const type. -func PossibleMetricTriggerTypeValues() []MetricTriggerType { - return []MetricTriggerType{ - MetricTriggerTypeConsecutive, - MetricTriggerTypeTotal, - } -} - // MetricUnit - The unit of the metric. type MetricUnit string @@ -821,7 +803,6 @@ const ( OperatorEquals Operator = "Equals" OperatorGreaterThan Operator = "GreaterThan" OperatorGreaterThanOrEqual Operator = "GreaterThanOrEqual" - OperatorInclude Operator = "Include" OperatorLessThan Operator = "LessThan" OperatorLessThanOrEqual Operator = "LessThanOrEqual" ) @@ -832,43 +813,26 @@ func PossibleOperatorValues() []Operator { OperatorEquals, OperatorGreaterThan, OperatorGreaterThanOrEqual, - OperatorInclude, OperatorLessThan, OperatorLessThanOrEqual, } } -// ProvisioningState - Provisioning state of the scheduled query rule -type ProvisioningState string - -const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateDeploying ProvisioningState = "Deploying" - ProvisioningStateFailed ProvisioningState = "Failed" - ProvisioningStateSucceeded ProvisioningState = "Succeeded" -) - -// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ - ProvisioningStateCanceled, - ProvisioningStateDeploying, - ProvisioningStateFailed, - ProvisioningStateSucceeded, - } -} - -// QueryType - Set value to 'ResultAccount' -type QueryType string +// PredictiveAutoscalePolicyScaleMode - the predictive autoscale mode +type PredictiveAutoscalePolicyScaleMode string const ( - QueryTypeResultCount QueryType = "ResultCount" + PredictiveAutoscalePolicyScaleModeDisabled PredictiveAutoscalePolicyScaleMode = "Disabled" + PredictiveAutoscalePolicyScaleModeForecastOnly PredictiveAutoscalePolicyScaleMode = "ForecastOnly" + PredictiveAutoscalePolicyScaleModeEnabled PredictiveAutoscalePolicyScaleMode = "Enabled" ) -// PossibleQueryTypeValues returns the possible values for the QueryType const type. -func PossibleQueryTypeValues() []QueryType { - return []QueryType{ - QueryTypeResultCount, +// PossiblePredictiveAutoscalePolicyScaleModeValues returns the possible values for the PredictiveAutoscalePolicyScaleMode const type. +func PossiblePredictiveAutoscalePolicyScaleModeValues() []PredictiveAutoscalePolicyScaleMode { + return []PredictiveAutoscalePolicyScaleMode{ + PredictiveAutoscalePolicyScaleModeDisabled, + PredictiveAutoscalePolicyScaleModeForecastOnly, + PredictiveAutoscalePolicyScaleModeEnabled, } } @@ -990,6 +954,28 @@ func PossibleScaleTypeValues() []ScaleType { } } +// TimeAggregation - Aggregation type. Relevant and required only for rules of the kind LogAlert. +type TimeAggregation string + +const ( + TimeAggregationAverage TimeAggregation = "Average" + TimeAggregationCount TimeAggregation = "Count" + TimeAggregationMaximum TimeAggregation = "Maximum" + TimeAggregationMinimum TimeAggregation = "Minimum" + TimeAggregationTotal TimeAggregation = "Total" +) + +// PossibleTimeAggregationValues returns the possible values for the TimeAggregation const type. +func PossibleTimeAggregationValues() []TimeAggregation { + return []TimeAggregation{ + TimeAggregationAverage, + TimeAggregationCount, + TimeAggregationMaximum, + TimeAggregationMinimum, + TimeAggregationTotal, + } +} + // TimeAggregationOperator - Aggregation operators allowed in a rule. type TimeAggregationOperator string diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_datacollectionendpoints_client.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client.go similarity index 96% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_datacollectionendpoints_client.go rename to sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client.go index 6bb3aa2dc991..77b3c6aac2d6 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_datacollectionendpoints_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client.go @@ -5,6 +5,7 @@ // 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 @@ -59,10 +60,11 @@ func NewDataCollectionEndpointsClient(subscriptionID string, credential azcore.T // 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. +// body - The payload // options - DataCollectionEndpointsClientCreateOptions contains the optional parameters for the DataCollectionEndpointsClient.Create // method. -func (client *DataCollectionEndpointsClient) Create(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientCreateOptions) (DataCollectionEndpointsClientCreateResponse, error) { - req, err := client.createCreateRequest(ctx, resourceGroupName, dataCollectionEndpointName, options) +func (client *DataCollectionEndpointsClient) Create(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body DataCollectionEndpointResource, options *DataCollectionEndpointsClientCreateOptions) (DataCollectionEndpointsClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, dataCollectionEndpointName, body, options) if err != nil { return DataCollectionEndpointsClientCreateResponse{}, err } @@ -77,7 +79,7 @@ func (client *DataCollectionEndpointsClient) Create(ctx context.Context, resourc } // createCreateRequest creates the Create request. -func (client *DataCollectionEndpointsClient) createCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientCreateOptions) (*policy.Request, error) { +func (client *DataCollectionEndpointsClient) createCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body DataCollectionEndpointResource, options *DataCollectionEndpointsClientCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -99,10 +101,7 @@ func (client *DataCollectionEndpointsClient) createCreateRequest(ctx context.Con reqQP.Set("api-version", "2021-09-01-preview") 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 + return req, runtime.MarshalAsJSON(req, body) } // createHandleResponse handles the Create response. @@ -349,10 +348,11 @@ func (client *DataCollectionEndpointsClient) listBySubscriptionHandleResponse(re // 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. +// body - The payload // options - DataCollectionEndpointsClientUpdateOptions contains the optional parameters for the DataCollectionEndpointsClient.Update // method. -func (client *DataCollectionEndpointsClient) Update(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientUpdateOptions) (DataCollectionEndpointsClientUpdateResponse, error) { - req, err := client.updateCreateRequest(ctx, resourceGroupName, dataCollectionEndpointName, options) +func (client *DataCollectionEndpointsClient) Update(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body ResourceForUpdate, options *DataCollectionEndpointsClientUpdateOptions) (DataCollectionEndpointsClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, dataCollectionEndpointName, body, options) if err != nil { return DataCollectionEndpointsClientUpdateResponse{}, err } @@ -367,7 +367,7 @@ func (client *DataCollectionEndpointsClient) Update(ctx context.Context, resourc } // updateCreateRequest creates the Update request. -func (client *DataCollectionEndpointsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientUpdateOptions) (*policy.Request, error) { +func (client *DataCollectionEndpointsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body ResourceForUpdate, options *DataCollectionEndpointsClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -389,10 +389,7 @@ func (client *DataCollectionEndpointsClient) updateCreateRequest(ctx context.Con reqQP.Set("api-version", "2021-09-01-preview") 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 + return req, runtime.MarshalAsJSON(req, body) } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_datacollectionruleassociations_client.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client.go similarity index 97% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_datacollectionruleassociations_client.go rename to sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client.go index 6aabb193edf4..8fade5c51ba0 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_datacollectionruleassociations_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client.go @@ -5,6 +5,7 @@ // 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 @@ -59,10 +60,11 @@ func NewDataCollectionRuleAssociationsClient(subscriptionID string, credential a // 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. +// body - The payload // options - DataCollectionRuleAssociationsClientCreateOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.Create // method. -func (client *DataCollectionRuleAssociationsClient) Create(ctx context.Context, resourceURI string, associationName string, options *DataCollectionRuleAssociationsClientCreateOptions) (DataCollectionRuleAssociationsClientCreateResponse, error) { - req, err := client.createCreateRequest(ctx, resourceURI, associationName, options) +func (client *DataCollectionRuleAssociationsClient) Create(ctx context.Context, resourceURI string, associationName string, body DataCollectionRuleAssociationProxyOnlyResource, options *DataCollectionRuleAssociationsClientCreateOptions) (DataCollectionRuleAssociationsClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceURI, associationName, body, options) if err != nil { return DataCollectionRuleAssociationsClientCreateResponse{}, err } @@ -77,7 +79,7 @@ func (client *DataCollectionRuleAssociationsClient) Create(ctx context.Context, } // createCreateRequest creates the Create request. -func (client *DataCollectionRuleAssociationsClient) createCreateRequest(ctx context.Context, resourceURI string, associationName string, options *DataCollectionRuleAssociationsClientCreateOptions) (*policy.Request, error) { +func (client *DataCollectionRuleAssociationsClient) createCreateRequest(ctx context.Context, resourceURI string, associationName string, body DataCollectionRuleAssociationProxyOnlyResource, options *DataCollectionRuleAssociationsClientCreateOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}" urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) if associationName == "" { @@ -92,10 +94,7 @@ func (client *DataCollectionRuleAssociationsClient) createCreateRequest(ctx cont reqQP.Set("api-version", "2021-09-01-preview") 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 + return req, runtime.MarshalAsJSON(req, body) } // createHandleResponse handles the Create response. diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_datacollectionrules_client.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client.go similarity index 95% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_datacollectionrules_client.go rename to sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client.go index 67c1f4a3e4cc..0f6bf365a372 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_datacollectionrules_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client.go @@ -5,6 +5,7 @@ // 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 @@ -59,10 +60,11 @@ func NewDataCollectionRulesClient(subscriptionID string, credential azcore.Token // 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. +// body - The payload // options - DataCollectionRulesClientCreateOptions contains the optional parameters for the DataCollectionRulesClient.Create // method. -func (client *DataCollectionRulesClient) Create(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRulesClientCreateOptions) (DataCollectionRulesClientCreateResponse, error) { - req, err := client.createCreateRequest(ctx, resourceGroupName, dataCollectionRuleName, options) +func (client *DataCollectionRulesClient) Create(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body DataCollectionRuleResource, options *DataCollectionRulesClientCreateOptions) (DataCollectionRulesClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, dataCollectionRuleName, body, options) if err != nil { return DataCollectionRulesClientCreateResponse{}, err } @@ -77,7 +79,7 @@ func (client *DataCollectionRulesClient) Create(ctx context.Context, resourceGro } // createCreateRequest creates the Create request. -func (client *DataCollectionRulesClient) createCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRulesClientCreateOptions) (*policy.Request, error) { +func (client *DataCollectionRulesClient) createCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body DataCollectionRuleResource, options *DataCollectionRulesClientCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -99,10 +101,7 @@ func (client *DataCollectionRulesClient) createCreateRequest(ctx context.Context reqQP.Set("api-version", "2021-09-01-preview") 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 + return req, runtime.MarshalAsJSON(req, body) } // createHandleResponse handles the Create response. @@ -348,10 +347,11 @@ func (client *DataCollectionRulesClient) listBySubscriptionHandleResponse(resp * // 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. +// body - The payload // options - DataCollectionRulesClientUpdateOptions contains the optional parameters for the DataCollectionRulesClient.Update // method. -func (client *DataCollectionRulesClient) Update(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRulesClientUpdateOptions) (DataCollectionRulesClientUpdateResponse, error) { - req, err := client.updateCreateRequest(ctx, resourceGroupName, dataCollectionRuleName, options) +func (client *DataCollectionRulesClient) Update(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body ResourceForUpdate, options *DataCollectionRulesClientUpdateOptions) (DataCollectionRulesClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, dataCollectionRuleName, body, options) if err != nil { return DataCollectionRulesClientUpdateResponse{}, err } @@ -366,7 +366,7 @@ func (client *DataCollectionRulesClient) Update(ctx context.Context, resourceGro } // updateCreateRequest creates the Update request. -func (client *DataCollectionRulesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRulesClientUpdateOptions) (*policy.Request, error) { +func (client *DataCollectionRulesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body ResourceForUpdate, options *DataCollectionRulesClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -388,10 +388,7 @@ func (client *DataCollectionRulesClient) updateCreateRequest(ctx context.Context reqQP.Set("api-version", "2021-09-01-preview") 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 + return req, runtime.MarshalAsJSON(req, body) } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_diagnosticsettings_client.go b/sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client.go similarity index 99% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_diagnosticsettings_client.go rename to sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client.go index 63a3dfb0d341..46abe2880f2a 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_diagnosticsettings_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client.go @@ -5,6 +5,7 @@ // 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 diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_diagnosticsettingscategory_client.go b/sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client.go similarity index 99% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_diagnosticsettingscategory_client.go rename to sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client.go index ae29a45e86a1..3c676921f52a 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_diagnosticsettingscategory_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client.go @@ -5,6 +5,7 @@ // 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 diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_eventcategories_client.go b/sdk/resourcemanager/monitor/armmonitor/eventcategories_client.go similarity index 99% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_eventcategories_client.go rename to sdk/resourcemanager/monitor/armmonitor/eventcategories_client.go index 2a7819a73b67..7fc32abd1a5f 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_eventcategories_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/eventcategories_client.go @@ -5,6 +5,7 @@ // 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 diff --git a/sdk/resourcemanager/monitor/armmonitor/go.mod b/sdk/resourcemanager/monitor/armmonitor/go.mod index 2fe52925b84a..7427482cfcb6 100644 --- a/sdk/resourcemanager/monitor/armmonitor/go.mod +++ b/sdk/resourcemanager/monitor/armmonitor/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/monitor/armmonitor/go.sum b/sdk/resourcemanager/monitor/armmonitor/go.sum index ed5b814680ee..3afb578030a5 100644 --- a/sdk/resourcemanager/monitor/armmonitor/go.sum +++ b/sdk/resourcemanager/monitor/armmonitor/go.sum @@ -1,33 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_logprofiles_client.go b/sdk/resourcemanager/monitor/armmonitor/logprofiles_client.go similarity index 99% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_logprofiles_client.go rename to sdk/resourcemanager/monitor/armmonitor/logprofiles_client.go index c3c3ccd7b9cf..da68751e57b2 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_logprofiles_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/logprofiles_client.go @@ -5,6 +5,7 @@ // 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 diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_metricalerts_client.go b/sdk/resourcemanager/monitor/armmonitor/metricalerts_client.go similarity index 99% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_metricalerts_client.go rename to sdk/resourcemanager/monitor/armmonitor/metricalerts_client.go index c4fb4286c65f..53aee9ca4fc0 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_metricalerts_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/metricalerts_client.go @@ -5,6 +5,7 @@ // 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 diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_metricalertsstatus_client.go b/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client.go similarity index 99% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_metricalertsstatus_client.go rename to sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client.go index a62eae626057..a2461258af1b 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_metricalertsstatus_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client.go @@ -5,6 +5,7 @@ // 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 diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_metricdefinitions_client.go b/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client.go similarity index 99% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_metricdefinitions_client.go rename to sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client.go index eb0174dd206e..7999a2e135c5 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_metricdefinitions_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client.go @@ -5,6 +5,7 @@ // 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 diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_metricnamespaces_client.go b/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client.go similarity index 99% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_metricnamespaces_client.go rename to sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client.go index 2066e1d784ad..c23a983952e0 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_metricnamespaces_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client.go @@ -5,6 +5,7 @@ // 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 diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_metrics_client.go b/sdk/resourcemanager/monitor/armmonitor/metrics_client.go similarity index 99% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_metrics_client.go rename to sdk/resourcemanager/monitor/armmonitor/metrics_client.go index 5a33485cbafe..b33f799bb2fc 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_metrics_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/metrics_client.go @@ -5,6 +5,7 @@ // 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 diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_models.go b/sdk/resourcemanager/monitor/armmonitor/models.go similarity index 92% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_models.go rename to sdk/resourcemanager/monitor/armmonitor/models.go index b1917b20d04a..b81b528be0f7 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_models.go +++ b/sdk/resourcemanager/monitor/armmonitor/models.go @@ -5,29 +5,12 @@ // 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 "time" -// ActionClassification provides polymorphic access to related types. -// Call the interface's GetAction() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *Action, *AlertingAction, *LogToMetricAction -type ActionClassification interface { - // GetAction returns the Action content of the underlying type. - GetAction() *Action -} - -// Action descriptor. -type Action struct { - // REQUIRED; Specifies the action. Supported values - AlertingAction, LogToMetricAction - ODataType *string `json:"odata.type,omitempty"` -} - -// GetAction implements the ActionClassification interface for type Action. -func (a *Action) GetAction() *Action { return a } - // ActionDetail - The action detail type ActionDetail struct { // The detail of the friendly error message @@ -235,6 +218,15 @@ type ActionList struct { ActionGroups []*ActionGroupAutoGenerated `json:"actionGroups,omitempty"` } +// Actions to invoke when the alert fires. +type Actions struct { + // Action Group resource Ids to invoke when the alert fires. + ActionGroups []*string `json:"actionGroups,omitempty"` + + // The properties of an alert payload. + CustomProperties map[string]*string `json:"customProperties,omitempty"` +} + // ActivityLogAlertResource - An Activity Log Alert rule resource. type ActivityLogAlertResource struct { // The location of the resource. Since Azure Activity Log Alerts is a global service, the location of the rules should always @@ -498,31 +490,6 @@ type AlertRulesClientUpdateOptions struct { // placeholder for future optional parameters } -// AlertingAction - Specify action need to be taken when rule type is Alert -type AlertingAction struct { - // REQUIRED; Specifies the action. Supported values - AlertingAction, LogToMetricAction - ODataType *string `json:"odata.type,omitempty"` - - // REQUIRED; Severity of the alert - Severity *AlertSeverity `json:"severity,omitempty"` - - // REQUIRED; The trigger condition that results in the alert rule being. - Trigger *TriggerCondition `json:"trigger,omitempty"` - - // Azure action group reference. - AznsAction *AzNsActionGroup `json:"aznsAction,omitempty"` - - // time (in minutes) for which Alerts should be throttled or suppressed. - ThrottlingInMin *int32 `json:"throttlingInMin,omitempty"` -} - -// GetAction implements the ActionClassification interface for type AlertingAction. -func (a *AlertingAction) GetAction() *Action { - return &Action{ - ODataType: a.ODataType, - } -} - // ArmRoleReceiver - An arm role receiver. type ArmRoleReceiver struct { // REQUIRED; The name of the arm role receiver. Names must be unique across all receivers within an action group. @@ -559,9 +526,34 @@ type AutomationRunbookReceiver struct { UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` } +// AutoscaleErrorResponse - Describes the format of Error response. +type AutoscaleErrorResponse struct { + // The error object. + Error *AutoscaleErrorResponseError `json:"error,omitempty"` + + // READ-ONLY; The system metadata related to the response. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// AutoscaleErrorResponseError - The error object. +type AutoscaleErrorResponseError struct { + // One of a server-defined set of error codes. + Code *string `json:"code,omitempty"` + + // A human-readable representation of the error's details. + Details *string `json:"details,omitempty"` + + // A human-readable representation of the error. + Message *string `json:"message,omitempty"` + + // The target of the particular error. + Target *string `json:"target,omitempty"` +} + // AutoscaleNotification - Autoscale notification. type AutoscaleNotification struct { - // REQUIRED; the operation associated with the notification and its value must be "scale" + // CONSTANT; the operation associated with the notification and its value must be "scale" + // Field has constant value "Scale", any specified value is ignored. Operation *string `json:"operation,omitempty"` // the email notification. @@ -596,7 +588,7 @@ type AutoscaleSetting struct { // A maximum of 20 profiles can be specified. Profiles []*AutoscaleProfile `json:"profiles,omitempty"` - // the enabled flag. Specifies whether automatic scaling is enabled for the resource. The default value is 'true'. + // the enabled flag. Specifies whether automatic scaling is enabled for the resource. The default value is 'false'. Enabled *bool `json:"enabled,omitempty"` // the name of the autoscale setting. @@ -605,6 +597,9 @@ type AutoscaleSetting struct { // the collection of notifications. Notifications []*AutoscaleNotification `json:"notifications,omitempty"` + // the predictive autoscale policy mode. + PredictiveAutoscalePolicy *PredictiveAutoscalePolicy `json:"predictiveAutoscalePolicy,omitempty"` + // the location of the resource that the autoscale setting should be added to. TargetResourceLocation *string `json:"targetResourceLocation,omitempty"` @@ -620,7 +615,9 @@ type AutoscaleSettingResource struct { // REQUIRED; The autoscale setting of the resource. Properties *AutoscaleSetting `json:"properties,omitempty"` - // Resource tags + // Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this + // resource (across resource groups). A maximum of 15 tags can be provided for a + // resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. Tags map[string]*string `json:"tags,omitempty"` // READ-ONLY; Azure resource Id @@ -629,6 +626,9 @@ type AutoscaleSettingResource struct { // READ-ONLY; Azure resource name Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; The system metadata related to the response. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // READ-ONLY; Azure resource type Type *string `json:"type,omitempty" azure:"ro"` } @@ -684,18 +684,6 @@ type AutoscaleSettingsClientUpdateOptions struct { // placeholder for future optional parameters } -// AzNsActionGroup - Azure action group -type AzNsActionGroup struct { - // Azure Action Group reference. - ActionGroup []*string `json:"actionGroup,omitempty"` - - // Custom payload to be sent for all webhook URI in Azure action group - CustomWebhookPayload *string `json:"customWebhookPayload,omitempty"` - - // Custom subject override for all email ids in Azure action group - EmailSubject *string `json:"emailSubject,omitempty"` -} - // AzureAppPushReceiver - The Azure mobile App push notification receiver. type AzureAppPushReceiver struct { // REQUIRED; The email address registered for the Azure mobile app. @@ -863,6 +851,50 @@ type ColumnDefinition struct { Type *KnownColumnDefinitionType `json:"type,omitempty"` } +// Condition - A condition of the scheduled query rule. +type Condition struct { + // List of Dimensions conditions + Dimensions []*Dimension `json:"dimensions,omitempty"` + + // The minimum number of violations required within the selected lookback time window required to raise an alert. Relevant + // only for rules of the kind LogAlert. + FailingPeriods *ConditionFailingPeriods `json:"failingPeriods,omitempty"` + + // The column containing the metric measure number. Relevant only for rules of the kind LogAlert. + MetricMeasureColumn *string `json:"metricMeasureColumn,omitempty"` + + // The name of the metric to be sent. Relevant and required only for rules of the kind LogToMetric. + MetricName *string `json:"metricName,omitempty"` + + // The criteria operator. Relevant and required only for rules of the kind LogAlert. + Operator *ConditionOperator `json:"operator,omitempty"` + + // Log query alert + Query *string `json:"query,omitempty"` + + // The column containing the resource id. The content of the column must be a uri formatted as resource id. Relevant only + // for rules of the kind LogAlert. + ResourceIDColumn *string `json:"resourceIdColumn,omitempty"` + + // the criteria threshold value that activates the alert. Relevant and required only for rules of the kind LogAlert. + Threshold *float64 `json:"threshold,omitempty"` + + // Aggregation type. Relevant and required only for rules of the kind LogAlert. + TimeAggregation *TimeAggregation `json:"timeAggregation,omitempty"` +} + +// ConditionFailingPeriods - The minimum number of violations required within the selected lookback time window required to +// raise an alert. Relevant only for rules of the kind LogAlert. +type ConditionFailingPeriods struct { + // The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. Default value is + // 1 + MinFailingPeriodsToAlert *int64 `json:"minFailingPeriodsToAlert,omitempty"` + + // The number of aggregated lookback points. The lookback time window is calculated based on the aggregation granularity (windowSize) + // and the selected number of aggregated points. Default value is 1 + NumberOfEvaluationPeriods *int64 `json:"numberOfEvaluationPeriods,omitempty"` +} + // ConfigurationAccessEndpointSpec - Definition of the endpoint used for accessing configuration. type ConfigurationAccessEndpointSpec struct { // READ-ONLY; The endpoint. This property is READ-ONLY. @@ -872,19 +904,10 @@ type ConfigurationAccessEndpointSpec struct { // Context - The context info type Context struct { // The context id type - ContextType *string `json:"ContextType,omitempty"` + ContextType *string `json:"contextType,omitempty"` // The source of the notification request - NotificationSource *string `json:"NotificationSource,omitempty"` -} - -// Criteria - Specifies the criteria for converting log to metric. -type Criteria struct { - // REQUIRED; Name of the metric - MetricName *string `json:"metricName,omitempty"` - - // List of Dimensions for creating metric - Dimensions []*Dimension `json:"dimensions,omitempty"` + NotificationSource *string `json:"notificationSource,omitempty"` } // DataCollectionEndpoint - Definition of data collection endpoint. @@ -1010,8 +1033,7 @@ type DataCollectionEndpointResourceSystemData struct { // DataCollectionEndpointsClientCreateOptions contains the optional parameters for the DataCollectionEndpointsClient.Create // method. type DataCollectionEndpointsClientCreateOptions struct { - // The payload - Body *DataCollectionEndpointResource + // placeholder for future optional parameters } // DataCollectionEndpointsClientDeleteOptions contains the optional parameters for the DataCollectionEndpointsClient.Delete @@ -1040,8 +1062,7 @@ type DataCollectionEndpointsClientListBySubscriptionOptions struct { // DataCollectionEndpointsClientUpdateOptions contains the optional parameters for the DataCollectionEndpointsClient.Update // method. type DataCollectionEndpointsClientUpdateOptions struct { - // The payload - Body *ResourceForUpdate + // placeholder for future optional parameters } // DataCollectionRule - Definition of what monitoring data to collect and where that data should be sent. @@ -1172,8 +1193,7 @@ type DataCollectionRuleAssociationProxyOnlyResourceSystemData struct { // DataCollectionRuleAssociationsClientCreateOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.Create // method. type DataCollectionRuleAssociationsClientCreateOptions struct { - // The payload - Body *DataCollectionRuleAssociationProxyOnlyResource + // placeholder for future optional parameters } // DataCollectionRuleAssociationsClientDeleteOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.Delete @@ -1336,8 +1356,7 @@ type DataCollectionRuleResourceSystemData struct { // DataCollectionRulesClientCreateOptions contains the optional parameters for the DataCollectionRulesClient.Create method. type DataCollectionRulesClientCreateOptions struct { - // The payload - Body *DataCollectionRuleResource + // placeholder for future optional parameters } // DataCollectionRulesClientDeleteOptions contains the optional parameters for the DataCollectionRulesClient.Delete method. @@ -1364,8 +1383,7 @@ type DataCollectionRulesClientListBySubscriptionOptions struct { // DataCollectionRulesClientUpdateOptions contains the optional parameters for the DataCollectionRulesClient.Update method. type DataCollectionRulesClientUpdateOptions struct { - // The payload - Body *ResourceForUpdate + // placeholder for future optional parameters } // DataContainer - Information about a container with data for a given resource. @@ -1537,13 +1555,13 @@ type DiagnosticSettingsResourceCollection struct { Value []*DiagnosticSettingsResource `json:"value,omitempty"` } -// Dimension - Specifies the criteria for converting log to metric. +// Dimension splitting and filtering definition type Dimension struct { // REQUIRED; Name of the dimension Name *string `json:"name,omitempty"` // REQUIRED; Operator for dimension values - Operator *Operator `json:"operator,omitempty"` + Operator *DimensionOperator `json:"operator,omitempty"` // REQUIRED; List of dimension values Values []*string `json:"values,omitempty"` @@ -1669,7 +1687,7 @@ type ErrorAdditionalInfo struct { // ErrorContract - Describes the format of Error response. type ErrorContract struct { // The error details. - Error *ErrorResponse `json:"error,omitempty"` + Error *ErrorResponseDetails `json:"error,omitempty"` } // ErrorDetail - The error detail. @@ -1699,6 +1717,15 @@ type ErrorResponse struct { Message *string `json:"message,omitempty"` } +// ErrorResponseAdditionalInfo - The resource management error additional info. +type ErrorResponseAdditionalInfo struct { + // READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty" azure:"ro"` + + // READ-ONLY; The additional info type. + Type *string `json:"type,omitempty" azure:"ro"` +} + // ErrorResponseAutoGenerated - The error response. type ErrorResponseAutoGenerated struct { // READ-ONLY; The error code. @@ -1730,6 +1757,25 @@ type ErrorResponseCommonV2 struct { Error *ErrorDetail `json:"error,omitempty"` } +// ErrorResponseDetails - Common error response for all Azure Resource Manager APIs to return error details for failed operations. +// (This also follows the OData error response format.) +type ErrorResponseDetails struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorResponseAdditionalInfo `json:"additionalInfo,omitempty" azure:"ro"` + + // READ-ONLY; The error code. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; The error details. + Details []*ErrorResponseDetails `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"` +} + // EventCategoriesClientListOptions contains the optional parameters for the EventCategoriesClient.List method. type EventCategoriesClientListOptions struct { // placeholder for future optional parameters @@ -2044,21 +2090,6 @@ type LogFilesDataSourceSettings struct { Text *LogFileSettingsText `json:"text,omitempty"` } -// LogMetricTrigger - A log metrics trigger descriptor. -type LogMetricTrigger struct { - // Evaluation of metric on a particular column - MetricColumn *string `json:"metricColumn,omitempty"` - - // Metric Trigger Type - 'Consecutive' or 'Total' - MetricTriggerType *MetricTriggerType `json:"metricTriggerType,omitempty"` - - // The threshold of the metric trigger. - Threshold *float64 `json:"threshold,omitempty"` - - // Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. - ThresholdOperator *ConditionalOperator `json:"thresholdOperator,omitempty"` -} - // LogProfileCollection - Represents a collection of log profiles. type LogProfileCollection struct { // REQUIRED; the values of the log profiles. @@ -2142,95 +2173,6 @@ type LogProfilesClientUpdateOptions struct { // placeholder for future optional parameters } -// LogSearchRule - Log Search Rule Definition -type LogSearchRule struct { - // REQUIRED; Action needs to be taken on rule execution. - Action ActionClassification `json:"action,omitempty"` - - // REQUIRED; Data Source against which rule will Query Data - Source *Source `json:"source,omitempty"` - - // The flag that indicates whether the alert should be automatically resolved or not. The default is false. - AutoMitigate *bool `json:"autoMitigate,omitempty"` - - // The description of the Log Search rule. - Description *string `json:"description,omitempty"` - - // The display name of the alert rule - DisplayName *string `json:"displayName,omitempty"` - - // The flag which indicates whether the Log Search rule is enabled. Value should be true or false - Enabled *Enabled `json:"enabled,omitempty"` - - // Schedule (Frequency, Time Window) for rule. Required for action type - AlertingAction - Schedule *Schedule `json:"schedule,omitempty"` - - // READ-ONLY; The api-version used when creating this alert rule - CreatedWithAPIVersion *string `json:"createdWithApiVersion,omitempty" azure:"ro"` - - // READ-ONLY; True if alert rule is legacy Log Analytic rule - IsLegacyLogAnalyticsRule *bool `json:"isLegacyLogAnalyticsRule,omitempty" azure:"ro"` - - // READ-ONLY; Last time the rule was updated in IS08601 format. - LastUpdatedTime *time.Time `json:"lastUpdatedTime,omitempty" azure:"ro"` - - // READ-ONLY; Provisioning state of the scheduled query rule - ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` -} - -// LogSearchRulePatch - Log Search Rule Definition for Patching -type LogSearchRulePatch struct { - // The flag which indicates whether the Log Search rule is enabled. Value should be true or false - Enabled *Enabled `json:"enabled,omitempty"` -} - -// LogSearchRuleResource - The Log Search Rule resource. -type LogSearchRuleResource struct { - // REQUIRED; Resource location - Location *string `json:"location,omitempty"` - - // REQUIRED; The rule properties of the resource. - Properties *LogSearchRule `json:"properties,omitempty"` - - // Resource tags - Tags map[string]*string `json:"tags,omitempty"` - - // READ-ONLY; The etag field is not required. If it is provided in the response body, it must also be provided as a header - // per the normal etag convention. Entity tags are used for comparing two or more entities - // from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match - // (section 14.26), and If-Range (section 14.27) header fields. - Etag *string `json:"etag,omitempty" azure:"ro"` - - // READ-ONLY; Azure resource Id - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. - // ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must - // validate and persist this value. - Kind *string `json:"kind,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"` -} - -// LogSearchRuleResourceCollection - Represents a collection of Log Search rule resources. -type LogSearchRuleResourceCollection struct { - // The values for the Log Search Rule resources. - Value []*LogSearchRuleResource `json:"value,omitempty"` -} - -// LogSearchRuleResourcePatch - The log search rule resource for patch operations. -type LogSearchRuleResourcePatch struct { - // The log search rule properties of the resource. - Properties *LogSearchRulePatch `json:"properties,omitempty"` - - // Resource tags - Tags map[string]*string `json:"tags,omitempty"` -} - // LogSettings - Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. type LogSettings struct { // REQUIRED; a value indicating whether this log is enabled. @@ -2244,22 +2186,6 @@ type LogSettings struct { RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` } -// LogToMetricAction - Specify action need to be taken when rule type is converting log to metric -type LogToMetricAction struct { - // REQUIRED; Criteria of Metric - Criteria []*Criteria `json:"criteria,omitempty"` - - // REQUIRED; Specifies the action. Supported values - AlertingAction, LogToMetricAction - ODataType *string `json:"odata.type,omitempty"` -} - -// GetAction implements the ActionClassification interface for type LogToMetricAction. -func (l *LogToMetricAction) GetAction() *Action { - return &Action{ - ODataType: l.ODataType, - } -} - // LogicAppReceiver - A logic app receiver. type LogicAppReceiver struct { // REQUIRED; The callback url where http request sent to. @@ -3099,6 +3025,52 @@ type PerfCounterDataSource struct { Streams []*KnownPerfCounterDataSourceStreams `json:"streams,omitempty"` } +// PredictiveAutoscalePolicy - The parameters for enabling predictive autoscale. +type PredictiveAutoscalePolicy struct { + // REQUIRED; the predictive autoscale mode + ScaleMode *PredictiveAutoscalePolicyScaleMode `json:"scaleMode,omitempty"` + + // the amount of time to specify by which instances are launched in advance. It must be between 1 minute and 60 minutes in + // ISO 8601 format. + ScaleLookAheadTime *string `json:"scaleLookAheadTime,omitempty"` +} + +// PredictiveMetricClientGetOptions contains the optional parameters for the PredictiveMetricClient.Get method. +type PredictiveMetricClientGetOptions struct { + // placeholder for future optional parameters +} + +// PredictiveResponse - The response to a metrics query. +type PredictiveResponse struct { + // the value of the collection. + Data []*PredictiveValue `json:"data,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 metrics being queried + MetricName *string `json:"metricName,omitempty"` + + // resource of the predictive metric. + TargetResourceID *string `json:"targetResourceId,omitempty"` + + // 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"` +} + +// PredictiveValue - Represents a predictive metric value in the given bucket. +type PredictiveValue struct { + // REQUIRED; the timestamp for the metric value in ISO 8601 format. + TimeStamp *time.Time `json:"timeStamp,omitempty"` + + // REQUIRED; Predictive value in this time bucket. + Value *float64 `json:"value,omitempty"` +} + // PrivateEndpointConnection - A private endpoint connection type PrivateEndpointConnection struct { // Resource properties. @@ -3384,11 +3356,70 @@ type RecurrentSchedule struct { TimeZone *string `json:"timeZone,omitempty"` } -// Resource - An azure resource object +// Resource - The autoscale setting resource. type Resource struct { // REQUIRED; Resource location Location *string `json:"location,omitempty"` + // Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this + // resource (across resource groups). A maximum of 15 tags can be provided for a + // resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. + Tags map[string]*string `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; The system metadata related to the response. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; Azure resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ResourceAutoGenerated - An azure resource object +type ResourceAutoGenerated struct { + // REQUIRED; Resource location + Location *string `json:"location,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"` +} + +// ResourceAutoGenerated2 - An azure resource object +type ResourceAutoGenerated2 struct { + // REQUIRED; Resource location + Location *string `json:"location,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"` +} + +// ResourceAutoGenerated3 - An azure resource object +type ResourceAutoGenerated3 struct { + // REQUIRED; Resource location + Location *string `json:"location,omitempty"` + // Resource tags Tags map[string]*string `json:"tags,omitempty"` @@ -3710,13 +3741,130 @@ type ScaleRuleMetricDimension struct { Values []*string `json:"Values,omitempty"` } -// Schedule - Defines how often to run the search and the time interval. -type Schedule struct { - // REQUIRED; frequency (in minutes) at which rule condition should be evaluated. - FrequencyInMinutes *int32 `json:"frequencyInMinutes,omitempty"` +// ScheduledQueryRuleCriteria - The rule criteria that defines the conditions of the scheduled query rule. +type ScheduledQueryRuleCriteria struct { + // A list of conditions to evaluate against the specified scopes + AllOf []*Condition `json:"allOf,omitempty"` +} + +// ScheduledQueryRuleProperties - scheduled query rule Definition +type ScheduledQueryRuleProperties struct { + // Actions to invoke when the alert fires. + Actions *Actions `json:"actions,omitempty"` + + // The flag that indicates whether the alert should be automatically resolved or not. The default is true. Relevant only for + // rules of the kind LogAlert. + AutoMitigate *bool `json:"autoMitigate,omitempty"` + + // The flag which indicates whether this scheduled query rule should be stored in the customer's storage. The default is false. + // Relevant only for rules of the kind LogAlert. + CheckWorkspaceAlertsStorageConfigured *bool `json:"checkWorkspaceAlertsStorageConfigured,omitempty"` + + // The rule criteria that defines the conditions of the scheduled query rule. + Criteria *ScheduledQueryRuleCriteria `json:"criteria,omitempty"` + + // The description of the scheduled query rule. + Description *string `json:"description,omitempty"` + + // The display name of the alert rule + DisplayName *string `json:"displayName,omitempty"` + + // The flag which indicates whether this scheduled query rule is enabled. Value should be true or false + Enabled *bool `json:"enabled,omitempty"` + + // How often the scheduled query rule is evaluated represented in ISO 8601 duration format. Relevant and required only for + // rules of the kind LogAlert. + EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` + + // Mute actions for the chosen period of time (in ISO 8601 duration format) after the alert is fired. Relevant only for rules + // of the kind LogAlert. + MuteActionsDuration *string `json:"muteActionsDuration,omitempty"` + + // If specified then overrides the query time range (default is WindowSize*NumberOfEvaluationPeriods). Relevant only for rules + // of the kind LogAlert. + OverrideQueryTimeRange *string `json:"overrideQueryTimeRange,omitempty"` + + // The list of resource id's that this scheduled query rule is scoped to. + Scopes []*string `json:"scopes,omitempty"` - // REQUIRED; Time window for which data needs to be fetched for query (should be greater than or equal to frequencyInMinutes). - TimeWindowInMinutes *int32 `json:"timeWindowInMinutes,omitempty"` + // Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. Relevant and required only for rules + // of the kind LogAlert. + Severity *AlertSeverity `json:"severity,omitempty"` + + // The flag which indicates whether the provided query should be validated or not. The default is false. Relevant only for + // rules of the kind LogAlert. + SkipQueryValidation *bool `json:"skipQueryValidation,omitempty"` + + // List of resource type of the target resource(s) on which the alert is created/updated. For example if the scope is a resource + // group and targetResourceTypes is Microsoft.Compute/virtualMachines, then a + // different alert will be fired for each virtual machine in the resource group which meet the alert criteria. Relevant only + // for rules of the kind LogAlert + TargetResourceTypes []*string `json:"targetResourceTypes,omitempty"` + + // The period of time (in ISO 8601 duration format) on which the Alert query will be executed (bin size). Relevant and required + // only for rules of the kind LogAlert. + WindowSize *string `json:"windowSize,omitempty"` + + // READ-ONLY; The api-version used when creating this alert rule + CreatedWithAPIVersion *string `json:"createdWithApiVersion,omitempty" azure:"ro"` + + // READ-ONLY; True if alert rule is legacy Log Analytic rule + IsLegacyLogAnalyticsRule *bool `json:"isLegacyLogAnalyticsRule,omitempty" azure:"ro"` + + // READ-ONLY; The flag which indicates whether this scheduled query rule has been configured to be stored in the customer's + // storage. The default is false. + IsWorkspaceAlertsStorageConfigured *bool `json:"isWorkspaceAlertsStorageConfigured,omitempty" azure:"ro"` +} + +// ScheduledQueryRuleResource - The scheduled query rule resource. +type ScheduledQueryRuleResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string `json:"location,omitempty"` + + // REQUIRED; The rule properties of the resource. + Properties *ScheduledQueryRuleProperties `json:"properties,omitempty"` + + // Indicates the type of scheduled query rule. The default is LogAlert. + Kind *Kind `json:"kind,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; The etag field is not required. If it is provided in the response body, it must also be provided as a header + // per the normal etag convention. Entity tags are used for comparing two or more entities + // from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match + // (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `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; SystemData of ScheduledQueryRule. + 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"` +} + +// ScheduledQueryRuleResourceCollection - Represents a collection of scheduled query rule resources. +type ScheduledQueryRuleResourceCollection struct { + // The values for the scheduled query rule resources. + Value []*ScheduledQueryRuleResource `json:"value,omitempty"` + + // READ-ONLY; Provides the link to retrieve the next set of elements. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// ScheduledQueryRuleResourcePatch - The scheduled query rule resource for patch operations. +type ScheduledQueryRuleResourcePatch struct { + // The scheduled query rule properties of the resource. + Properties *ScheduledQueryRuleProperties `json:"properties,omitempty"` + + // Resource tags + Tags map[string]*string `json:"tags,omitempty"` } // ScheduledQueryRulesClientCreateOrUpdateOptions contains the optional parameters for the ScheduledQueryRulesClient.CreateOrUpdate @@ -3738,15 +3886,13 @@ type ScheduledQueryRulesClientGetOptions struct { // ScheduledQueryRulesClientListByResourceGroupOptions contains the optional parameters for the ScheduledQueryRulesClient.ListByResourceGroup // method. type ScheduledQueryRulesClientListByResourceGroupOptions struct { - // The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx - Filter *string + // placeholder for future optional parameters } // ScheduledQueryRulesClientListBySubscriptionOptions contains the optional parameters for the ScheduledQueryRulesClient.ListBySubscription // method. type ScheduledQueryRulesClientListBySubscriptionOptions struct { - // The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx - Filter *string + // placeholder for future optional parameters } // ScheduledQueryRulesClientUpdateOptions contains the optional parameters for the ScheduledQueryRulesClient.Update method. @@ -3842,21 +3988,6 @@ type SmsReceiver struct { Status *ReceiverStatus `json:"status,omitempty" azure:"ro"` } -// Source - Specifies the log search query. -type Source struct { - // REQUIRED; The resource uri over which log search query is to be run. - DataSourceID *string `json:"dataSourceId,omitempty"` - - // List of Resource referred into query - AuthorizedResources []*string `json:"authorizedResources,omitempty"` - - // Log search query. Required for action type - AlertingAction - Query *string `json:"query,omitempty"` - - // Set value to 'ResultCount' . - QueryType *QueryType `json:"queryType,omitempty"` -} - // StreamDeclaration - Declaration of a custom stream. type StreamDeclaration struct { // List of columns used by data in this stream. @@ -3936,19 +4067,19 @@ type TenantActivityLogsClientListOptions struct { // TestNotificationDetailsResponse - The details of the test notification results. type TestNotificationDetailsResponse struct { // REQUIRED; The overall state - State *string `json:"State,omitempty"` + State *string `json:"state,omitempty"` // The list of action detail - ActionDetails []*ActionDetail `json:"ActionDetails,omitempty"` + ActionDetails []*ActionDetail `json:"actionDetails,omitempty"` // The completed time - CompletedTime *string `json:"CompletedTime,omitempty"` + CompletedTime *string `json:"completedTime,omitempty"` // The context info - Context *Context `json:"Context,omitempty"` + Context *Context `json:"context,omitempty"` // The created time - CreatedTime *string `json:"CreatedTime,omitempty"` + CreatedTime *string `json:"createdTime,omitempty"` } // ThresholdRuleCondition - A rule condition based on a metric crossing a threshold. @@ -4050,47 +4181,6 @@ type TimeWindow struct { TimeZone *string `json:"timeZone,omitempty"` } -// TrackedEntityResource - An azure resource object -type TrackedEntityResource struct { - // REQUIRED; Resource location - Location *string `json:"location,omitempty"` - - // Resource tags - Tags map[string]*string `json:"tags,omitempty"` - - // READ-ONLY; The etag field is not required. If it is provided in the response body, it must also be provided as a header - // per the normal etag convention. Entity tags are used for comparing two or more entities - // from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match - // (section 14.26), and If-Range (section 14.27) header fields. - Etag *string `json:"etag,omitempty" azure:"ro"` - - // READ-ONLY; Azure resource Id - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. - // ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must - // validate and persist this value. - Kind *string `json:"kind,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"` -} - -// TriggerCondition - The condition that results in the Log Search rule. -type TriggerCondition struct { - // REQUIRED; Result or count threshold based on which rule should be triggered. - Threshold *float64 `json:"threshold,omitempty"` - - // REQUIRED; Evaluation operation for rule - 'GreaterThan' or 'LessThan. - ThresholdOperator *ConditionalOperator `json:"thresholdOperator,omitempty"` - - // Trigger condition for metric query rule - MetricTrigger *LogMetricTrigger `json:"metricTrigger,omitempty"` -} - // VMInsightsClientGetOnboardingStatusOptions contains the optional parameters for the VMInsightsClient.GetOnboardingStatus // method. type VMInsightsClientGetOnboardingStatusOptions struct { diff --git a/sdk/resourcemanager/monitor/armmonitor/models_serde.go b/sdk/resourcemanager/monitor/armmonitor/models_serde.go new file mode 100644 index 000000000000..11aff877c5db --- /dev/null +++ b/sdk/resourcemanager/monitor/armmonitor/models_serde.go @@ -0,0 +1,8739 @@ +//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 ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "time" +) + +// MarshalJSON implements the json.Marshaller interface for type ActionDetail. +func (a ActionDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "Detail", a.Detail) + populate(objectMap, "MechanismType", a.MechanismType) + populate(objectMap, "Name", a.Name) + populate(objectMap, "SendTime", a.SendTime) + populate(objectMap, "Status", a.Status) + populate(objectMap, "SubState", a.SubState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActionDetail. +func (a *ActionDetail) UnmarshalJSON(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 "Detail": + err = unpopulate(val, "Detail", &a.Detail) + delete(rawMsg, key) + case "MechanismType": + err = unpopulate(val, "MechanismType", &a.MechanismType) + delete(rawMsg, key) + case "Name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "SendTime": + err = unpopulate(val, "SendTime", &a.SendTime) + delete(rawMsg, key) + case "Status": + err = unpopulate(val, "Status", &a.Status) + delete(rawMsg, key) + case "SubState": + err = unpopulate(val, "SubState", &a.SubState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ActionGroup. +func (a ActionGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "armRoleReceivers", a.ArmRoleReceivers) + populate(objectMap, "automationRunbookReceivers", a.AutomationRunbookReceivers) + populate(objectMap, "azureAppPushReceivers", a.AzureAppPushReceivers) + populate(objectMap, "azureFunctionReceivers", a.AzureFunctionReceivers) + populate(objectMap, "emailReceivers", a.EmailReceivers) + populate(objectMap, "enabled", a.Enabled) + populate(objectMap, "eventHubReceivers", a.EventHubReceivers) + populate(objectMap, "groupShortName", a.GroupShortName) + populate(objectMap, "itsmReceivers", a.ItsmReceivers) + populate(objectMap, "logicAppReceivers", a.LogicAppReceivers) + populate(objectMap, "smsReceivers", a.SmsReceivers) + populate(objectMap, "voiceReceivers", a.VoiceReceivers) + populate(objectMap, "webhookReceivers", a.WebhookReceivers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActionGroup. +func (a *ActionGroup) UnmarshalJSON(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 "armRoleReceivers": + err = unpopulate(val, "ArmRoleReceivers", &a.ArmRoleReceivers) + delete(rawMsg, key) + case "automationRunbookReceivers": + err = unpopulate(val, "AutomationRunbookReceivers", &a.AutomationRunbookReceivers) + delete(rawMsg, key) + case "azureAppPushReceivers": + err = unpopulate(val, "AzureAppPushReceivers", &a.AzureAppPushReceivers) + delete(rawMsg, key) + case "azureFunctionReceivers": + err = unpopulate(val, "AzureFunctionReceivers", &a.AzureFunctionReceivers) + delete(rawMsg, key) + case "emailReceivers": + err = unpopulate(val, "EmailReceivers", &a.EmailReceivers) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &a.Enabled) + delete(rawMsg, key) + case "eventHubReceivers": + err = unpopulate(val, "EventHubReceivers", &a.EventHubReceivers) + delete(rawMsg, key) + case "groupShortName": + err = unpopulate(val, "GroupShortName", &a.GroupShortName) + delete(rawMsg, key) + case "itsmReceivers": + err = unpopulate(val, "ItsmReceivers", &a.ItsmReceivers) + delete(rawMsg, key) + case "logicAppReceivers": + err = unpopulate(val, "LogicAppReceivers", &a.LogicAppReceivers) + delete(rawMsg, key) + case "smsReceivers": + err = unpopulate(val, "SmsReceivers", &a.SmsReceivers) + delete(rawMsg, key) + case "voiceReceivers": + err = unpopulate(val, "VoiceReceivers", &a.VoiceReceivers) + delete(rawMsg, key) + case "webhookReceivers": + err = unpopulate(val, "WebhookReceivers", &a.WebhookReceivers) + 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 ActionGroupAutoGenerated. +func (a ActionGroupAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actionGroupId", a.ActionGroupID) + populate(objectMap, "webhookProperties", a.WebhookProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActionGroupAutoGenerated. +func (a *ActionGroupAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionGroupId": + err = unpopulate(val, "ActionGroupID", &a.ActionGroupID) + delete(rawMsg, key) + case "webhookProperties": + err = unpopulate(val, "WebhookProperties", &a.WebhookProperties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ActionGroupList. +func (a ActionGroupList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActionGroupList. +func (a *ActionGroupList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ActionGroupPatch. +func (a ActionGroupPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabled", a.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActionGroupPatch. +func (a *ActionGroupPatch) UnmarshalJSON(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{}) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "tags", a.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActionGroupPatchBody. +func (a *ActionGroupPatchBody) UnmarshalJSON(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{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "identity", a.Identity) + populate(objectMap, "kind", a.Kind) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActionGroupResource. +func (a *ActionGroupResource) UnmarshalJSON(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 "identity": + err = unpopulate(val, "Identity", &a.Identity) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ActionList. +func (a ActionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actionGroups", a.ActionGroups) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActionList. +func (a *ActionList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionGroups": + err = unpopulate(val, "ActionGroups", &a.ActionGroups) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Actions. +func (a Actions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actionGroups", a.ActionGroups) + populate(objectMap, "customProperties", a.CustomProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Actions. +func (a *Actions) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionGroups": + err = unpopulate(val, "ActionGroups", &a.ActionGroups) + delete(rawMsg, key) + case "customProperties": + err = unpopulate(val, "CustomProperties", &a.CustomProperties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ActivityLogAlertResource. +func (a ActivityLogAlertResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActivityLogAlertResource. +func (a *ActivityLogAlertResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "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 AlertRule. +func (a AlertRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "action", a.Action) + populate(objectMap, "actions", a.Actions) + populate(objectMap, "condition", a.Condition) + populate(objectMap, "description", a.Description) + populate(objectMap, "isEnabled", a.IsEnabled) + populateTimeRFC3339(objectMap, "lastUpdatedTime", a.LastUpdatedTime) + populate(objectMap, "name", a.Name) + populate(objectMap, "provisioningState", a.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRule. +func (a *AlertRule) UnmarshalJSON(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 "action": + a.Action, err = unmarshalRuleActionClassification(val) + delete(rawMsg, key) + case "actions": + a.Actions, err = unmarshalRuleActionClassificationArray(val) + delete(rawMsg, key) + case "condition": + a.Condition, err = unmarshalRuleConditionClassification(val) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &a.IsEnabled) + delete(rawMsg, key) + case "lastUpdatedTime": + err = unpopulateTimeRFC3339(val, "LastUpdatedTime", &a.LastUpdatedTime) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AlertRuleAllOfCondition. +func (a AlertRuleAllOfCondition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allOf", a.AllOf) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleAllOfCondition. +func (a *AlertRuleAllOfCondition) UnmarshalJSON(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 "allOf": + err = unpopulate(val, "AllOf", &a.AllOf) + 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 AlertRuleAnyOfOrLeafCondition. +func (a AlertRuleAnyOfOrLeafCondition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "anyOf", a.AnyOf) + populate(objectMap, "containsAny", a.ContainsAny) + populate(objectMap, "equals", a.Equals) + populate(objectMap, "field", a.Field) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleAnyOfOrLeafCondition. +func (a *AlertRuleAnyOfOrLeafCondition) UnmarshalJSON(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 "anyOf": + err = unpopulate(val, "AnyOf", &a.AnyOf) + delete(rawMsg, key) + case "containsAny": + err = unpopulate(val, "ContainsAny", &a.ContainsAny) + delete(rawMsg, key) + case "equals": + err = unpopulate(val, "Equals", &a.Equals) + delete(rawMsg, key) + case "field": + err = unpopulate(val, "Field", &a.Field) + 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 AlertRuleLeafCondition. +func (a AlertRuleLeafCondition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "containsAny", a.ContainsAny) + populate(objectMap, "equals", a.Equals) + populate(objectMap, "field", a.Field) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleLeafCondition. +func (a *AlertRuleLeafCondition) UnmarshalJSON(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 "containsAny": + err = unpopulate(val, "ContainsAny", &a.ContainsAny) + delete(rawMsg, key) + case "equals": + err = unpopulate(val, "Equals", &a.Equals) + delete(rawMsg, key) + case "field": + err = unpopulate(val, "Field", &a.Field) + 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 AlertRuleList. +func (a AlertRuleList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleList. +func (a *AlertRuleList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AlertRulePatchObject. +func (a AlertRulePatchObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "tags", a.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRulePatchObject. +func (a *AlertRulePatchObject) UnmarshalJSON(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 AlertRulePatchProperties. +func (a AlertRulePatchProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabled", a.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRulePatchProperties. +func (a *AlertRulePatchProperties) UnmarshalJSON(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 AlertRuleProperties. +func (a AlertRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actions", a.Actions) + populate(objectMap, "condition", a.Condition) + populate(objectMap, "description", a.Description) + populate(objectMap, "enabled", a.Enabled) + populate(objectMap, "scopes", a.Scopes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleProperties. +func (a *AlertRuleProperties) UnmarshalJSON(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 "actions": + err = unpopulate(val, "Actions", &a.Actions) + delete(rawMsg, key) + case "condition": + err = unpopulate(val, "Condition", &a.Condition) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &a.Enabled) + delete(rawMsg, key) + case "scopes": + err = unpopulate(val, "Scopes", &a.Scopes) + 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 AlertRuleResource. +func (a AlertRuleResource) 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, "properties", a.Properties) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleResource. +func (a *AlertRuleResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AlertRuleResourceCollection. +func (a AlertRuleResourceCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleResourceCollection. +func (a *AlertRuleResourceCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AlertRuleResourcePatch. +func (a AlertRuleResourcePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "tags", a.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleResourcePatch. +func (a *AlertRuleResourcePatch) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + 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 ArmRoleReceiver. +func (a ArmRoleReceiver) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", a.Name) + populate(objectMap, "roleId", a.RoleID) + populate(objectMap, "useCommonAlertSchema", a.UseCommonAlertSchema) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ArmRoleReceiver. +func (a *ArmRoleReceiver) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "roleId": + err = unpopulate(val, "RoleID", &a.RoleID) + delete(rawMsg, key) + case "useCommonAlertSchema": + err = unpopulate(val, "UseCommonAlertSchema", &a.UseCommonAlertSchema) + 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 AutomationRunbookReceiver. +func (a AutomationRunbookReceiver) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "automationAccountId", a.AutomationAccountID) + populate(objectMap, "isGlobalRunbook", a.IsGlobalRunbook) + populate(objectMap, "name", a.Name) + populate(objectMap, "runbookName", a.RunbookName) + populate(objectMap, "serviceUri", a.ServiceURI) + populate(objectMap, "useCommonAlertSchema", a.UseCommonAlertSchema) + populate(objectMap, "webhookResourceId", a.WebhookResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationRunbookReceiver. +func (a *AutomationRunbookReceiver) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "automationAccountId": + err = unpopulate(val, "AutomationAccountID", &a.AutomationAccountID) + delete(rawMsg, key) + case "isGlobalRunbook": + err = unpopulate(val, "IsGlobalRunbook", &a.IsGlobalRunbook) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "runbookName": + err = unpopulate(val, "RunbookName", &a.RunbookName) + delete(rawMsg, key) + case "serviceUri": + err = unpopulate(val, "ServiceURI", &a.ServiceURI) + delete(rawMsg, key) + case "useCommonAlertSchema": + err = unpopulate(val, "UseCommonAlertSchema", &a.UseCommonAlertSchema) + delete(rawMsg, key) + case "webhookResourceId": + err = unpopulate(val, "WebhookResourceID", &a.WebhookResourceID) + 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 AutoscaleErrorResponse. +func (a AutoscaleErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "error", a.Error) + populate(objectMap, "systemData", a.SystemData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutoscaleErrorResponse. +func (a *AutoscaleErrorResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &a.Error) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutoscaleErrorResponseError. +func (a AutoscaleErrorResponseError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", a.Code) + populate(objectMap, "details", a.Details) + populate(objectMap, "message", a.Message) + populate(objectMap, "target", a.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutoscaleErrorResponseError. +func (a *AutoscaleErrorResponseError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &a.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &a.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &a.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &a.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutoscaleNotification. +func (a AutoscaleNotification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "email", a.Email) + objectMap["operation"] = "Scale" + populate(objectMap, "webhooks", a.Webhooks) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutoscaleNotification. +func (a *AutoscaleNotification) UnmarshalJSON(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 "email": + err = unpopulate(val, "Email", &a.Email) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &a.Operation) + delete(rawMsg, key) + case "webhooks": + err = unpopulate(val, "Webhooks", &a.Webhooks) + 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 AutoscaleProfile. +func (a AutoscaleProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "capacity", a.Capacity) + populate(objectMap, "fixedDate", a.FixedDate) + populate(objectMap, "name", a.Name) + populate(objectMap, "recurrence", a.Recurrence) + populate(objectMap, "rules", a.Rules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutoscaleProfile. +func (a *AutoscaleProfile) UnmarshalJSON(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 "capacity": + err = unpopulate(val, "Capacity", &a.Capacity) + delete(rawMsg, key) + case "fixedDate": + err = unpopulate(val, "FixedDate", &a.FixedDate) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "recurrence": + err = unpopulate(val, "Recurrence", &a.Recurrence) + delete(rawMsg, key) + case "rules": + err = unpopulate(val, "Rules", &a.Rules) + 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 AutoscaleSetting. +func (a AutoscaleSetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabled", a.Enabled) + populate(objectMap, "name", a.Name) + populate(objectMap, "notifications", a.Notifications) + populate(objectMap, "predictiveAutoscalePolicy", a.PredictiveAutoscalePolicy) + populate(objectMap, "profiles", a.Profiles) + populate(objectMap, "targetResourceLocation", a.TargetResourceLocation) + populate(objectMap, "targetResourceUri", a.TargetResourceURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutoscaleSetting. +func (a *AutoscaleSetting) UnmarshalJSON(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) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "notifications": + err = unpopulate(val, "Notifications", &a.Notifications) + delete(rawMsg, key) + case "predictiveAutoscalePolicy": + err = unpopulate(val, "PredictiveAutoscalePolicy", &a.PredictiveAutoscalePolicy) + delete(rawMsg, key) + case "profiles": + err = unpopulate(val, "Profiles", &a.Profiles) + delete(rawMsg, key) + case "targetResourceLocation": + err = unpopulate(val, "TargetResourceLocation", &a.TargetResourceLocation) + delete(rawMsg, key) + case "targetResourceUri": + err = unpopulate(val, "TargetResourceURI", &a.TargetResourceURI) + 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 AutoscaleSettingResource. +func (a AutoscaleSettingResource) 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, "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 AutoscaleSettingResource. +func (a *AutoscaleSettingResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutoscaleSettingResourceCollection. +func (a AutoscaleSettingResourceCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutoscaleSettingResourceCollection. +func (a *AutoscaleSettingResourceCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutoscaleSettingResourcePatch. +func (a AutoscaleSettingResourcePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "tags", a.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutoscaleSettingResourcePatch. +func (a *AutoscaleSettingResourcePatch) UnmarshalJSON(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 AzureAppPushReceiver. +func (a AzureAppPushReceiver) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "emailAddress", a.EmailAddress) + populate(objectMap, "name", a.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureAppPushReceiver. +func (a *AzureAppPushReceiver) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + 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{}) + populate(objectMap, "functionAppResourceId", a.FunctionAppResourceID) + populate(objectMap, "functionName", a.FunctionName) + populate(objectMap, "httpTriggerUrl", a.HTTPTriggerURL) + populate(objectMap, "name", a.Name) + populate(objectMap, "useCommonAlertSchema", a.UseCommonAlertSchema) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFunctionReceiver. +func (a *AzureFunctionReceiver) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "functionAppResourceId": + err = unpopulate(val, "FunctionAppResourceID", &a.FunctionAppResourceID) + delete(rawMsg, key) + case "functionName": + err = unpopulate(val, "FunctionName", &a.FunctionName) + delete(rawMsg, key) + case "httpTriggerUrl": + err = unpopulate(val, "HTTPTriggerURL", &a.HTTPTriggerURL) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "useCommonAlertSchema": + err = unpopulate(val, "UseCommonAlertSchema", &a.UseCommonAlertSchema) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureMonitorMetricsDestination. +func (a AzureMonitorMetricsDestination) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", a.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorMetricsDestination. +func (a *AzureMonitorMetricsDestination) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureMonitorPrivateLinkScope. +func (a AzureMonitorPrivateLinkScope) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorPrivateLinkScope. +func (a *AzureMonitorPrivateLinkScope) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureMonitorPrivateLinkScopeListResult. +func (a AzureMonitorPrivateLinkScopeListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorPrivateLinkScopeListResult. +func (a *AzureMonitorPrivateLinkScopeListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureMonitorPrivateLinkScopeProperties. +func (a AzureMonitorPrivateLinkScopeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "privateEndpointConnections", a.PrivateEndpointConnections) + populate(objectMap, "provisioningState", a.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorPrivateLinkScopeProperties. +func (a *AzureMonitorPrivateLinkScopeProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &a.PrivateEndpointConnections) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureResource. +func (a AzureResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "identity", a.Identity) + populate(objectMap, "kind", a.Kind) + 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 "identity": + err = unpopulate(val, "Identity", &a.Identity) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + 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]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) + 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]interface{}) + 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]interface{}) + 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]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) + 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]interface{}) + 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]interface{}) + populate(objectMap, "endpoint", c.Endpoint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationAccessEndpointSpec. +func (c *ConfigurationAccessEndpointSpec) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endpoint": + err = unpopulate(val, "Endpoint", &c.Endpoint) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Context. +func (c Context) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "contextType", c.ContextType) + populate(objectMap, "notificationSource", c.NotificationSource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Context. +func (c *Context) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "contextType": + err = unpopulate(val, "ContextType", &c.ContextType) + delete(rawMsg, key) + case "notificationSource": + err = unpopulate(val, "NotificationSource", &c.NotificationSource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpoint. +func (d DataCollectionEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "configurationAccess", d.ConfigurationAccess) + populate(objectMap, "description", d.Description) + populate(objectMap, "immutableId", d.ImmutableID) + populate(objectMap, "logsIngestion", d.LogsIngestion) + populate(objectMap, "networkAcls", d.NetworkACLs) + populate(objectMap, "provisioningState", d.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpoint. +func (d *DataCollectionEndpoint) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "configurationAccess": + err = unpopulate(val, "ConfigurationAccess", &d.ConfigurationAccess) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &d.Description) + delete(rawMsg, key) + case "immutableId": + err = unpopulate(val, "ImmutableID", &d.ImmutableID) + delete(rawMsg, key) + case "logsIngestion": + err = unpopulate(val, "LogsIngestion", &d.LogsIngestion) + delete(rawMsg, key) + case "networkAcls": + err = unpopulate(val, "NetworkACLs", &d.NetworkACLs) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointConfigurationAccess. +func (d DataCollectionEndpointConfigurationAccess) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "endpoint", d.Endpoint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointConfigurationAccess. +func (d *DataCollectionEndpointConfigurationAccess) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endpoint": + err = unpopulate(val, "Endpoint", &d.Endpoint) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointLogsIngestion. +func (d DataCollectionEndpointLogsIngestion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "endpoint", d.Endpoint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointLogsIngestion. +func (d *DataCollectionEndpointLogsIngestion) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endpoint": + err = unpopulate(val, "Endpoint", &d.Endpoint) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointNetworkACLs. +func (d DataCollectionEndpointNetworkACLs) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "publicNetworkAccess", d.PublicNetworkAccess) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointNetworkACLs. +func (d *DataCollectionEndpointNetworkACLs) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &d.PublicNetworkAccess) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointResource. +func (d DataCollectionEndpointResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", d.Etag) + populate(objectMap, "id", d.ID) + populate(objectMap, "kind", d.Kind) + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "tags", d.Tags) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointResource. +func (d *DataCollectionEndpointResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &d.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &d.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointResourceListResult. +func (d DataCollectionEndpointResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointResourceListResult. +func (d *DataCollectionEndpointResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointResourceProperties. +func (d DataCollectionEndpointResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "configurationAccess", d.ConfigurationAccess) + populate(objectMap, "description", d.Description) + populate(objectMap, "immutableId", d.ImmutableID) + populate(objectMap, "logsIngestion", d.LogsIngestion) + populate(objectMap, "networkAcls", d.NetworkACLs) + populate(objectMap, "provisioningState", d.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointResourceProperties. +func (d *DataCollectionEndpointResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "configurationAccess": + err = unpopulate(val, "ConfigurationAccess", &d.ConfigurationAccess) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &d.Description) + delete(rawMsg, key) + case "immutableId": + err = unpopulate(val, "ImmutableID", &d.ImmutableID) + delete(rawMsg, key) + case "logsIngestion": + err = unpopulate(val, "LogsIngestion", &d.LogsIngestion) + delete(rawMsg, key) + case "networkAcls": + err = unpopulate(val, "NetworkACLs", &d.NetworkACLs) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointResourceSystemData. +func (d DataCollectionEndpointResourceSystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAt", d.CreatedAt) + populate(objectMap, "createdBy", d.CreatedBy) + populate(objectMap, "createdByType", d.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", d.LastModifiedAt) + populate(objectMap, "lastModifiedBy", d.LastModifiedBy) + populate(objectMap, "lastModifiedByType", d.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointResourceSystemData. +func (d *DataCollectionEndpointResourceSystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &d.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &d.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &d.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &d.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &d.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &d.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRule. +func (d DataCollectionRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataCollectionEndpointId", d.DataCollectionEndpointID) + populate(objectMap, "dataFlows", d.DataFlows) + populate(objectMap, "dataSources", d.DataSources) + populate(objectMap, "description", d.Description) + populate(objectMap, "destinations", d.Destinations) + populate(objectMap, "immutableId", d.ImmutableID) + populate(objectMap, "metadata", d.Metadata) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "streamDeclarations", d.StreamDeclarations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRule. +func (d *DataCollectionRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataCollectionEndpointId": + err = unpopulate(val, "DataCollectionEndpointID", &d.DataCollectionEndpointID) + delete(rawMsg, key) + case "dataFlows": + err = unpopulate(val, "DataFlows", &d.DataFlows) + delete(rawMsg, key) + case "dataSources": + err = unpopulate(val, "DataSources", &d.DataSources) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &d.Description) + delete(rawMsg, key) + case "destinations": + err = unpopulate(val, "Destinations", &d.Destinations) + delete(rawMsg, key) + case "immutableId": + err = unpopulate(val, "ImmutableID", &d.ImmutableID) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &d.Metadata) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "streamDeclarations": + err = unpopulate(val, "StreamDeclarations", &d.StreamDeclarations) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociation. +func (d DataCollectionRuleAssociation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataCollectionEndpointId", d.DataCollectionEndpointID) + populate(objectMap, "dataCollectionRuleId", d.DataCollectionRuleID) + populate(objectMap, "description", d.Description) + populate(objectMap, "metadata", d.Metadata) + populate(objectMap, "provisioningState", d.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleAssociation. +func (d *DataCollectionRuleAssociation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataCollectionEndpointId": + err = unpopulate(val, "DataCollectionEndpointID", &d.DataCollectionEndpointID) + delete(rawMsg, key) + case "dataCollectionRuleId": + err = unpopulate(val, "DataCollectionRuleID", &d.DataCollectionRuleID) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &d.Description) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &d.Metadata) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociationMetadata. +func (d DataCollectionRuleAssociationMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisionedBy", d.ProvisionedBy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleAssociationMetadata. +func (d *DataCollectionRuleAssociationMetadata) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisionedBy": + err = unpopulate(val, "ProvisionedBy", &d.ProvisionedBy) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociationProxyOnlyResource. +func (d DataCollectionRuleAssociationProxyOnlyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", d.Etag) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleAssociationProxyOnlyResource. +func (d *DataCollectionRuleAssociationProxyOnlyResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &d.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociationProxyOnlyResourceListResult. +func (d DataCollectionRuleAssociationProxyOnlyResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleAssociationProxyOnlyResourceListResult. +func (d *DataCollectionRuleAssociationProxyOnlyResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociationProxyOnlyResourceProperties. +func (d DataCollectionRuleAssociationProxyOnlyResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataCollectionEndpointId", d.DataCollectionEndpointID) + populate(objectMap, "dataCollectionRuleId", d.DataCollectionRuleID) + populate(objectMap, "description", d.Description) + populate(objectMap, "metadata", d.Metadata) + populate(objectMap, "provisioningState", d.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleAssociationProxyOnlyResourceProperties. +func (d *DataCollectionRuleAssociationProxyOnlyResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataCollectionEndpointId": + err = unpopulate(val, "DataCollectionEndpointID", &d.DataCollectionEndpointID) + delete(rawMsg, key) + case "dataCollectionRuleId": + err = unpopulate(val, "DataCollectionRuleID", &d.DataCollectionRuleID) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &d.Description) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &d.Metadata) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociationProxyOnlyResourceSystemData. +func (d DataCollectionRuleAssociationProxyOnlyResourceSystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAt", d.CreatedAt) + populate(objectMap, "createdBy", d.CreatedBy) + populate(objectMap, "createdByType", d.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", d.LastModifiedAt) + populate(objectMap, "lastModifiedBy", d.LastModifiedBy) + populate(objectMap, "lastModifiedByType", d.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleAssociationProxyOnlyResourceSystemData. +func (d *DataCollectionRuleAssociationProxyOnlyResourceSystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &d.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &d.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &d.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &d.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &d.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &d.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleDataSources. +func (d DataCollectionRuleDataSources) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "extensions", d.Extensions) + populate(objectMap, "iisLogs", d.IisLogs) + populate(objectMap, "logFiles", d.LogFiles) + populate(objectMap, "performanceCounters", d.PerformanceCounters) + populate(objectMap, "syslog", d.Syslog) + populate(objectMap, "windowsEventLogs", d.WindowsEventLogs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleDataSources. +func (d *DataCollectionRuleDataSources) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extensions": + err = unpopulate(val, "Extensions", &d.Extensions) + delete(rawMsg, key) + case "iisLogs": + err = unpopulate(val, "IisLogs", &d.IisLogs) + delete(rawMsg, key) + case "logFiles": + err = unpopulate(val, "LogFiles", &d.LogFiles) + delete(rawMsg, key) + case "performanceCounters": + err = unpopulate(val, "PerformanceCounters", &d.PerformanceCounters) + delete(rawMsg, key) + case "syslog": + err = unpopulate(val, "Syslog", &d.Syslog) + delete(rawMsg, key) + case "windowsEventLogs": + err = unpopulate(val, "WindowsEventLogs", &d.WindowsEventLogs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleDestinations. +func (d DataCollectionRuleDestinations) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "azureMonitorMetrics", d.AzureMonitorMetrics) + populate(objectMap, "logAnalytics", d.LogAnalytics) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleDestinations. +func (d *DataCollectionRuleDestinations) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureMonitorMetrics": + err = unpopulate(val, "AzureMonitorMetrics", &d.AzureMonitorMetrics) + delete(rawMsg, key) + case "logAnalytics": + err = unpopulate(val, "LogAnalytics", &d.LogAnalytics) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleMetadata. +func (d DataCollectionRuleMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisionedBy", d.ProvisionedBy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleMetadata. +func (d *DataCollectionRuleMetadata) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisionedBy": + err = unpopulate(val, "ProvisionedBy", &d.ProvisionedBy) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleResource. +func (d DataCollectionRuleResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", d.Etag) + populate(objectMap, "id", d.ID) + populate(objectMap, "kind", d.Kind) + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "tags", d.Tags) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleResource. +func (d *DataCollectionRuleResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &d.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &d.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleResourceListResult. +func (d DataCollectionRuleResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleResourceListResult. +func (d *DataCollectionRuleResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleResourceProperties. +func (d DataCollectionRuleResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataCollectionEndpointId", d.DataCollectionEndpointID) + populate(objectMap, "dataFlows", d.DataFlows) + populate(objectMap, "dataSources", d.DataSources) + populate(objectMap, "description", d.Description) + populate(objectMap, "destinations", d.Destinations) + populate(objectMap, "immutableId", d.ImmutableID) + populate(objectMap, "metadata", d.Metadata) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "streamDeclarations", d.StreamDeclarations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleResourceProperties. +func (d *DataCollectionRuleResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataCollectionEndpointId": + err = unpopulate(val, "DataCollectionEndpointID", &d.DataCollectionEndpointID) + delete(rawMsg, key) + case "dataFlows": + err = unpopulate(val, "DataFlows", &d.DataFlows) + delete(rawMsg, key) + case "dataSources": + err = unpopulate(val, "DataSources", &d.DataSources) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &d.Description) + delete(rawMsg, key) + case "destinations": + err = unpopulate(val, "Destinations", &d.Destinations) + delete(rawMsg, key) + case "immutableId": + err = unpopulate(val, "ImmutableID", &d.ImmutableID) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &d.Metadata) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "streamDeclarations": + err = unpopulate(val, "StreamDeclarations", &d.StreamDeclarations) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleResourceSystemData. +func (d DataCollectionRuleResourceSystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAt", d.CreatedAt) + populate(objectMap, "createdBy", d.CreatedBy) + populate(objectMap, "createdByType", d.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", d.LastModifiedAt) + populate(objectMap, "lastModifiedBy", d.LastModifiedBy) + populate(objectMap, "lastModifiedByType", d.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleResourceSystemData. +func (d *DataCollectionRuleResourceSystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &d.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &d.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &d.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &d.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &d.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &d.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataContainer. +func (d DataContainer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "workspace", d.Workspace) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataContainer. +func (d *DataContainer) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "workspace": + err = unpopulate(val, "Workspace", &d.Workspace) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataFlow. +func (d DataFlow) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "destinations", d.Destinations) + populate(objectMap, "outputStream", d.OutputStream) + populate(objectMap, "streams", d.Streams) + populate(objectMap, "transformKql", d.TransformKql) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataFlow. +func (d *DataFlow) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destinations": + err = unpopulate(val, "Destinations", &d.Destinations) + delete(rawMsg, key) + case "outputStream": + err = unpopulate(val, "OutputStream", &d.OutputStream) + delete(rawMsg, key) + case "streams": + err = unpopulate(val, "Streams", &d.Streams) + delete(rawMsg, key) + case "transformKql": + err = unpopulate(val, "TransformKql", &d.TransformKql) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataSourcesSpec. +func (d DataSourcesSpec) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "extensions", d.Extensions) + populate(objectMap, "iisLogs", d.IisLogs) + populate(objectMap, "logFiles", d.LogFiles) + populate(objectMap, "performanceCounters", d.PerformanceCounters) + populate(objectMap, "syslog", d.Syslog) + populate(objectMap, "windowsEventLogs", d.WindowsEventLogs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataSourcesSpec. +func (d *DataSourcesSpec) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extensions": + err = unpopulate(val, "Extensions", &d.Extensions) + delete(rawMsg, key) + case "iisLogs": + err = unpopulate(val, "IisLogs", &d.IisLogs) + delete(rawMsg, key) + case "logFiles": + err = unpopulate(val, "LogFiles", &d.LogFiles) + delete(rawMsg, key) + case "performanceCounters": + err = unpopulate(val, "PerformanceCounters", &d.PerformanceCounters) + delete(rawMsg, key) + case "syslog": + err = unpopulate(val, "Syslog", &d.Syslog) + delete(rawMsg, key) + case "windowsEventLogs": + err = unpopulate(val, "WindowsEventLogs", &d.WindowsEventLogs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DestinationsSpec. +func (d DestinationsSpec) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "azureMonitorMetrics", d.AzureMonitorMetrics) + populate(objectMap, "logAnalytics", d.LogAnalytics) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DestinationsSpec. +func (d *DestinationsSpec) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureMonitorMetrics": + err = unpopulate(val, "AzureMonitorMetrics", &d.AzureMonitorMetrics) + delete(rawMsg, key) + case "logAnalytics": + err = unpopulate(val, "LogAnalytics", &d.LogAnalytics) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DestinationsSpecAzureMonitorMetrics. +func (d DestinationsSpecAzureMonitorMetrics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", d.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DestinationsSpecAzureMonitorMetrics. +func (d *DestinationsSpecAzureMonitorMetrics) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiagnosticSettings. +func (d DiagnosticSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "eventHubAuthorizationRuleId", d.EventHubAuthorizationRuleID) + populate(objectMap, "eventHubName", d.EventHubName) + populate(objectMap, "logAnalyticsDestinationType", d.LogAnalyticsDestinationType) + populate(objectMap, "logs", d.Logs) + populate(objectMap, "metrics", d.Metrics) + populate(objectMap, "serviceBusRuleId", d.ServiceBusRuleID) + populate(objectMap, "storageAccountId", d.StorageAccountID) + populate(objectMap, "workspaceId", d.WorkspaceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticSettings. +func (d *DiagnosticSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "eventHubAuthorizationRuleId": + err = unpopulate(val, "EventHubAuthorizationRuleID", &d.EventHubAuthorizationRuleID) + delete(rawMsg, key) + case "eventHubName": + err = unpopulate(val, "EventHubName", &d.EventHubName) + delete(rawMsg, key) + case "logAnalyticsDestinationType": + err = unpopulate(val, "LogAnalyticsDestinationType", &d.LogAnalyticsDestinationType) + delete(rawMsg, key) + case "logs": + err = unpopulate(val, "Logs", &d.Logs) + delete(rawMsg, key) + case "metrics": + err = unpopulate(val, "Metrics", &d.Metrics) + delete(rawMsg, key) + case "serviceBusRuleId": + err = unpopulate(val, "ServiceBusRuleID", &d.ServiceBusRuleID) + delete(rawMsg, key) + case "storageAccountId": + err = unpopulate(val, "StorageAccountID", &d.StorageAccountID) + delete(rawMsg, key) + case "workspaceId": + err = unpopulate(val, "WorkspaceID", &d.WorkspaceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiagnosticSettingsCategory. +func (d DiagnosticSettingsCategory) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "categoryType", d.CategoryType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticSettingsCategory. +func (d *DiagnosticSettingsCategory) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "categoryType": + err = unpopulate(val, "CategoryType", &d.CategoryType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiagnosticSettingsCategoryResource. +func (d DiagnosticSettingsCategoryResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticSettingsCategoryResource. +func (d *DiagnosticSettingsCategoryResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiagnosticSettingsCategoryResourceCollection. +func (d DiagnosticSettingsCategoryResourceCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticSettingsCategoryResourceCollection. +func (d *DiagnosticSettingsCategoryResourceCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiagnosticSettingsResource. +func (d DiagnosticSettingsResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticSettingsResource. +func (d *DiagnosticSettingsResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DiagnosticSettingsResourceCollection. +func (d DiagnosticSettingsResourceCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticSettingsResourceCollection. +func (d *DiagnosticSettingsResourceCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Dimension. +func (d Dimension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", d.Name) + populate(objectMap, "operator", d.Operator) + populate(objectMap, "values", d.Values) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Dimension. +func (d *Dimension) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "operator": + err = unpopulate(val, "Operator", &d.Operator) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &d.Values) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DynamicMetricCriteria. +func (d DynamicMetricCriteria) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alertSensitivity", d.AlertSensitivity) + objectMap["criterionType"] = CriterionTypeDynamicThresholdCriterion + populate(objectMap, "dimensions", d.Dimensions) + populate(objectMap, "failingPeriods", d.FailingPeriods) + populateTimeRFC3339(objectMap, "ignoreDataBefore", d.IgnoreDataBefore) + populate(objectMap, "metricName", d.MetricName) + populate(objectMap, "metricNamespace", d.MetricNamespace) + populate(objectMap, "name", d.Name) + populate(objectMap, "operator", d.Operator) + populate(objectMap, "skipMetricValidation", d.SkipMetricValidation) + populate(objectMap, "timeAggregation", d.TimeAggregation) + if d.AdditionalProperties != nil { + for key, val := range d.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DynamicMetricCriteria. +func (d *DynamicMetricCriteria) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertSensitivity": + err = unpopulate(val, "AlertSensitivity", &d.AlertSensitivity) + delete(rawMsg, key) + case "criterionType": + err = unpopulate(val, "CriterionType", &d.CriterionType) + delete(rawMsg, key) + case "dimensions": + err = unpopulate(val, "Dimensions", &d.Dimensions) + delete(rawMsg, key) + case "failingPeriods": + err = unpopulate(val, "FailingPeriods", &d.FailingPeriods) + delete(rawMsg, key) + case "ignoreDataBefore": + err = unpopulateTimeRFC3339(val, "IgnoreDataBefore", &d.IgnoreDataBefore) + delete(rawMsg, key) + case "metricName": + err = unpopulate(val, "MetricName", &d.MetricName) + delete(rawMsg, key) + case "metricNamespace": + err = unpopulate(val, "MetricNamespace", &d.MetricNamespace) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "operator": + err = unpopulate(val, "Operator", &d.Operator) + delete(rawMsg, key) + case "skipMetricValidation": + err = unpopulate(val, "SkipMetricValidation", &d.SkipMetricValidation) + delete(rawMsg, key) + case "timeAggregation": + err = unpopulate(val, "TimeAggregation", &d.TimeAggregation) + delete(rawMsg, key) + default: + if d.AdditionalProperties == nil { + d.AdditionalProperties = map[string]interface{}{} + } + if val != nil { + var aux interface{} + err = json.Unmarshal(val, &aux) + d.AdditionalProperties[key] = aux + } + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DynamicThresholdFailingPeriods. +func (d DynamicThresholdFailingPeriods) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "minFailingPeriodsToAlert", d.MinFailingPeriodsToAlert) + populate(objectMap, "numberOfEvaluationPeriods", d.NumberOfEvaluationPeriods) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DynamicThresholdFailingPeriods. +func (d *DynamicThresholdFailingPeriods) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "minFailingPeriodsToAlert": + err = unpopulate(val, "MinFailingPeriodsToAlert", &d.MinFailingPeriodsToAlert) + delete(rawMsg, key) + case "numberOfEvaluationPeriods": + err = unpopulate(val, "NumberOfEvaluationPeriods", &d.NumberOfEvaluationPeriods) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EmailNotification. +func (e EmailNotification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "customEmails", e.CustomEmails) + populate(objectMap, "sendToSubscriptionAdministrator", e.SendToSubscriptionAdministrator) + populate(objectMap, "sendToSubscriptionCoAdministrators", e.SendToSubscriptionCoAdministrators) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EmailNotification. +func (e *EmailNotification) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "customEmails": + err = unpopulate(val, "CustomEmails", &e.CustomEmails) + delete(rawMsg, key) + case "sendToSubscriptionAdministrator": + err = unpopulate(val, "SendToSubscriptionAdministrator", &e.SendToSubscriptionAdministrator) + delete(rawMsg, key) + case "sendToSubscriptionCoAdministrators": + err = unpopulate(val, "SendToSubscriptionCoAdministrators", &e.SendToSubscriptionCoAdministrators) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EmailReceiver. +func (e EmailReceiver) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "emailAddress", e.EmailAddress) + populate(objectMap, "name", e.Name) + populate(objectMap, "status", e.Status) + populate(objectMap, "useCommonAlertSchema", e.UseCommonAlertSchema) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EmailReceiver. +func (e *EmailReceiver) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "emailAddress": + err = unpopulate(val, "EmailAddress", &e.EmailAddress) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &e.Status) + delete(rawMsg, key) + case "useCommonAlertSchema": + err = unpopulate(val, "UseCommonAlertSchema", &e.UseCommonAlertSchema) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnableRequest. +func (e EnableRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "receiverName", e.ReceiverName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnableRequest. +func (e *EnableRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "receiverName": + err = unpopulate(val, "ReceiverName", &e.ReceiverName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Error. +func (e Error) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", e.Code) + populate(objectMap, "message", e.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Error. +func (e *Error) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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]interface{}) + 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 ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", e.Code) + populate(objectMap, "message", e.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseAdditionalInfo. +func (e ErrorResponseAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "info", &e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAdditionalInfo. +func (e *ErrorResponseAdditionalInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseAutoGenerated. +func (e ErrorResponseAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", e.Code) + populate(objectMap, "message", e.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAutoGenerated. +func (e *ErrorResponseAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseCommon. +func (e ErrorResponseCommon) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseCommon. +func (e *ErrorResponseCommon) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + } + 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{}) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseCommonV2. +func (e *ErrorResponseCommonV2) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseDetails. +func (e ErrorResponseDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseDetails. +func (e *ErrorResponseDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EventCategoryCollection. +func (e EventCategoryCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventCategoryCollection. +func (e *EventCategoryCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EventData. +func (e EventData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authorization", e.Authorization) + populate(objectMap, "caller", e.Caller) + populate(objectMap, "category", e.Category) + populate(objectMap, "claims", e.Claims) + populate(objectMap, "correlationId", e.CorrelationID) + populate(objectMap, "description", e.Description) + populate(objectMap, "eventDataId", e.EventDataID) + populate(objectMap, "eventName", e.EventName) + populateTimeRFC3339(objectMap, "eventTimestamp", e.EventTimestamp) + populate(objectMap, "httpRequest", e.HTTPRequest) + populate(objectMap, "id", e.ID) + populate(objectMap, "level", e.Level) + populate(objectMap, "operationId", e.OperationID) + populate(objectMap, "operationName", e.OperationName) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "resourceGroupName", e.ResourceGroupName) + populate(objectMap, "resourceId", e.ResourceID) + populate(objectMap, "resourceProviderName", e.ResourceProviderName) + populate(objectMap, "resourceType", e.ResourceType) + populate(objectMap, "status", e.Status) + populate(objectMap, "subStatus", e.SubStatus) + populateTimeRFC3339(objectMap, "submissionTimestamp", e.SubmissionTimestamp) + populate(objectMap, "subscriptionId", e.SubscriptionID) + populate(objectMap, "tenantId", e.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventData. +func (e *EventData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authorization": + err = unpopulate(val, "Authorization", &e.Authorization) + delete(rawMsg, key) + case "caller": + err = unpopulate(val, "Caller", &e.Caller) + delete(rawMsg, key) + case "category": + err = unpopulate(val, "Category", &e.Category) + delete(rawMsg, key) + case "claims": + err = unpopulate(val, "Claims", &e.Claims) + delete(rawMsg, key) + case "correlationId": + err = unpopulate(val, "CorrelationID", &e.CorrelationID) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &e.Description) + delete(rawMsg, key) + case "eventDataId": + err = unpopulate(val, "EventDataID", &e.EventDataID) + delete(rawMsg, key) + case "eventName": + err = unpopulate(val, "EventName", &e.EventName) + delete(rawMsg, key) + case "eventTimestamp": + err = unpopulateTimeRFC3339(val, "EventTimestamp", &e.EventTimestamp) + delete(rawMsg, key) + case "httpRequest": + err = unpopulate(val, "HTTPRequest", &e.HTTPRequest) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "level": + err = unpopulate(val, "Level", &e.Level) + delete(rawMsg, key) + case "operationId": + err = unpopulate(val, "OperationID", &e.OperationID) + delete(rawMsg, key) + case "operationName": + err = unpopulate(val, "OperationName", &e.OperationName) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "resourceGroupName": + err = unpopulate(val, "ResourceGroupName", &e.ResourceGroupName) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &e.ResourceID) + delete(rawMsg, key) + case "resourceProviderName": + err = unpopulate(val, "ResourceProviderName", &e.ResourceProviderName) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &e.ResourceType) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &e.Status) + delete(rawMsg, key) + case "subStatus": + err = unpopulate(val, "SubStatus", &e.SubStatus) + delete(rawMsg, key) + case "submissionTimestamp": + err = unpopulateTimeRFC3339(val, "SubmissionTimestamp", &e.SubmissionTimestamp) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &e.SubscriptionID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &e.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EventDataCollection. +func (e EventDataCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventDataCollection. +func (e *EventDataCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EventHubReceiver. +func (e EventHubReceiver) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "eventHubName", e.EventHubName) + populate(objectMap, "eventHubNameSpace", e.EventHubNameSpace) + populate(objectMap, "name", e.Name) + populate(objectMap, "subscriptionId", e.SubscriptionID) + populate(objectMap, "tenantId", e.TenantID) + populate(objectMap, "useCommonAlertSchema", e.UseCommonAlertSchema) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubReceiver. +func (e *EventHubReceiver) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "eventHubName": + err = unpopulate(val, "EventHubName", &e.EventHubName) + delete(rawMsg, key) + case "eventHubNameSpace": + err = unpopulate(val, "EventHubNameSpace", &e.EventHubNameSpace) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &e.SubscriptionID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &e.TenantID) + delete(rawMsg, key) + case "useCommonAlertSchema": + err = unpopulate(val, "UseCommonAlertSchema", &e.UseCommonAlertSchema) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExtensionDataSource. +func (e ExtensionDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "extensionName", e.ExtensionName) + populate(objectMap, "extensionSettings", &e.ExtensionSettings) + populate(objectMap, "inputDataSources", e.InputDataSources) + populate(objectMap, "name", e.Name) + populate(objectMap, "streams", e.Streams) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionDataSource. +func (e *ExtensionDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "extensionName": + err = unpopulate(val, "ExtensionName", &e.ExtensionName) + delete(rawMsg, key) + case "extensionSettings": + err = unpopulate(val, "ExtensionSettings", &e.ExtensionSettings) + delete(rawMsg, key) + case "inputDataSources": + err = unpopulate(val, "InputDataSources", &e.InputDataSources) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "streams": + err = unpopulate(val, "Streams", &e.Streams) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HTTPRequestInfo. +func (h HTTPRequestInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clientIpAddress", h.ClientIPAddress) + populate(objectMap, "clientRequestId", h.ClientRequestID) + populate(objectMap, "method", h.Method) + populate(objectMap, "uri", h.URI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPRequestInfo. +func (h *HTTPRequestInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientIpAddress": + err = unpopulate(val, "ClientIPAddress", &h.ClientIPAddress) + delete(rawMsg, key) + case "clientRequestId": + err = unpopulate(val, "ClientRequestID", &h.ClientRequestID) + delete(rawMsg, key) + case "method": + err = unpopulate(val, "Method", &h.Method) + delete(rawMsg, key) + case "uri": + err = unpopulate(val, "URI", &h.URI) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IisLogsDataSource. +func (i IisLogsDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "logDirectories", i.LogDirectories) + populate(objectMap, "name", i.Name) + populate(objectMap, "streams", i.Streams) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IisLogsDataSource. +func (i *IisLogsDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "logDirectories": + err = unpopulate(val, "LogDirectories", &i.LogDirectories) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "streams": + err = unpopulate(val, "Streams", &i.Streams) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Incident. +func (i Incident) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "activatedTime", i.ActivatedTime) + populate(objectMap, "isActive", i.IsActive) + populate(objectMap, "name", i.Name) + populateTimeRFC3339(objectMap, "resolvedTime", i.ResolvedTime) + populate(objectMap, "ruleName", i.RuleName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Incident. +func (i *Incident) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "activatedTime": + err = unpopulateTimeRFC3339(val, "ActivatedTime", &i.ActivatedTime) + delete(rawMsg, key) + case "isActive": + err = unpopulate(val, "IsActive", &i.IsActive) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "resolvedTime": + err = unpopulateTimeRFC3339(val, "ResolvedTime", &i.ResolvedTime) + delete(rawMsg, key) + case "ruleName": + err = unpopulate(val, "RuleName", &i.RuleName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IncidentListResult. +func (i IncidentListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IncidentListResult. +func (i *IncidentListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ItsmReceiver. +func (i ItsmReceiver) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "connectionId", i.ConnectionID) + populate(objectMap, "name", i.Name) + populate(objectMap, "region", i.Region) + populate(objectMap, "ticketConfiguration", i.TicketConfiguration) + populate(objectMap, "workspaceId", i.WorkspaceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ItsmReceiver. +func (i *ItsmReceiver) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connectionId": + err = unpopulate(val, "ConnectionID", &i.ConnectionID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "region": + err = unpopulate(val, "Region", &i.Region) + delete(rawMsg, key) + case "ticketConfiguration": + err = unpopulate(val, "TicketConfiguration", &i.TicketConfiguration) + delete(rawMsg, key) + case "workspaceId": + err = unpopulate(val, "WorkspaceID", &i.WorkspaceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LocalizableString. +func (l LocalizableString) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "localizedValue", l.LocalizedValue) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LocalizableString. +func (l *LocalizableString) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "localizedValue": + err = unpopulate(val, "LocalizedValue", &l.LocalizedValue) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LocationThresholdRuleCondition. +func (l LocationThresholdRuleCondition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataSource", l.DataSource) + populate(objectMap, "failedLocationCount", l.FailedLocationCount) + objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition" + populate(objectMap, "windowSize", l.WindowSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LocationThresholdRuleCondition. +func (l *LocationThresholdRuleCondition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataSource": + l.DataSource, err = unmarshalRuleDataSourceClassification(val) + delete(rawMsg, key) + case "failedLocationCount": + err = unpopulate(val, "FailedLocationCount", &l.FailedLocationCount) + delete(rawMsg, key) + case "odata.type": + err = unpopulate(val, "ODataType", &l.ODataType) + delete(rawMsg, key) + case "windowSize": + err = unpopulate(val, "WindowSize", &l.WindowSize) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogAnalyticsDestination. +func (l LogAnalyticsDestination) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", l.Name) + populate(objectMap, "workspaceId", l.WorkspaceID) + populate(objectMap, "workspaceResourceId", l.WorkspaceResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogAnalyticsDestination. +func (l *LogAnalyticsDestination) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "workspaceId": + err = unpopulate(val, "WorkspaceID", &l.WorkspaceID) + delete(rawMsg, key) + case "workspaceResourceId": + err = unpopulate(val, "WorkspaceResourceID", &l.WorkspaceResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogFileSettings. +func (l LogFileSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "text", l.Text) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogFileSettings. +func (l *LogFileSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "text": + err = unpopulate(val, "Text", &l.Text) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogFileSettingsText. +func (l LogFileSettingsText) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "recordStartTimestampFormat", l.RecordStartTimestampFormat) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogFileSettingsText. +func (l *LogFileSettingsText) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "recordStartTimestampFormat": + err = unpopulate(val, "RecordStartTimestampFormat", &l.RecordStartTimestampFormat) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogFileTextSettings. +func (l LogFileTextSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "recordStartTimestampFormat", l.RecordStartTimestampFormat) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogFileTextSettings. +func (l *LogFileTextSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "recordStartTimestampFormat": + err = unpopulate(val, "RecordStartTimestampFormat", &l.RecordStartTimestampFormat) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogFilesDataSource. +func (l LogFilesDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "filePatterns", l.FilePatterns) + populate(objectMap, "format", l.Format) + populate(objectMap, "name", l.Name) + populate(objectMap, "settings", l.Settings) + populate(objectMap, "streams", l.Streams) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogFilesDataSource. +func (l *LogFilesDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "filePatterns": + err = unpopulate(val, "FilePatterns", &l.FilePatterns) + delete(rawMsg, key) + case "format": + err = unpopulate(val, "Format", &l.Format) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "settings": + err = unpopulate(val, "Settings", &l.Settings) + delete(rawMsg, key) + case "streams": + err = unpopulate(val, "Streams", &l.Streams) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogFilesDataSourceSettings. +func (l LogFilesDataSourceSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "text", l.Text) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogFilesDataSourceSettings. +func (l *LogFilesDataSourceSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "text": + err = unpopulate(val, "Text", &l.Text) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogProfileCollection. +func (l LogProfileCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogProfileCollection. +func (l *LogProfileCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogProfileProperties. +func (l LogProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "categories", l.Categories) + populate(objectMap, "locations", l.Locations) + populate(objectMap, "retentionPolicy", l.RetentionPolicy) + populate(objectMap, "serviceBusRuleId", l.ServiceBusRuleID) + populate(objectMap, "storageAccountId", l.StorageAccountID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogProfileProperties. +func (l *LogProfileProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "categories": + err = unpopulate(val, "Categories", &l.Categories) + delete(rawMsg, key) + case "locations": + err = unpopulate(val, "Locations", &l.Locations) + delete(rawMsg, key) + case "retentionPolicy": + err = unpopulate(val, "RetentionPolicy", &l.RetentionPolicy) + delete(rawMsg, key) + case "serviceBusRuleId": + err = unpopulate(val, "ServiceBusRuleID", &l.ServiceBusRuleID) + delete(rawMsg, key) + case "storageAccountId": + err = unpopulate(val, "StorageAccountID", &l.StorageAccountID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogProfileResource. +func (l LogProfileResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", l.ID) + populate(objectMap, "location", l.Location) + populate(objectMap, "name", l.Name) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "tags", l.Tags) + populate(objectMap, "type", l.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogProfileResource. +func (l *LogProfileResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &l.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &l.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &l.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &l.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogProfileResourcePatch. +func (l LogProfileResourcePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "tags", l.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogProfileResourcePatch. +func (l *LogProfileResourcePatch) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &l.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogSettings. +func (l LogSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "category", l.Category) + populate(objectMap, "enabled", l.Enabled) + populate(objectMap, "retentionPolicy", l.RetentionPolicy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogSettings. +func (l *LogSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "category": + err = unpopulate(val, "Category", &l.Category) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &l.Enabled) + delete(rawMsg, key) + case "retentionPolicy": + err = unpopulate(val, "RetentionPolicy", &l.RetentionPolicy) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogicAppReceiver. +func (l LogicAppReceiver) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "callbackUrl", l.CallbackURL) + populate(objectMap, "name", l.Name) + populate(objectMap, "resourceId", l.ResourceID) + populate(objectMap, "useCommonAlertSchema", l.UseCommonAlertSchema) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogicAppReceiver. +func (l *LogicAppReceiver) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "callbackUrl": + err = unpopulate(val, "CallbackURL", &l.CallbackURL) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &l.ResourceID) + delete(rawMsg, key) + case "useCommonAlertSchema": + err = unpopulate(val, "UseCommonAlertSchema", &l.UseCommonAlertSchema) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogsIngestionEndpointSpec. +func (l LogsIngestionEndpointSpec) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "endpoint", l.Endpoint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogsIngestionEndpointSpec. +func (l *LogsIngestionEndpointSpec) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endpoint": + err = unpopulate(val, "Endpoint", &l.Endpoint) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagementEventAggregationCondition. +func (m ManagementEventAggregationCondition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "operator", m.Operator) + populate(objectMap, "threshold", m.Threshold) + populate(objectMap, "windowSize", m.WindowSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementEventAggregationCondition. +func (m *ManagementEventAggregationCondition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "operator": + err = unpopulate(val, "Operator", &m.Operator) + delete(rawMsg, key) + case "threshold": + err = unpopulate(val, "Threshold", &m.Threshold) + delete(rawMsg, key) + case "windowSize": + err = unpopulate(val, "WindowSize", &m.WindowSize) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagementEventRuleCondition. +func (m ManagementEventRuleCondition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aggregation", m.Aggregation) + populate(objectMap, "dataSource", m.DataSource) + objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementEventRuleCondition. +func (m *ManagementEventRuleCondition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aggregation": + err = unpopulate(val, "Aggregation", &m.Aggregation) + delete(rawMsg, key) + case "dataSource": + m.DataSource, err = unmarshalRuleDataSourceClassification(val) + delete(rawMsg, key) + case "odata.type": + err = unpopulate(val, "ODataType", &m.ODataType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Metadata. +func (m Metadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisionedBy", m.ProvisionedBy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Metadata. +func (m *Metadata) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisionedBy": + err = unpopulate(val, "ProvisionedBy", &m.ProvisionedBy) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetadataValue. +func (m MetadataValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", m.Name) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetadataValue. +func (m *MetadataValue) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Metric. +func (m Metric) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "displayDescription", m.DisplayDescription) + populate(objectMap, "errorCode", m.ErrorCode) + populate(objectMap, "errorMessage", m.ErrorMessage) + populate(objectMap, "id", m.ID) + populate(objectMap, "name", m.Name) + populate(objectMap, "timeseries", m.Timeseries) + populate(objectMap, "type", m.Type) + populate(objectMap, "unit", m.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Metric. +func (m *Metric) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayDescription": + err = unpopulate(val, "DisplayDescription", &m.DisplayDescription) + delete(rawMsg, key) + case "errorCode": + err = unpopulate(val, "ErrorCode", &m.ErrorCode) + delete(rawMsg, key) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &m.ErrorMessage) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "timeseries": + err = unpopulate(val, "Timeseries", &m.Timeseries) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &m.Unit) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricAlertAction. +func (m MetricAlertAction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actionGroupId", m.ActionGroupID) + populate(objectMap, "webHookProperties", m.WebHookProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertAction. +func (m *MetricAlertAction) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionGroupId": + err = unpopulate(val, "ActionGroupID", &m.ActionGroupID) + delete(rawMsg, key) + case "webHookProperties": + err = unpopulate(val, "WebHookProperties", &m.WebHookProperties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricAlertCriteria. +func (m MetricAlertCriteria) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["odata.type"] = m.ODataType + if m.AdditionalProperties != nil { + for key, val := range m.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertCriteria. +func (m *MetricAlertCriteria) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "odata.type": + err = unpopulate(val, "ODataType", &m.ODataType) + delete(rawMsg, key) + default: + if m.AdditionalProperties == nil { + m.AdditionalProperties = map[string]interface{}{} + } + if val != nil { + var aux interface{} + err = json.Unmarshal(val, &aux) + m.AdditionalProperties[key] = aux + } + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricAlertMultipleResourceMultipleMetricCriteria. +func (m MetricAlertMultipleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allOf", m.AllOf) + objectMap["odata.type"] = OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria + if m.AdditionalProperties != nil { + for key, val := range m.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertMultipleResourceMultipleMetricCriteria. +func (m *MetricAlertMultipleResourceMultipleMetricCriteria) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allOf": + m.AllOf, err = unmarshalMultiMetricCriteriaClassificationArray(val) + delete(rawMsg, key) + case "odata.type": + err = unpopulate(val, "ODataType", &m.ODataType) + delete(rawMsg, key) + default: + if m.AdditionalProperties == nil { + m.AdditionalProperties = map[string]interface{}{} + } + if val != nil { + var aux interface{} + err = json.Unmarshal(val, &aux) + m.AdditionalProperties[key] = aux + } + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricAlertProperties. +func (m MetricAlertProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actions", m.Actions) + populate(objectMap, "autoMitigate", m.AutoMitigate) + populate(objectMap, "criteria", m.Criteria) + populate(objectMap, "description", m.Description) + populate(objectMap, "enabled", m.Enabled) + populate(objectMap, "evaluationFrequency", m.EvaluationFrequency) + populate(objectMap, "isMigrated", m.IsMigrated) + populateTimeRFC3339(objectMap, "lastUpdatedTime", m.LastUpdatedTime) + populate(objectMap, "scopes", m.Scopes) + populate(objectMap, "severity", m.Severity) + populate(objectMap, "targetResourceRegion", m.TargetResourceRegion) + populate(objectMap, "targetResourceType", m.TargetResourceType) + populate(objectMap, "windowSize", m.WindowSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertProperties. +func (m *MetricAlertProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actions": + err = unpopulate(val, "Actions", &m.Actions) + delete(rawMsg, key) + case "autoMitigate": + err = unpopulate(val, "AutoMitigate", &m.AutoMitigate) + delete(rawMsg, key) + case "criteria": + m.Criteria, err = unmarshalMetricAlertCriteriaClassification(val) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &m.Description) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &m.Enabled) + delete(rawMsg, key) + case "evaluationFrequency": + err = unpopulate(val, "EvaluationFrequency", &m.EvaluationFrequency) + delete(rawMsg, key) + case "isMigrated": + err = unpopulate(val, "IsMigrated", &m.IsMigrated) + delete(rawMsg, key) + case "lastUpdatedTime": + err = unpopulateTimeRFC3339(val, "LastUpdatedTime", &m.LastUpdatedTime) + delete(rawMsg, key) + case "scopes": + err = unpopulate(val, "Scopes", &m.Scopes) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &m.Severity) + delete(rawMsg, key) + case "targetResourceRegion": + err = unpopulate(val, "TargetResourceRegion", &m.TargetResourceRegion) + delete(rawMsg, key) + case "targetResourceType": + err = unpopulate(val, "TargetResourceType", &m.TargetResourceType) + delete(rawMsg, key) + case "windowSize": + err = unpopulate(val, "WindowSize", &m.WindowSize) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricAlertPropertiesPatch. +func (m MetricAlertPropertiesPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actions", m.Actions) + populate(objectMap, "autoMitigate", m.AutoMitigate) + populate(objectMap, "criteria", m.Criteria) + populate(objectMap, "description", m.Description) + populate(objectMap, "enabled", m.Enabled) + populate(objectMap, "evaluationFrequency", m.EvaluationFrequency) + populate(objectMap, "isMigrated", m.IsMigrated) + populateTimeRFC3339(objectMap, "lastUpdatedTime", m.LastUpdatedTime) + populate(objectMap, "scopes", m.Scopes) + populate(objectMap, "severity", m.Severity) + populate(objectMap, "targetResourceRegion", m.TargetResourceRegion) + populate(objectMap, "targetResourceType", m.TargetResourceType) + populate(objectMap, "windowSize", m.WindowSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertPropertiesPatch. +func (m *MetricAlertPropertiesPatch) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actions": + err = unpopulate(val, "Actions", &m.Actions) + delete(rawMsg, key) + case "autoMitigate": + err = unpopulate(val, "AutoMitigate", &m.AutoMitigate) + delete(rawMsg, key) + case "criteria": + m.Criteria, err = unmarshalMetricAlertCriteriaClassification(val) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &m.Description) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &m.Enabled) + delete(rawMsg, key) + case "evaluationFrequency": + err = unpopulate(val, "EvaluationFrequency", &m.EvaluationFrequency) + delete(rawMsg, key) + case "isMigrated": + err = unpopulate(val, "IsMigrated", &m.IsMigrated) + delete(rawMsg, key) + case "lastUpdatedTime": + err = unpopulateTimeRFC3339(val, "LastUpdatedTime", &m.LastUpdatedTime) + delete(rawMsg, key) + case "scopes": + err = unpopulate(val, "Scopes", &m.Scopes) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &m.Severity) + delete(rawMsg, key) + case "targetResourceRegion": + err = unpopulate(val, "TargetResourceRegion", &m.TargetResourceRegion) + delete(rawMsg, key) + case "targetResourceType": + err = unpopulate(val, "TargetResourceType", &m.TargetResourceType) + delete(rawMsg, key) + case "windowSize": + err = unpopulate(val, "WindowSize", &m.WindowSize) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricAlertResource. +func (m MetricAlertResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", m.ID) + populate(objectMap, "location", m.Location) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertResource. +func (m *MetricAlertResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &m.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricAlertResourceCollection. +func (m MetricAlertResourceCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertResourceCollection. +func (m *MetricAlertResourceCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricAlertResourcePatch. +func (m MetricAlertResourcePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "tags", m.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertResourcePatch. +func (m *MetricAlertResourcePatch) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricAlertSingleResourceMultipleMetricCriteria. +func (m MetricAlertSingleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allOf", m.AllOf) + objectMap["odata.type"] = OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria + if m.AdditionalProperties != nil { + for key, val := range m.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertSingleResourceMultipleMetricCriteria. +func (m *MetricAlertSingleResourceMultipleMetricCriteria) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allOf": + err = unpopulate(val, "AllOf", &m.AllOf) + delete(rawMsg, key) + case "odata.type": + err = unpopulate(val, "ODataType", &m.ODataType) + delete(rawMsg, key) + default: + if m.AdditionalProperties == nil { + m.AdditionalProperties = map[string]interface{}{} + } + if val != nil { + var aux interface{} + err = json.Unmarshal(val, &aux) + m.AdditionalProperties[key] = aux + } + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricAlertStatus. +func (m MetricAlertStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", m.ID) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertStatus. +func (m *MetricAlertStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricAlertStatusCollection. +func (m MetricAlertStatusCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertStatusCollection. +func (m *MetricAlertStatusCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricAlertStatusProperties. +func (m MetricAlertStatusProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dimensions", m.Dimensions) + populate(objectMap, "status", m.Status) + populateTimeRFC3339(objectMap, "timestamp", m.Timestamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertStatusProperties. +func (m *MetricAlertStatusProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dimensions": + err = unpopulate(val, "Dimensions", &m.Dimensions) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &m.Status) + delete(rawMsg, key) + case "timestamp": + err = unpopulateTimeRFC3339(val, "Timestamp", &m.Timestamp) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricAvailability. +func (m MetricAvailability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "retention", m.Retention) + populate(objectMap, "timeGrain", m.TimeGrain) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAvailability. +func (m *MetricAvailability) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "retention": + err = unpopulate(val, "Retention", &m.Retention) + delete(rawMsg, key) + case "timeGrain": + err = unpopulate(val, "TimeGrain", &m.TimeGrain) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricBaselinesProperties. +func (m MetricBaselinesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "baselines", m.Baselines) + populate(objectMap, "interval", m.Interval) + populate(objectMap, "namespace", m.Namespace) + populate(objectMap, "timespan", m.Timespan) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricBaselinesProperties. +func (m *MetricBaselinesProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "baselines": + err = unpopulate(val, "Baselines", &m.Baselines) + delete(rawMsg, key) + case "interval": + err = unpopulate(val, "Interval", &m.Interval) + delete(rawMsg, key) + case "namespace": + err = unpopulate(val, "Namespace", &m.Namespace) + delete(rawMsg, key) + case "timespan": + err = unpopulate(val, "Timespan", &m.Timespan) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricBaselinesResponse. +func (m MetricBaselinesResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricBaselinesResponse. +func (m *MetricBaselinesResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricCriteria. +func (m MetricCriteria) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["criterionType"] = CriterionTypeStaticThresholdCriterion + populate(objectMap, "dimensions", m.Dimensions) + populate(objectMap, "metricName", m.MetricName) + populate(objectMap, "metricNamespace", m.MetricNamespace) + populate(objectMap, "name", m.Name) + populate(objectMap, "operator", m.Operator) + populate(objectMap, "skipMetricValidation", m.SkipMetricValidation) + populate(objectMap, "threshold", m.Threshold) + populate(objectMap, "timeAggregation", m.TimeAggregation) + if m.AdditionalProperties != nil { + for key, val := range m.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricCriteria. +func (m *MetricCriteria) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "criterionType": + err = unpopulate(val, "CriterionType", &m.CriterionType) + delete(rawMsg, key) + case "dimensions": + err = unpopulate(val, "Dimensions", &m.Dimensions) + delete(rawMsg, key) + case "metricName": + err = unpopulate(val, "MetricName", &m.MetricName) + delete(rawMsg, key) + case "metricNamespace": + err = unpopulate(val, "MetricNamespace", &m.MetricNamespace) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "operator": + err = unpopulate(val, "Operator", &m.Operator) + delete(rawMsg, key) + case "skipMetricValidation": + err = unpopulate(val, "SkipMetricValidation", &m.SkipMetricValidation) + delete(rawMsg, key) + case "threshold": + err = unpopulate(val, "Threshold", &m.Threshold) + delete(rawMsg, key) + case "timeAggregation": + err = unpopulate(val, "TimeAggregation", &m.TimeAggregation) + delete(rawMsg, key) + default: + if m.AdditionalProperties == nil { + m.AdditionalProperties = map[string]interface{}{} + } + if val != nil { + var aux interface{} + err = json.Unmarshal(val, &aux) + m.AdditionalProperties[key] = aux + } + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricDefinition. +func (m MetricDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "category", m.Category) + populate(objectMap, "dimensions", m.Dimensions) + populate(objectMap, "displayDescription", m.DisplayDescription) + populate(objectMap, "id", m.ID) + populate(objectMap, "isDimensionRequired", m.IsDimensionRequired) + populate(objectMap, "metricAvailabilities", m.MetricAvailabilities) + populate(objectMap, "metricClass", m.MetricClass) + populate(objectMap, "name", m.Name) + populate(objectMap, "namespace", m.Namespace) + populate(objectMap, "primaryAggregationType", m.PrimaryAggregationType) + populate(objectMap, "resourceId", m.ResourceID) + populate(objectMap, "supportedAggregationTypes", m.SupportedAggregationTypes) + populate(objectMap, "unit", m.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricDefinition. +func (m *MetricDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "category": + err = unpopulate(val, "Category", &m.Category) + delete(rawMsg, key) + case "dimensions": + err = unpopulate(val, "Dimensions", &m.Dimensions) + delete(rawMsg, key) + case "displayDescription": + err = unpopulate(val, "DisplayDescription", &m.DisplayDescription) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "isDimensionRequired": + err = unpopulate(val, "IsDimensionRequired", &m.IsDimensionRequired) + delete(rawMsg, key) + case "metricAvailabilities": + err = unpopulate(val, "MetricAvailabilities", &m.MetricAvailabilities) + delete(rawMsg, key) + case "metricClass": + err = unpopulate(val, "MetricClass", &m.MetricClass) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "namespace": + err = unpopulate(val, "Namespace", &m.Namespace) + delete(rawMsg, key) + case "primaryAggregationType": + err = unpopulate(val, "PrimaryAggregationType", &m.PrimaryAggregationType) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &m.ResourceID) + delete(rawMsg, key) + case "supportedAggregationTypes": + err = unpopulate(val, "SupportedAggregationTypes", &m.SupportedAggregationTypes) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &m.Unit) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricDefinitionCollection. +func (m MetricDefinitionCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricDefinitionCollection. +func (m *MetricDefinitionCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricDimension. +func (m MetricDimension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", m.Name) + populate(objectMap, "operator", m.Operator) + populate(objectMap, "values", m.Values) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricDimension. +func (m *MetricDimension) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "operator": + err = unpopulate(val, "Operator", &m.Operator) + delete(rawMsg, key) + case "values": + err = unpopulate(val, "Values", &m.Values) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricNamespace. +func (m MetricNamespace) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "classification", m.Classification) + populate(objectMap, "id", m.ID) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricNamespace. +func (m *MetricNamespace) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "classification": + err = unpopulate(val, "Classification", &m.Classification) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricNamespaceCollection. +func (m MetricNamespaceCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricNamespaceCollection. +func (m *MetricNamespaceCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricNamespaceName. +func (m MetricNamespaceName) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "metricNamespaceName", m.MetricNamespaceName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricNamespaceName. +func (m *MetricNamespaceName) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "metricNamespaceName": + err = unpopulate(val, "MetricNamespaceName", &m.MetricNamespaceName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricSettings. +func (m MetricSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "category", m.Category) + populate(objectMap, "enabled", m.Enabled) + populate(objectMap, "retentionPolicy", m.RetentionPolicy) + populate(objectMap, "timeGrain", m.TimeGrain) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricSettings. +func (m *MetricSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "category": + err = unpopulate(val, "Category", &m.Category) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &m.Enabled) + delete(rawMsg, key) + case "retentionPolicy": + err = unpopulate(val, "RetentionPolicy", &m.RetentionPolicy) + delete(rawMsg, key) + case "timeGrain": + err = unpopulate(val, "TimeGrain", &m.TimeGrain) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricSingleDimension. +func (m MetricSingleDimension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", m.Name) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricSingleDimension. +func (m *MetricSingleDimension) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricTrigger. +func (m MetricTrigger) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dimensions", m.Dimensions) + populate(objectMap, "dividePerInstance", m.DividePerInstance) + populate(objectMap, "metricName", m.MetricName) + populate(objectMap, "metricNamespace", m.MetricNamespace) + populate(objectMap, "metricResourceLocation", m.MetricResourceLocation) + populate(objectMap, "metricResourceUri", m.MetricResourceURI) + populate(objectMap, "operator", m.Operator) + populate(objectMap, "statistic", m.Statistic) + populate(objectMap, "threshold", m.Threshold) + populate(objectMap, "timeAggregation", m.TimeAggregation) + populate(objectMap, "timeGrain", m.TimeGrain) + populate(objectMap, "timeWindow", m.TimeWindow) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricTrigger. +func (m *MetricTrigger) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dimensions": + err = unpopulate(val, "Dimensions", &m.Dimensions) + delete(rawMsg, key) + case "dividePerInstance": + err = unpopulate(val, "DividePerInstance", &m.DividePerInstance) + delete(rawMsg, key) + case "metricName": + err = unpopulate(val, "MetricName", &m.MetricName) + delete(rawMsg, key) + case "metricNamespace": + err = unpopulate(val, "MetricNamespace", &m.MetricNamespace) + delete(rawMsg, key) + case "metricResourceLocation": + err = unpopulate(val, "MetricResourceLocation", &m.MetricResourceLocation) + delete(rawMsg, key) + case "metricResourceUri": + err = unpopulate(val, "MetricResourceURI", &m.MetricResourceURI) + delete(rawMsg, key) + case "operator": + err = unpopulate(val, "Operator", &m.Operator) + delete(rawMsg, key) + case "statistic": + err = unpopulate(val, "Statistic", &m.Statistic) + delete(rawMsg, key) + case "threshold": + err = unpopulate(val, "Threshold", &m.Threshold) + delete(rawMsg, key) + case "timeAggregation": + err = unpopulate(val, "TimeAggregation", &m.TimeAggregation) + delete(rawMsg, key) + case "timeGrain": + err = unpopulate(val, "TimeGrain", &m.TimeGrain) + delete(rawMsg, key) + case "timeWindow": + err = unpopulate(val, "TimeWindow", &m.TimeWindow) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetricValue. +func (m MetricValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "average", m.Average) + populate(objectMap, "count", m.Count) + populate(objectMap, "maximum", m.Maximum) + populate(objectMap, "minimum", m.Minimum) + populateTimeRFC3339(objectMap, "timeStamp", m.TimeStamp) + populate(objectMap, "total", m.Total) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetricValue. +func (m *MetricValue) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "average": + err = unpopulate(val, "Average", &m.Average) + delete(rawMsg, key) + case "count": + err = unpopulate(val, "Count", &m.Count) + delete(rawMsg, key) + case "maximum": + err = unpopulate(val, "Maximum", &m.Maximum) + delete(rawMsg, key) + case "minimum": + err = unpopulate(val, "Minimum", &m.Minimum) + delete(rawMsg, key) + case "timeStamp": + err = unpopulateTimeRFC3339(val, "TimeStamp", &m.TimeStamp) + delete(rawMsg, key) + case "total": + err = unpopulate(val, "Total", &m.Total) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MultiMetricCriteria. +func (m MultiMetricCriteria) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["criterionType"] = m.CriterionType + populate(objectMap, "dimensions", m.Dimensions) + populate(objectMap, "metricName", m.MetricName) + populate(objectMap, "metricNamespace", m.MetricNamespace) + populate(objectMap, "name", m.Name) + populate(objectMap, "skipMetricValidation", m.SkipMetricValidation) + populate(objectMap, "timeAggregation", m.TimeAggregation) + if m.AdditionalProperties != nil { + for key, val := range m.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MultiMetricCriteria. +func (m *MultiMetricCriteria) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "criterionType": + err = unpopulate(val, "CriterionType", &m.CriterionType) + delete(rawMsg, key) + case "dimensions": + err = unpopulate(val, "Dimensions", &m.Dimensions) + delete(rawMsg, key) + case "metricName": + err = unpopulate(val, "MetricName", &m.MetricName) + delete(rawMsg, key) + case "metricNamespace": + err = unpopulate(val, "MetricNamespace", &m.MetricNamespace) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "skipMetricValidation": + err = unpopulate(val, "SkipMetricValidation", &m.SkipMetricValidation) + delete(rawMsg, key) + case "timeAggregation": + err = unpopulate(val, "TimeAggregation", &m.TimeAggregation) + delete(rawMsg, key) + default: + if m.AdditionalProperties == nil { + m.AdditionalProperties = map[string]interface{}{} + } + if val != nil { + var aux interface{} + err = json.Unmarshal(val, &aux) + m.AdditionalProperties[key] = aux + } + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkRuleSet. +func (n NetworkRuleSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "publicNetworkAccess", n.PublicNetworkAccess) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkRuleSet. +func (n *NetworkRuleSet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &n.PublicNetworkAccess) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NotificationRequestBody. +func (n NotificationRequestBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alertType", n.AlertType) + populate(objectMap, "armRoleReceivers", n.ArmRoleReceivers) + populate(objectMap, "automationRunbookReceivers", n.AutomationRunbookReceivers) + populate(objectMap, "azureAppPushReceivers", n.AzureAppPushReceivers) + populate(objectMap, "azureFunctionReceivers", n.AzureFunctionReceivers) + populate(objectMap, "emailReceivers", n.EmailReceivers) + populate(objectMap, "eventHubReceivers", n.EventHubReceivers) + populate(objectMap, "itsmReceivers", n.ItsmReceivers) + populate(objectMap, "logicAppReceivers", n.LogicAppReceivers) + populate(objectMap, "smsReceivers", n.SmsReceivers) + populate(objectMap, "voiceReceivers", n.VoiceReceivers) + populate(objectMap, "webhookReceivers", n.WebhookReceivers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NotificationRequestBody. +func (n *NotificationRequestBody) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertType": + err = unpopulate(val, "AlertType", &n.AlertType) + delete(rawMsg, key) + case "armRoleReceivers": + err = unpopulate(val, "ArmRoleReceivers", &n.ArmRoleReceivers) + delete(rawMsg, key) + case "automationRunbookReceivers": + err = unpopulate(val, "AutomationRunbookReceivers", &n.AutomationRunbookReceivers) + delete(rawMsg, key) + case "azureAppPushReceivers": + err = unpopulate(val, "AzureAppPushReceivers", &n.AzureAppPushReceivers) + delete(rawMsg, key) + case "azureFunctionReceivers": + err = unpopulate(val, "AzureFunctionReceivers", &n.AzureFunctionReceivers) + delete(rawMsg, key) + case "emailReceivers": + err = unpopulate(val, "EmailReceivers", &n.EmailReceivers) + delete(rawMsg, key) + case "eventHubReceivers": + err = unpopulate(val, "EventHubReceivers", &n.EventHubReceivers) + delete(rawMsg, key) + case "itsmReceivers": + err = unpopulate(val, "ItsmReceivers", &n.ItsmReceivers) + delete(rawMsg, key) + case "logicAppReceivers": + err = unpopulate(val, "LogicAppReceivers", &n.LogicAppReceivers) + delete(rawMsg, key) + case "smsReceivers": + err = unpopulate(val, "SmsReceivers", &n.SmsReceivers) + delete(rawMsg, key) + case "voiceReceivers": + err = unpopulate(val, "VoiceReceivers", &n.VoiceReceivers) + delete(rawMsg, key) + case "webhookReceivers": + err = unpopulate(val, "WebhookReceivers", &n.WebhookReceivers) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "display", o.Display) + populate(objectMap, "name", o.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationStatus. +func (o OperationStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "endTime", o.EndTime) + populate(objectMap, "error", o.Error) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populateTimeRFC3339(objectMap, "startTime", o.StartTime) + populate(objectMap, "status", o.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatus. +func (o *OperationStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endTime": + err = unpopulateTimeRFC3339(val, "EndTime", &o.EndTime) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &o.Error) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &o.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &o.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PerfCounterDataSource. +func (p PerfCounterDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "counterSpecifiers", p.CounterSpecifiers) + populate(objectMap, "name", p.Name) + populate(objectMap, "samplingFrequencyInSeconds", p.SamplingFrequencyInSeconds) + populate(objectMap, "streams", p.Streams) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PerfCounterDataSource. +func (p *PerfCounterDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "counterSpecifiers": + err = unpopulate(val, "CounterSpecifiers", &p.CounterSpecifiers) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "samplingFrequencyInSeconds": + err = unpopulate(val, "SamplingFrequencyInSeconds", &p.SamplingFrequencyInSeconds) + delete(rawMsg, key) + case "streams": + err = unpopulate(val, "Streams", &p.Streams) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PredictiveAutoscalePolicy. +func (p PredictiveAutoscalePolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "scaleLookAheadTime", p.ScaleLookAheadTime) + populate(objectMap, "scaleMode", p.ScaleMode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PredictiveAutoscalePolicy. +func (p *PredictiveAutoscalePolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "scaleLookAheadTime": + err = unpopulate(val, "ScaleLookAheadTime", &p.ScaleLookAheadTime) + delete(rawMsg, key) + case "scaleMode": + err = unpopulate(val, "ScaleMode", &p.ScaleMode) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PredictiveResponse. +func (p PredictiveResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "data", p.Data) + populate(objectMap, "interval", p.Interval) + populate(objectMap, "metricName", p.MetricName) + populate(objectMap, "targetResourceId", p.TargetResourceID) + populate(objectMap, "timespan", p.Timespan) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PredictiveResponse. +func (p *PredictiveResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "data": + err = unpopulate(val, "Data", &p.Data) + delete(rawMsg, key) + case "interval": + err = unpopulate(val, "Interval", &p.Interval) + delete(rawMsg, key) + case "metricName": + err = unpopulate(val, "MetricName", &p.MetricName) + delete(rawMsg, key) + case "targetResourceId": + err = unpopulate(val, "TargetResourceID", &p.TargetResourceID) + delete(rawMsg, key) + case "timespan": + err = unpopulate(val, "Timespan", &p.Timespan) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PredictiveValue. +func (p PredictiveValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "timeStamp", p.TimeStamp) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PredictiveValue. +func (p *PredictiveValue) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "timeStamp": + err = unpopulateTimeRFC3339(val, "TimeStamp", &p.TimeStamp) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. +func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. +func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. +func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult. +func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. +func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. +func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointProperty. +func (p PrivateEndpointProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointProperty. +func (p *PrivateEndpointProperty) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. +func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. +func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. +func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceListResult. +func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "requiredMembers", p.RequiredMembers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. +func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) + delete(rawMsg, key) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkScopesResource. +func (p PrivateLinkScopesResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkScopesResource. +func (p *PrivateLinkScopesResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionStateProperty. +func (p PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actionsRequired", p.ActionsRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionStateProperty. +func (p *PrivateLinkServiceConnectionStateProperty) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionsRequired": + err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProxyOnlyResource. +func (p ProxyOnlyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyOnlyResource. +func (p *ProxyOnlyResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProxyResource. +func (p ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. +func (p *ProxyResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Recurrence. +func (r Recurrence) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "frequency", r.Frequency) + populate(objectMap, "schedule", r.Schedule) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Recurrence. +func (r *Recurrence) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "frequency": + err = unpopulate(val, "Frequency", &r.Frequency) + delete(rawMsg, key) + case "schedule": + err = unpopulate(val, "Schedule", &r.Schedule) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RecurrentSchedule. +func (r RecurrentSchedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "days", r.Days) + populate(objectMap, "hours", r.Hours) + populate(objectMap, "minutes", r.Minutes) + populate(objectMap, "timeZone", r.TimeZone) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RecurrentSchedule. +func (r *RecurrentSchedule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "days": + err = unpopulate(val, "Days", &r.Days) + delete(rawMsg, key) + case "hours": + err = unpopulate(val, "Hours", &r.Hours) + delete(rawMsg, key) + case "minutes": + err = unpopulate(val, "Minutes", &r.Minutes) + delete(rawMsg, key) + case "timeZone": + err = unpopulate(val, "TimeZone", &r.TimeZone) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated. +func (r ResourceAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated. +func (r *ResourceAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated2. +func (r ResourceAutoGenerated2) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated2. +func (r *ResourceAutoGenerated2) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated3. +func (r ResourceAutoGenerated3) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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 { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceForUpdate. +func (r ResourceForUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tags", r.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceForUpdate. +func (r *ResourceForUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Response. +func (r Response) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cost", r.Cost) + populate(objectMap, "interval", r.Interval) + populate(objectMap, "namespace", r.Namespace) + populate(objectMap, "resourceregion", r.Resourceregion) + populate(objectMap, "timespan", r.Timespan) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Response. +func (r *Response) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "cost": + err = unpopulate(val, "Cost", &r.Cost) + delete(rawMsg, key) + case "interval": + err = unpopulate(val, "Interval", &r.Interval) + delete(rawMsg, key) + case "namespace": + err = unpopulate(val, "Namespace", &r.Namespace) + delete(rawMsg, key) + case "resourceregion": + err = unpopulate(val, "Resourceregion", &r.Resourceregion) + delete(rawMsg, key) + case "timespan": + err = unpopulate(val, "Timespan", &r.Timespan) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResponseWithError. +func (r ResponseWithError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "error", r.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResponseWithError. +func (r *ResponseWithError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &r.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RetentionPolicy. +func (r RetentionPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "days", r.Days) + populate(objectMap, "enabled", r.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RetentionPolicy. +func (r *RetentionPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "days": + err = unpopulate(val, "Days", &r.Days) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &r.Enabled) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RuleAction. +func (r RuleAction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["odata.type"] = r.ODataType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RuleAction. +func (r *RuleAction) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "odata.type": + err = unpopulate(val, "ODataType", &r.ODataType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RuleCondition. +func (r RuleCondition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataSource", r.DataSource) + objectMap["odata.type"] = r.ODataType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RuleCondition. +func (r *RuleCondition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataSource": + r.DataSource, err = unmarshalRuleDataSourceClassification(val) + delete(rawMsg, key) + case "odata.type": + err = unpopulate(val, "ODataType", &r.ODataType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RuleDataSource. +func (r RuleDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "legacyResourceId", r.LegacyResourceID) + populate(objectMap, "metricNamespace", r.MetricNamespace) + objectMap["odata.type"] = r.ODataType + populate(objectMap, "resourceLocation", r.ResourceLocation) + populate(objectMap, "resourceUri", r.ResourceURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RuleDataSource. +func (r *RuleDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "legacyResourceId": + err = unpopulate(val, "LegacyResourceID", &r.LegacyResourceID) + delete(rawMsg, key) + case "metricNamespace": + err = unpopulate(val, "MetricNamespace", &r.MetricNamespace) + delete(rawMsg, key) + case "odata.type": + err = unpopulate(val, "ODataType", &r.ODataType) + delete(rawMsg, key) + case "resourceLocation": + err = unpopulate(val, "ResourceLocation", &r.ResourceLocation) + delete(rawMsg, key) + case "resourceUri": + err = unpopulate(val, "ResourceURI", &r.ResourceURI) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RuleEmailAction. +func (r RuleEmailAction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "customEmails", r.CustomEmails) + objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.RuleEmailAction" + populate(objectMap, "sendToServiceOwners", r.SendToServiceOwners) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RuleEmailAction. +func (r *RuleEmailAction) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "customEmails": + err = unpopulate(val, "CustomEmails", &r.CustomEmails) + delete(rawMsg, key) + case "odata.type": + err = unpopulate(val, "ODataType", &r.ODataType) + delete(rawMsg, key) + case "sendToServiceOwners": + err = unpopulate(val, "SendToServiceOwners", &r.SendToServiceOwners) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RuleManagementEventClaimsDataSource. +func (r RuleManagementEventClaimsDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "emailAddress", r.EmailAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RuleManagementEventClaimsDataSource. +func (r *RuleManagementEventClaimsDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "emailAddress": + err = unpopulate(val, "EmailAddress", &r.EmailAddress) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RuleManagementEventDataSource. +func (r RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "claims", r.Claims) + populate(objectMap, "eventName", r.EventName) + populate(objectMap, "eventSource", r.EventSource) + populate(objectMap, "legacyResourceId", r.LegacyResourceID) + populate(objectMap, "level", r.Level) + populate(objectMap, "metricNamespace", r.MetricNamespace) + objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource" + populate(objectMap, "operationName", r.OperationName) + populate(objectMap, "resourceGroupName", r.ResourceGroupName) + populate(objectMap, "resourceLocation", r.ResourceLocation) + populate(objectMap, "resourceProviderName", r.ResourceProviderName) + populate(objectMap, "resourceUri", r.ResourceURI) + populate(objectMap, "status", r.Status) + populate(objectMap, "subStatus", r.SubStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RuleManagementEventDataSource. +func (r *RuleManagementEventDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "claims": + err = unpopulate(val, "Claims", &r.Claims) + delete(rawMsg, key) + case "eventName": + err = unpopulate(val, "EventName", &r.EventName) + delete(rawMsg, key) + case "eventSource": + err = unpopulate(val, "EventSource", &r.EventSource) + delete(rawMsg, key) + case "legacyResourceId": + err = unpopulate(val, "LegacyResourceID", &r.LegacyResourceID) + delete(rawMsg, key) + case "level": + err = unpopulate(val, "Level", &r.Level) + delete(rawMsg, key) + case "metricNamespace": + err = unpopulate(val, "MetricNamespace", &r.MetricNamespace) + delete(rawMsg, key) + case "odata.type": + err = unpopulate(val, "ODataType", &r.ODataType) + delete(rawMsg, key) + case "operationName": + err = unpopulate(val, "OperationName", &r.OperationName) + delete(rawMsg, key) + case "resourceGroupName": + err = unpopulate(val, "ResourceGroupName", &r.ResourceGroupName) + delete(rawMsg, key) + case "resourceLocation": + err = unpopulate(val, "ResourceLocation", &r.ResourceLocation) + delete(rawMsg, key) + case "resourceProviderName": + err = unpopulate(val, "ResourceProviderName", &r.ResourceProviderName) + delete(rawMsg, key) + case "resourceUri": + err = unpopulate(val, "ResourceURI", &r.ResourceURI) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + delete(rawMsg, key) + case "subStatus": + err = unpopulate(val, "SubStatus", &r.SubStatus) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RuleMetricDataSource. +func (r RuleMetricDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "legacyResourceId", r.LegacyResourceID) + populate(objectMap, "metricName", r.MetricName) + populate(objectMap, "metricNamespace", r.MetricNamespace) + objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource" + populate(objectMap, "resourceLocation", r.ResourceLocation) + populate(objectMap, "resourceUri", r.ResourceURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RuleMetricDataSource. +func (r *RuleMetricDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "legacyResourceId": + err = unpopulate(val, "LegacyResourceID", &r.LegacyResourceID) + delete(rawMsg, key) + case "metricName": + err = unpopulate(val, "MetricName", &r.MetricName) + delete(rawMsg, key) + case "metricNamespace": + err = unpopulate(val, "MetricNamespace", &r.MetricNamespace) + delete(rawMsg, key) + case "odata.type": + err = unpopulate(val, "ODataType", &r.ODataType) + delete(rawMsg, key) + case "resourceLocation": + err = unpopulate(val, "ResourceLocation", &r.ResourceLocation) + delete(rawMsg, key) + case "resourceUri": + err = unpopulate(val, "ResourceURI", &r.ResourceURI) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RuleWebhookAction. +func (r RuleWebhookAction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction" + populate(objectMap, "properties", r.Properties) + populate(objectMap, "serviceUri", r.ServiceURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RuleWebhookAction. +func (r *RuleWebhookAction) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "odata.type": + err = unpopulate(val, "ODataType", &r.ODataType) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "serviceUri": + err = unpopulate(val, "ServiceURI", &r.ServiceURI) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScaleAction. +func (s ScaleAction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cooldown", s.Cooldown) + populate(objectMap, "direction", s.Direction) + populate(objectMap, "type", s.Type) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScaleAction. +func (s *ScaleAction) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "cooldown": + err = unpopulate(val, "Cooldown", &s.Cooldown) + delete(rawMsg, key) + case "direction": + err = unpopulate(val, "Direction", &s.Direction) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScaleCapacity. +func (s ScaleCapacity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "default", s.Default) + populate(objectMap, "maximum", s.Maximum) + populate(objectMap, "minimum", s.Minimum) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScaleCapacity. +func (s *ScaleCapacity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "default": + err = unpopulate(val, "Default", &s.Default) + delete(rawMsg, key) + case "maximum": + err = unpopulate(val, "Maximum", &s.Maximum) + delete(rawMsg, key) + case "minimum": + err = unpopulate(val, "Minimum", &s.Minimum) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScaleRule. +func (s ScaleRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "metricTrigger", s.MetricTrigger) + populate(objectMap, "scaleAction", s.ScaleAction) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScaleRule. +func (s *ScaleRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "metricTrigger": + err = unpopulate(val, "MetricTrigger", &s.MetricTrigger) + delete(rawMsg, key) + case "scaleAction": + err = unpopulate(val, "ScaleAction", &s.ScaleAction) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScaleRuleMetricDimension. +func (s ScaleRuleMetricDimension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "DimensionName", s.DimensionName) + populate(objectMap, "Operator", s.Operator) + populate(objectMap, "Values", s.Values) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScaleRuleMetricDimension. +func (s *ScaleRuleMetricDimension) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "DimensionName": + err = unpopulate(val, "DimensionName", &s.DimensionName) + delete(rawMsg, key) + case "Operator": + err = unpopulate(val, "Operator", &s.Operator) + delete(rawMsg, key) + case "Values": + err = unpopulate(val, "Values", &s.Values) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScheduledQueryRuleCriteria. +func (s ScheduledQueryRuleCriteria) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allOf", s.AllOf) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledQueryRuleCriteria. +func (s *ScheduledQueryRuleCriteria) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allOf": + err = unpopulate(val, "AllOf", &s.AllOf) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScheduledQueryRuleProperties. +func (s ScheduledQueryRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actions", s.Actions) + populate(objectMap, "autoMitigate", s.AutoMitigate) + populate(objectMap, "checkWorkspaceAlertsStorageConfigured", s.CheckWorkspaceAlertsStorageConfigured) + populate(objectMap, "createdWithApiVersion", s.CreatedWithAPIVersion) + populate(objectMap, "criteria", s.Criteria) + populate(objectMap, "description", s.Description) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "enabled", s.Enabled) + populate(objectMap, "evaluationFrequency", s.EvaluationFrequency) + populate(objectMap, "isLegacyLogAnalyticsRule", s.IsLegacyLogAnalyticsRule) + populate(objectMap, "isWorkspaceAlertsStorageConfigured", s.IsWorkspaceAlertsStorageConfigured) + populate(objectMap, "muteActionsDuration", s.MuteActionsDuration) + populate(objectMap, "overrideQueryTimeRange", s.OverrideQueryTimeRange) + populate(objectMap, "scopes", s.Scopes) + populate(objectMap, "severity", s.Severity) + populate(objectMap, "skipQueryValidation", s.SkipQueryValidation) + populate(objectMap, "targetResourceTypes", s.TargetResourceTypes) + populate(objectMap, "windowSize", s.WindowSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledQueryRuleProperties. +func (s *ScheduledQueryRuleProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actions": + err = unpopulate(val, "Actions", &s.Actions) + delete(rawMsg, key) + case "autoMitigate": + err = unpopulate(val, "AutoMitigate", &s.AutoMitigate) + delete(rawMsg, key) + case "checkWorkspaceAlertsStorageConfigured": + err = unpopulate(val, "CheckWorkspaceAlertsStorageConfigured", &s.CheckWorkspaceAlertsStorageConfigured) + delete(rawMsg, key) + case "createdWithApiVersion": + err = unpopulate(val, "CreatedWithAPIVersion", &s.CreatedWithAPIVersion) + delete(rawMsg, key) + case "criteria": + err = unpopulate(val, "Criteria", &s.Criteria) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &s.Enabled) + delete(rawMsg, key) + case "evaluationFrequency": + err = unpopulate(val, "EvaluationFrequency", &s.EvaluationFrequency) + delete(rawMsg, key) + case "isLegacyLogAnalyticsRule": + err = unpopulate(val, "IsLegacyLogAnalyticsRule", &s.IsLegacyLogAnalyticsRule) + delete(rawMsg, key) + case "isWorkspaceAlertsStorageConfigured": + err = unpopulate(val, "IsWorkspaceAlertsStorageConfigured", &s.IsWorkspaceAlertsStorageConfigured) + delete(rawMsg, key) + case "muteActionsDuration": + err = unpopulate(val, "MuteActionsDuration", &s.MuteActionsDuration) + delete(rawMsg, key) + case "overrideQueryTimeRange": + err = unpopulate(val, "OverrideQueryTimeRange", &s.OverrideQueryTimeRange) + delete(rawMsg, key) + case "scopes": + err = unpopulate(val, "Scopes", &s.Scopes) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &s.Severity) + delete(rawMsg, key) + case "skipQueryValidation": + err = unpopulate(val, "SkipQueryValidation", &s.SkipQueryValidation) + delete(rawMsg, key) + case "targetResourceTypes": + err = unpopulate(val, "TargetResourceTypes", &s.TargetResourceTypes) + delete(rawMsg, key) + case "windowSize": + err = unpopulate(val, "WindowSize", &s.WindowSize) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScheduledQueryRuleResource. +func (s ScheduledQueryRuleResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", s.Etag) + populate(objectMap, "id", s.ID) + populate(objectMap, "kind", s.Kind) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledQueryRuleResource. +func (s *ScheduledQueryRuleResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &s.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &s.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScheduledQueryRuleResourceCollection. +func (s ScheduledQueryRuleResourceCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledQueryRuleResourceCollection. +func (s *ScheduledQueryRuleResourceCollection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScheduledQueryRuleResourcePatch. +func (s ScheduledQueryRuleResourcePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "tags", s.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledQueryRuleResourcePatch. +func (s *ScheduledQueryRuleResourcePatch) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScopedResource. +func (s ScopedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScopedResource. +func (s *ScopedResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScopedResourceListResult. +func (s ScopedResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScopedResourceListResult. +func (s *ScopedResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScopedResourceProperties. +func (s ScopedResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "linkedResourceId", s.LinkedResourceID) + populate(objectMap, "provisioningState", s.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScopedResourceProperties. +func (s *ScopedResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "linkedResourceId": + err = unpopulate(val, "LinkedResourceID", &s.LinkedResourceID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SenderAuthorization. +func (s SenderAuthorization) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "action", s.Action) + populate(objectMap, "role", s.Role) + populate(objectMap, "scope", s.Scope) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SenderAuthorization. +func (s *SenderAuthorization) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &s.Action) + delete(rawMsg, key) + case "role": + err = unpopulate(val, "Role", &s.Role) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &s.Scope) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SingleBaseline. +func (s SingleBaseline) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "highThresholds", s.HighThresholds) + populate(objectMap, "lowThresholds", s.LowThresholds) + populate(objectMap, "sensitivity", s.Sensitivity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SingleBaseline. +func (s *SingleBaseline) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "highThresholds": + err = unpopulate(val, "HighThresholds", &s.HighThresholds) + delete(rawMsg, key) + case "lowThresholds": + err = unpopulate(val, "LowThresholds", &s.LowThresholds) + delete(rawMsg, key) + case "sensitivity": + err = unpopulate(val, "Sensitivity", &s.Sensitivity) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SingleMetricBaseline. +func (s SingleMetricBaseline) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SingleMetricBaseline. +func (s *SingleMetricBaseline) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SmsReceiver. +func (s SmsReceiver) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "countryCode", s.CountryCode) + populate(objectMap, "name", s.Name) + populate(objectMap, "phoneNumber", s.PhoneNumber) + populate(objectMap, "status", s.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SmsReceiver. +func (s *SmsReceiver) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "countryCode": + err = unpopulate(val, "CountryCode", &s.CountryCode) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "phoneNumber": + err = unpopulate(val, "PhoneNumber", &s.PhoneNumber) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StreamDeclaration. +func (s StreamDeclaration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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 SyslogDataSource. +func (s SyslogDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "facilityNames", s.FacilityNames) + populate(objectMap, "logLevels", s.LogLevels) + populate(objectMap, "name", s.Name) + populate(objectMap, "streams", s.Streams) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SyslogDataSource. +func (s *SyslogDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "facilityNames": + err = unpopulate(val, "FacilityNames", &s.FacilityNames) + delete(rawMsg, key) + case "logLevels": + err = unpopulate(val, "LogLevels", &s.LogLevels) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "streams": + err = unpopulate(val, "Streams", &s.Streams) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TagsResource. +func (t TagsResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tags", t.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TagsResource. +func (t *TagsResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TestNotificationDetailsResponse. +func (t TestNotificationDetailsResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actionDetails", t.ActionDetails) + populate(objectMap, "completedTime", t.CompletedTime) + populate(objectMap, "context", t.Context) + populate(objectMap, "createdTime", t.CreatedTime) + populate(objectMap, "state", t.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TestNotificationDetailsResponse. +func (t *TestNotificationDetailsResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionDetails": + err = unpopulate(val, "ActionDetails", &t.ActionDetails) + delete(rawMsg, key) + case "completedTime": + err = unpopulate(val, "CompletedTime", &t.CompletedTime) + delete(rawMsg, key) + case "context": + err = unpopulate(val, "Context", &t.Context) + delete(rawMsg, key) + case "createdTime": + err = unpopulate(val, "CreatedTime", &t.CreatedTime) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &t.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ThresholdRuleCondition. +func (t ThresholdRuleCondition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataSource", t.DataSource) + objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition" + populate(objectMap, "operator", t.Operator) + populate(objectMap, "threshold", t.Threshold) + populate(objectMap, "timeAggregation", t.TimeAggregation) + populate(objectMap, "windowSize", t.WindowSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ThresholdRuleCondition. +func (t *ThresholdRuleCondition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataSource": + t.DataSource, err = unmarshalRuleDataSourceClassification(val) + delete(rawMsg, key) + case "odata.type": + err = unpopulate(val, "ODataType", &t.ODataType) + delete(rawMsg, key) + case "operator": + err = unpopulate(val, "Operator", &t.Operator) + delete(rawMsg, key) + case "threshold": + err = unpopulate(val, "Threshold", &t.Threshold) + delete(rawMsg, key) + case "timeAggregation": + err = unpopulate(val, "TimeAggregation", &t.TimeAggregation) + delete(rawMsg, key) + case "windowSize": + err = unpopulate(val, "WindowSize", &t.WindowSize) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TimeSeriesBaseline. +func (t TimeSeriesBaseline) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aggregation", t.Aggregation) + populate(objectMap, "data", t.Data) + populate(objectMap, "dimensions", t.Dimensions) + populate(objectMap, "metadataValues", t.MetadataValues) + aux := make([]*timeRFC3339, len(t.Timestamps), len(t.Timestamps)) + for i := 0; i < len(t.Timestamps); i++ { + aux[i] = (*timeRFC3339)(t.Timestamps[i]) + } + populate(objectMap, "timestamps", aux) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TimeSeriesBaseline. +func (t *TimeSeriesBaseline) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aggregation": + err = unpopulate(val, "Aggregation", &t.Aggregation) + delete(rawMsg, key) + case "data": + err = unpopulate(val, "Data", &t.Data) + delete(rawMsg, key) + case "dimensions": + err = unpopulate(val, "Dimensions", &t.Dimensions) + delete(rawMsg, key) + case "metadataValues": + err = unpopulate(val, "MetadataValues", &t.MetadataValues) + delete(rawMsg, key) + case "timestamps": + var aux []*timeRFC3339 + err = unpopulate(val, "Timestamps", &aux) + for _, au := range aux { + t.Timestamps = append(t.Timestamps, (*time.Time)(au)) + } + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TimeSeriesElement. +func (t TimeSeriesElement) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "data", t.Data) + populate(objectMap, "metadatavalues", t.Metadatavalues) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TimeSeriesElement. +func (t *TimeSeriesElement) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "data": + err = unpopulate(val, "Data", &t.Data) + delete(rawMsg, key) + case "metadatavalues": + err = unpopulate(val, "Metadatavalues", &t.Metadatavalues) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TimeWindow. +func (t TimeWindow) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "end", t.End) + populateTimeRFC3339(objectMap, "start", t.Start) + populate(objectMap, "timeZone", t.TimeZone) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TimeWindow. +func (t *TimeWindow) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "end": + err = unpopulateTimeRFC3339(val, "End", &t.End) + delete(rawMsg, key) + case "start": + err = unpopulateTimeRFC3339(val, "Start", &t.Start) + delete(rawMsg, key) + case "timeZone": + err = unpopulate(val, "TimeZone", &t.TimeZone) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMInsightsOnboardingStatus. +func (v VMInsightsOnboardingStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMInsightsOnboardingStatus. +func (v *VMInsightsOnboardingStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMInsightsOnboardingStatusProperties. +func (v VMInsightsOnboardingStatusProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "data", v.Data) + populate(objectMap, "dataStatus", v.DataStatus) + populate(objectMap, "onboardingStatus", v.OnboardingStatus) + populate(objectMap, "resourceId", v.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMInsightsOnboardingStatusProperties. +func (v *VMInsightsOnboardingStatusProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "data": + err = unpopulate(val, "Data", &v.Data) + delete(rawMsg, key) + case "dataStatus": + err = unpopulate(val, "DataStatus", &v.DataStatus) + delete(rawMsg, key) + case "onboardingStatus": + err = unpopulate(val, "OnboardingStatus", &v.OnboardingStatus) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &v.ResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VoiceReceiver. +func (v VoiceReceiver) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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 VoiceReceiver. +func (v *VoiceReceiver) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", 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{}) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "serviceUri", w.ServiceURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebhookNotification. +func (w *WebhookNotification) UnmarshalJSON(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 "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "serviceUri": + err = unpopulate(val, "ServiceURI", &w.ServiceURI) + 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 WebhookReceiver. +func (w WebhookReceiver) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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 WebhookReceiver. +func (w *WebhookReceiver) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + 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{}) + populate(objectMap, "componentId", w.ComponentID) + populate(objectMap, "failedLocationCount", w.FailedLocationCount) + objectMap["odata.type"] = OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria + populate(objectMap, "webTestId", w.WebTestID) + if w.AdditionalProperties != nil { + for key, val := range w.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WebtestLocationAvailabilityCriteria. +func (w *WebtestLocationAvailabilityCriteria) UnmarshalJSON(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 "componentId": + err = unpopulate(val, "ComponentID", &w.ComponentID) + delete(rawMsg, key) + case "failedLocationCount": + err = unpopulate(val, "FailedLocationCount", &w.FailedLocationCount) + delete(rawMsg, key) + case "odata.type": + err = unpopulate(val, "ODataType", &w.ODataType) + delete(rawMsg, key) + case "webTestId": + err = unpopulate(val, "WebTestID", &w.WebTestID) + delete(rawMsg, key) + default: + if w.AdditionalProperties == nil { + w.AdditionalProperties = map[string]interface{}{} + } + if val != nil { + var aux interface{} + err = json.Unmarshal(val, &aux) + w.AdditionalProperties[key] = aux + } + 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 WindowsEventLogDataSource. +func (w WindowsEventLogDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", w.Name) + populate(objectMap, "streams", w.Streams) + populate(objectMap, "xPathQueries", w.XPathQueries) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WindowsEventLogDataSource. +func (w *WindowsEventLogDataSource) UnmarshalJSON(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 "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "streams": + err = unpopulate(val, "Streams", &w.Streams) + delete(rawMsg, key) + case "xPathQueries": + err = unpopulate(val, "XPathQueries", &w.XPathQueries) + 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 WorkspaceInfo. +func (w WorkspaceInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", w.ID) + populate(objectMap, "location", w.Location) + populate(objectMap, "properties", w.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkspaceInfo. +func (w *WorkspaceInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &w.Location) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkspaceInfoProperties. +func (w WorkspaceInfoProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "customerId", w.CustomerID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkspaceInfoProperties. +func (w *WorkspaceInfoProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "customerId": + err = unpopulate(val, "CustomerID", &w.CustomerID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v interface{}) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_operations_client.go b/sdk/resourcemanager/monitor/armmonitor/operations_client.go similarity index 99% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_operations_client.go rename to sdk/resourcemanager/monitor/armmonitor/operations_client.go index 3cb1182f7231..ab08746b4885 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_operations_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/operations_client.go @@ -5,6 +5,7 @@ // 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 diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/monitor/armmonitor/polymorphic_helpers.go similarity index 86% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_polymorphic_helpers.go rename to sdk/resourcemanager/monitor/armmonitor/polymorphic_helpers.go index d03b7438ae08..6cb4a5b17403 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/monitor/armmonitor/polymorphic_helpers.go @@ -5,31 +5,12 @@ // 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 "encoding/json" -func unmarshalActionClassification(rawMsg json.RawMessage) (ActionClassification, error) { - if rawMsg == nil { - return nil, nil - } - var m map[string]interface{} - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b ActionClassification - switch m["odata.type"] { - case "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction": - b = &AlertingAction{} - case "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction": - b = &LogToMetricAction{} - default: - b = &Action{} - } - return b, json.Unmarshal(rawMsg, b) -} - func unmarshalMetricAlertCriteriaClassification(rawMsg json.RawMessage) (MetricAlertCriteriaClassification, error) { if rawMsg == nil { return nil, nil diff --git a/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client.go b/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client.go new file mode 100644 index 000000000000..de3f1985cb87 --- /dev/null +++ b/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client.go @@ -0,0 +1,123 @@ +//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" +) + +// PredictiveMetricClient contains the methods for the PredictiveMetric group. +// Don't use this type directly, use NewPredictiveMetricClient() instead. +type PredictiveMetricClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewPredictiveMetricClient creates a new instance of PredictiveMetricClient with the specified values. +// subscriptionID - The ID of the target subscription. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewPredictiveMetricClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PredictiveMetricClient, error) { + 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 := &PredictiveMetricClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - get predictive autoscale metric future data +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-10-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// autoscaleSettingName - The autoscale setting name. +// timespan - The timespan of the query. It is a string with the following format 'startDateTimeISO/endDateTimeISO'. +// interval - The interval (i.e. timegrain) of the query. +// metricNamespace - Metric namespace to query metric definitions for. +// metricName - The names of the metrics (comma separated) to retrieve. Special case: If a metricname itself has a comma in +// it then use %2 to indicate it. Eg: 'Metric,Name1' should be 'Metric%2Name1' +// aggregation - The list of aggregation types (comma separated) to retrieve. +// options - PredictiveMetricClientGetOptions contains the optional parameters for the PredictiveMetricClient.Get method. +func (client *PredictiveMetricClient) Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string, timespan string, interval string, metricNamespace string, metricName string, aggregation string, options *PredictiveMetricClientGetOptions) (PredictiveMetricClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, autoscaleSettingName, timespan, interval, metricNamespace, metricName, aggregation, options) + if err != nil { + return PredictiveMetricClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PredictiveMetricClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PredictiveMetricClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PredictiveMetricClient) getCreateRequest(ctx context.Context, resourceGroupName string, autoscaleSettingName string, timespan string, interval string, metricNamespace string, metricName string, aggregation string, options *PredictiveMetricClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}/predictiveMetrics" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if autoscaleSettingName == "" { + return nil, errors.New("parameter autoscaleSettingName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{autoscaleSettingName}", url.PathEscape(autoscaleSettingName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("timespan", timespan) + reqQP.Set("interval", interval) + reqQP.Set("metricNamespace", metricNamespace) + reqQP.Set("metricName", metricName) + reqQP.Set("aggregation", aggregation) + reqQP.Set("api-version", "2022-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PredictiveMetricClient) getHandleResponse(resp *http.Response) (PredictiveMetricClientGetResponse, error) { + result := PredictiveMetricClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PredictiveResponse); err != nil { + return PredictiveMetricClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client.go similarity index 99% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_privateendpointconnections_client.go rename to sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client.go index e438a12eb47c..77e141a1ef8e 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client.go @@ -5,6 +5,7 @@ // 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 diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client.go similarity index 99% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_privatelinkresources_client.go rename to sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client.go index 03e951a55e26..9611e2929803 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client.go @@ -5,6 +5,7 @@ // 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 diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_privatelinkscopedresources_client.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client.go similarity index 99% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_privatelinkscopedresources_client.go rename to sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client.go index 7deae0e3be9a..a177ebec1579 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_privatelinkscopedresources_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client.go @@ -5,6 +5,7 @@ // 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 diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_privatelinkscopeoperationstatus_client.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client.go similarity index 99% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_privatelinkscopeoperationstatus_client.go rename to sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client.go index 0ba2007db129..393acdfca6cb 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_privatelinkscopeoperationstatus_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client.go @@ -5,6 +5,7 @@ // 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 diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_privatelinkscopes_client.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client.go similarity index 99% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_privatelinkscopes_client.go rename to sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client.go index 5488f82b2403..6a3ff241eb3d 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_privatelinkscopes_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client.go @@ -5,6 +5,7 @@ // 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 diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_response_types.go b/sdk/resourcemanager/monitor/armmonitor/response_types.go similarity index 97% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_response_types.go rename to sdk/resourcemanager/monitor/armmonitor/response_types.go index 25e55ca86bf7..e253dc740da9 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_response_types.go +++ b/sdk/resourcemanager/monitor/armmonitor/response_types.go @@ -5,17 +5,18 @@ // 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 // ActionGroupsClientCreateNotificationsAtActionGroupResourceLevelResponse contains the response from method ActionGroupsClient.CreateNotificationsAtActionGroupResourceLevel. type ActionGroupsClientCreateNotificationsAtActionGroupResourceLevelResponse struct { - // placeholder for future response values + TestNotificationDetailsResponse } // ActionGroupsClientCreateNotificationsAtResourceGroupLevelResponse contains the response from method ActionGroupsClient.CreateNotificationsAtResourceGroupLevel. type ActionGroupsClientCreateNotificationsAtResourceGroupLevelResponse struct { - // placeholder for future response values + TestNotificationDetailsResponse } // ActionGroupsClientCreateOrUpdateResponse contains the response from method ActionGroupsClient.CreateOrUpdate. @@ -65,7 +66,7 @@ type ActionGroupsClientListBySubscriptionIDResponse struct { // ActionGroupsClientPostTestNotificationsResponse contains the response from method ActionGroupsClient.PostTestNotifications. type ActionGroupsClientPostTestNotificationsResponse struct { - // placeholder for future response values + TestNotificationDetailsResponse } // ActionGroupsClientUpdateResponse contains the response from method ActionGroupsClient.Update. @@ -393,6 +394,11 @@ type OperationsClientListResponse struct { OperationListResult } +// PredictiveMetricClientGetResponse contains the response from method PredictiveMetricClient.Get. +type PredictiveMetricClientGetResponse struct { + PredictiveResponse +} + // PrivateEndpointConnectionsClientCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsClient.CreateOrUpdate. type PrivateEndpointConnectionsClientCreateOrUpdateResponse struct { PrivateEndpointConnection @@ -480,7 +486,7 @@ type PrivateLinkScopesClientUpdateTagsResponse struct { // ScheduledQueryRulesClientCreateOrUpdateResponse contains the response from method ScheduledQueryRulesClient.CreateOrUpdate. type ScheduledQueryRulesClientCreateOrUpdateResponse struct { - LogSearchRuleResource + ScheduledQueryRuleResource } // ScheduledQueryRulesClientDeleteResponse contains the response from method ScheduledQueryRulesClient.Delete. @@ -490,22 +496,22 @@ type ScheduledQueryRulesClientDeleteResponse struct { // ScheduledQueryRulesClientGetResponse contains the response from method ScheduledQueryRulesClient.Get. type ScheduledQueryRulesClientGetResponse struct { - LogSearchRuleResource + ScheduledQueryRuleResource } // ScheduledQueryRulesClientListByResourceGroupResponse contains the response from method ScheduledQueryRulesClient.ListByResourceGroup. type ScheduledQueryRulesClientListByResourceGroupResponse struct { - LogSearchRuleResourceCollection + ScheduledQueryRuleResourceCollection } // ScheduledQueryRulesClientListBySubscriptionResponse contains the response from method ScheduledQueryRulesClient.ListBySubscription. type ScheduledQueryRulesClientListBySubscriptionResponse struct { - LogSearchRuleResourceCollection + ScheduledQueryRuleResourceCollection } // ScheduledQueryRulesClientUpdateResponse contains the response from method ScheduledQueryRulesClient.Update. type ScheduledQueryRulesClientUpdateResponse struct { - LogSearchRuleResource + ScheduledQueryRuleResource } // TenantActivityLogsClientListResponse contains the response from method TenantActivityLogsClient.List. diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_scheduledqueryrules_client.go b/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client.go similarity index 85% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_scheduledqueryrules_client.go rename to sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client.go index 9deac65a3f07..ac312b4a415b 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_scheduledqueryrules_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client.go @@ -5,6 +5,7 @@ // 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 @@ -54,15 +55,15 @@ func NewScheduledQueryRulesClient(subscriptionID string, credential azcore.Token return client, nil } -// CreateOrUpdate - Creates or updates an log search rule. +// CreateOrUpdate - Creates or updates a scheduled query rule. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2018-04-16 +// 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. -func (client *ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResource, options *ScheduledQueryRulesClientCreateOrUpdateOptions) (ScheduledQueryRulesClientCreateOrUpdateResponse, error) { +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 { return ScheduledQueryRulesClientCreateOrUpdateResponse{}, err @@ -78,8 +79,8 @@ func (client *ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, res } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ScheduledQueryRulesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResource, options *ScheduledQueryRulesClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}" +func (client *ScheduledQueryRulesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, parameters ScheduledQueryRuleResource, options *ScheduledQueryRulesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -97,7 +98,7 @@ func (client *ScheduledQueryRulesClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-04-16") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -106,15 +107,15 @@ func (client *ScheduledQueryRulesClient) createOrUpdateCreateRequest(ctx context // createOrUpdateHandleResponse handles the CreateOrUpdate response. func (client *ScheduledQueryRulesClient) createOrUpdateHandleResponse(resp *http.Response) (ScheduledQueryRulesClientCreateOrUpdateResponse, error) { result := ScheduledQueryRulesClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.LogSearchRuleResource); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ScheduledQueryRuleResource); err != nil { return ScheduledQueryRulesClientCreateOrUpdateResponse{}, err } return result, nil } -// Delete - Deletes a Log Search rule +// Delete - Deletes a scheduled query rule. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2018-04-16 +// 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 @@ -136,7 +137,11 @@ func (client *ScheduledQueryRulesClient) Delete(ctx context.Context, resourceGro // deleteCreateRequest creates the Delete request. func (client *ScheduledQueryRulesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, options *ScheduledQueryRulesClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}" + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -145,24 +150,20 @@ func (client *ScheduledQueryRulesClient) deleteCreateRequest(ctx context.Context return nil, errors.New("parameter ruleName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-04-16") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// Get - Gets an Log Search rule +// Get - Retrieve an scheduled query rule definition. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2018-04-16 +// 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. @@ -183,7 +184,11 @@ func (client *ScheduledQueryRulesClient) Get(ctx context.Context, resourceGroupN // getCreateRequest creates the Get request. func (client *ScheduledQueryRulesClient) getCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, options *ScheduledQueryRulesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}" + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -192,16 +197,12 @@ func (client *ScheduledQueryRulesClient) getCreateRequest(ctx context.Context, r return nil, errors.New("parameter ruleName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-04-16") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -210,25 +211,31 @@ func (client *ScheduledQueryRulesClient) getCreateRequest(ctx context.Context, r // getHandleResponse handles the Get response. func (client *ScheduledQueryRulesClient) getHandleResponse(resp *http.Response) (ScheduledQueryRulesClientGetResponse, error) { result := ScheduledQueryRulesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.LogSearchRuleResource); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ScheduledQueryRuleResource); err != nil { return ScheduledQueryRulesClientGetResponse{}, err } return result, nil } -// NewListByResourceGroupPager - List the Log Search rules within a resource group. +// NewListByResourceGroupPager - Retrieve scheduled query rule definitions in a resource group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2018-04-16 +// 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. func (client *ScheduledQueryRulesClient) NewListByResourceGroupPager(resourceGroupName string, options *ScheduledQueryRulesClientListByResourceGroupOptions) *runtime.Pager[ScheduledQueryRulesClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[ScheduledQueryRulesClientListByResourceGroupResponse]{ More: func(page ScheduledQueryRulesClientListByResourceGroupResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ScheduledQueryRulesClientListByResourceGroupResponse) (ScheduledQueryRulesClientListByResourceGroupResponse, error) { - req, err := client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + 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 ScheduledQueryRulesClientListByResourceGroupResponse{}, err } @@ -246,24 +253,21 @@ func (client *ScheduledQueryRulesClient) NewListByResourceGroupPager(resourceGro // listByResourceGroupCreateRequest creates the ListByResourceGroup request. func (client *ScheduledQueryRulesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ScheduledQueryRulesClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules" 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", "2018-04-16") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -272,24 +276,30 @@ func (client *ScheduledQueryRulesClient) listByResourceGroupCreateRequest(ctx co // listByResourceGroupHandleResponse handles the ListByResourceGroup response. func (client *ScheduledQueryRulesClient) listByResourceGroupHandleResponse(resp *http.Response) (ScheduledQueryRulesClientListByResourceGroupResponse, error) { result := ScheduledQueryRulesClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.LogSearchRuleResourceCollection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ScheduledQueryRuleResourceCollection); err != nil { return ScheduledQueryRulesClientListByResourceGroupResponse{}, err } return result, nil } -// NewListBySubscriptionPager - List the Log Search rules within a subscription group. +// NewListBySubscriptionPager - Retrieve a scheduled query rule definitions in a subscription. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2018-04-16 +// Generated from API version 2022-06-15 // options - ScheduledQueryRulesClientListBySubscriptionOptions contains the optional parameters for the ScheduledQueryRulesClient.ListBySubscription // method. func (client *ScheduledQueryRulesClient) NewListBySubscriptionPager(options *ScheduledQueryRulesClientListBySubscriptionOptions) *runtime.Pager[ScheduledQueryRulesClientListBySubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[ScheduledQueryRulesClientListBySubscriptionResponse]{ More: func(page ScheduledQueryRulesClientListBySubscriptionResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ScheduledQueryRulesClientListBySubscriptionResponse) (ScheduledQueryRulesClientListBySubscriptionResponse, error) { - req, err := client.listBySubscriptionCreateRequest(ctx, options) + 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 ScheduledQueryRulesClientListBySubscriptionResponse{}, err } @@ -317,10 +327,7 @@ func (client *ScheduledQueryRulesClient) listBySubscriptionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-04-16") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -329,21 +336,21 @@ func (client *ScheduledQueryRulesClient) listBySubscriptionCreateRequest(ctx con // listBySubscriptionHandleResponse handles the ListBySubscription response. func (client *ScheduledQueryRulesClient) listBySubscriptionHandleResponse(resp *http.Response) (ScheduledQueryRulesClientListBySubscriptionResponse, error) { result := ScheduledQueryRulesClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.LogSearchRuleResourceCollection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ScheduledQueryRuleResourceCollection); err != nil { return ScheduledQueryRulesClientListBySubscriptionResponse{}, err } return result, nil } -// Update - Update log search Rule. +// Update - Update a scheduled query rule. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2018-04-16 +// 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. -func (client *ScheduledQueryRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResourcePatch, options *ScheduledQueryRulesClientUpdateOptions) (ScheduledQueryRulesClientUpdateResponse, error) { +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 { return ScheduledQueryRulesClientUpdateResponse{}, err @@ -359,8 +366,8 @@ func (client *ScheduledQueryRulesClient) Update(ctx context.Context, resourceGro } // updateCreateRequest creates the Update request. -func (client *ScheduledQueryRulesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResourcePatch, options *ScheduledQueryRulesClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}" +func (client *ScheduledQueryRulesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, parameters ScheduledQueryRuleResourcePatch, options *ScheduledQueryRulesClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -378,7 +385,7 @@ func (client *ScheduledQueryRulesClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-04-16") + reqQP.Set("api-version", "2022-06-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -387,7 +394,7 @@ func (client *ScheduledQueryRulesClient) updateCreateRequest(ctx context.Context // updateHandleResponse handles the Update response. func (client *ScheduledQueryRulesClient) updateHandleResponse(resp *http.Response) (ScheduledQueryRulesClientUpdateResponse, error) { result := ScheduledQueryRulesClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.LogSearchRuleResource); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ScheduledQueryRuleResource); err != nil { return ScheduledQueryRulesClientUpdateResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_tenantactivitylogs_client.go b/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client.go similarity index 99% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_tenantactivitylogs_client.go rename to sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client.go index 93da1d89bc36..bee1776c303e 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_tenantactivitylogs_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client.go @@ -5,6 +5,7 @@ // 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 diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_time_rfc3339.go b/sdk/resourcemanager/monitor/armmonitor/time_rfc3339.go similarity index 99% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/monitor/armmonitor/time_rfc3339.go index f96c0a2239f0..53fd0dd6f026 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/monitor/armmonitor/time_rfc3339.go @@ -5,6 +5,7 @@ // 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 diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_vminsights_client.go b/sdk/resourcemanager/monitor/armmonitor/vminsights_client.go similarity index 99% rename from sdk/resourcemanager/monitor/armmonitor/zz_generated_vminsights_client.go rename to sdk/resourcemanager/monitor/armmonitor/vminsights_client.go index f9694cadc5dd..75672a84ae81 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_vminsights_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/vminsights_client.go @@ -5,6 +5,7 @@ // 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 diff --git a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_actiongroups_client_test.go b/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_actiongroups_client_test.go deleted file mode 100644 index 21e642f679de..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_actiongroups_client_test.go +++ /dev/null @@ -1,708 +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) - } - _, 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/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) - } - _, 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/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) - } - _, 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/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_NewListByResourceGroupPager() { - 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.NewListByResourceGroupPager("Default-NotificationRules", - 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/ze_generated_example_activitylogalerts_client_test.go b/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_activitylogalerts_client_test.go deleted file mode 100644 index 5b0aec57a6b4..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_activitylogalerts_client_test.go +++ /dev/null @@ -1,168 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -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() { - 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_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_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/ze_generated_example_activitylogs_client_test.go b/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_activitylogs_client_test.go deleted file mode 100644 index 7a49004b09e3..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_activitylogs_client_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/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() { - 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 - } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_alertruleincidents_client_test.go b/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_alertruleincidents_client_test.go deleted file mode 100644 index 9a93760cfbb2..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_alertruleincidents_client_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/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/ze_generated_example_alertrules_client_test.go b/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_alertrules_client_test.go deleted file mode 100644 index 739f5d1c720f..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_alertrules_client_test.go +++ /dev/null @@ -1,198 +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/ze_generated_example_autoscalesettings_client_test.go b/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_autoscalesettings_client_test.go deleted file mode 100644 index 9d04313fcc93..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_autoscalesettings_client_test.go +++ /dev/null @@ -1,428 +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/2015-04-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/2015-04-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{}, - 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"), - }}, - }}, - 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/2015-04-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/2015-04-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/2015-04-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"), - }}, - }}, - 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{ - "$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/2015-04-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/ze_generated_example_baselines_client_test.go b/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_baselines_client_test.go deleted file mode 100644 index 2354a153f3d2..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_baselines_client_test.go +++ /dev/null @@ -1,51 +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/ze_generated_example_datacollectionendpoints_client_test.go b/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_datacollectionendpoints_client_test.go deleted file mode 100644 index 37e92d973985..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_datacollectionendpoints_client_test.go +++ /dev/null @@ -1,168 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -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/ze_generated_example_datacollectionruleassociations_client_test.go b/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_datacollectionruleassociations_client_test.go deleted file mode 100644 index bb6e24a1c344..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_datacollectionruleassociations_client_test.go +++ /dev/null @@ -1,164 +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/ze_generated_example_datacollectionrules_client_test.go b/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_datacollectionrules_client_test.go deleted file mode 100644 index 81e8d67d40e4..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_datacollectionrules_client_test.go +++ /dev/null @@ -1,242 +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/ze_generated_example_diagnosticsettings_client_test.go b/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_diagnosticsettings_client_test.go deleted file mode 100644 index ea4a0ac50e62..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_diagnosticsettings_client_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" - "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-05-01-preview/examples/getDiagnosticSetting.json -func ExampleDiagnosticSettingsClient_Get() { - 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/2017-05-01-preview/examples/createOrUpdateDiagnosticSetting.json -func ExampleDiagnosticSettingsClient_CreateOrUpdate() { - 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/eventhubs/myeventhub/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), - }, - }}, - 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/2017-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/2017-05-01-preview/examples/listDiagnosticSettings.json -func ExampleDiagnosticSettingsClient_List() { - 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.List(ctx, - "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_diagnosticsettingscategory_client_test.go b/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_diagnosticsettingscategory_client_test.go deleted file mode 100644 index 6afcbb29ef6d..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_diagnosticsettingscategory_client_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/2017-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/2017-05-01-preview/examples/listDiagnosticSettingsCategories.json -func ExampleDiagnosticSettingsCategoryClient_List() { - 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.List(ctx, - "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_eventcategories_client_test.go b/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_eventcategories_client_test.go deleted file mode 100644 index e9a3c95b2d7a..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_eventcategories_client_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/ze_generated_example_logprofiles_client_test.go b/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_logprofiles_client_test.go deleted file mode 100644 index be8cdfc154e7..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_logprofiles_client_test.go +++ /dev/null @@ -1,161 +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/ze_generated_example_metricalerts_client_test.go b/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_metricalerts_client_test.go deleted file mode 100644 index 07bdb375816d..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_metricalerts_client_test.go +++ /dev/null @@ -1,230 +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-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/listMetricAlert.json -func ExampleMetricAlertsClient_NewListByResourceGroupPager() { - 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.NewListByResourceGroupPager("gigtest", - 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() { - 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/createOrUpdateDynamicMetricAlertMultipleResource.json -func ExampleMetricAlertsClient_CreateOrUpdate() { - 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/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/ze_generated_example_metricalertsstatus_client_test.go b/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_metricalertsstatus_client_test.go deleted file mode 100644 index caab4661db68..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_metricalertsstatus_client_test.go +++ /dev/null @@ -1,62 +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/ze_generated_example_metricdefinitions_client_test.go b/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_metricdefinitions_client_test.go deleted file mode 100644 index 7aae778ba788..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_metricdefinitions_client_test.go +++ /dev/null @@ -1,43 +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() { - 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 - } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_metricnamespaces_client_test.go b/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_metricnamespaces_client_test.go deleted file mode 100644 index 924903c01e24..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_metricnamespaces_client_test.go +++ /dev/null @@ -1,43 +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/ze_generated_example_metrics_client_test.go b/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_metrics_client_test.go deleted file mode 100644 index 0ffc59e47d14..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_metrics_client_test.go +++ /dev/null @@ -1,48 +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() { - 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 -} diff --git a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_operations_client_test.go deleted file mode 100644 index ccd1aa3bbe57..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_operations_client_test.go +++ /dev/null @@ -1,37 +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/ze_generated_example_privateendpointconnections_client_test.go b/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_privateendpointconnections_client_test.go deleted file mode 100644 index 0455b31ae6a3..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_privateendpointconnections_client_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" - "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/2019-10-17-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/2019-10-17-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.PrivateLinkServiceConnectionStateProperty{ - Description: to.Ptr("Approved by johndoe@contoso.com"), - Status: to.Ptr("Approved"), - }, - }, - }, - 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/2019-10-17-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/2019-10-17-preview/examples/PrivateEndpointConnectionList.json -func ExamplePrivateEndpointConnectionsClient_NewListByPrivateLinkScopePager() { - 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) - } - 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/ze_generated_example_privatelinkresources_client_test.go b/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_privatelinkresources_client_test.go deleted file mode 100644 index 1d70e8344978..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_privatelinkresources_client_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/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/2019-10-17-preview/examples/PrivateLinkScopePrivateLinkResourceListGet.json -func ExamplePrivateLinkResourcesClient_NewListByPrivateLinkScopePager() { - 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) - } - 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 - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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/ze_generated_example_privatelinkscopedresources_client_test.go b/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_privatelinkscopedresources_client_test.go deleted file mode 100644 index 6c1cb79d4640..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_privatelinkscopedresources_client_test.go +++ /dev/null @@ -1,124 +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/2019-10-17-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/2019-10-17-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/2019-10-17-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/2019-10-17-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/ze_generated_example_privatelinkscopeoperationstatus_client_test.go b/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_privatelinkscopeoperationstatus_client_test.go deleted file mode 100644 index 208f4898a1ea..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_privatelinkscopeoperationstatus_client_test.go +++ /dev/null @@ -1,39 +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/2019-10-17-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/ze_generated_example_privatelinkscopes_client_test.go b/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_privatelinkscopes_client_test.go deleted file mode 100644 index b11d8315d258..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_privatelinkscopes_client_test.go +++ /dev/null @@ -1,167 +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/2019-10-17-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/2019-10-17-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/2019-10-17-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/2019-10-17-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/2019-10-17-preview/examples/PrivateLinkScopesCreate.json -func ExamplePrivateLinkScopesClient_CreateOrUpdate() { - 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{}, - }, - 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/2019-10-17-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/ze_generated_example_scheduledqueryrules_client_test.go b/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_scheduledqueryrules_client_test.go deleted file mode 100644 index 3c7b73f495b3..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_scheduledqueryrules_client_test.go +++ /dev/null @@ -1,194 +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-04-16/examples/createOrUpdateScheduledQueryRules.json -func ExampleScheduledQueryRulesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmonitor.NewScheduledQueryRulesClient("b67f7fec-69fc-4974-9099-a26bd6ffeda3", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "Rac46PostSwapRG", - "logalertfoo", - armmonitor.LogSearchRuleResource{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{}, - Properties: &armmonitor.LogSearchRule{ - Description: to.Ptr("log alert description"), - Action: &armmonitor.AlertingAction{ - ODataType: to.Ptr("Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction"), - AznsAction: &armmonitor.AzNsActionGroup{ - ActionGroup: []*string{}, - CustomWebhookPayload: to.Ptr("{}"), - EmailSubject: to.Ptr("Email Header"), - }, - Severity: to.Ptr(armmonitor.AlertSeverityOne), - Trigger: &armmonitor.TriggerCondition{ - MetricTrigger: &armmonitor.LogMetricTrigger{ - MetricColumn: to.Ptr("Computer"), - MetricTriggerType: to.Ptr(armmonitor.MetricTriggerTypeConsecutive), - Threshold: to.Ptr[float64](5), - ThresholdOperator: to.Ptr(armmonitor.ConditionalOperatorGreaterThan), - }, - Threshold: to.Ptr[float64](3), - ThresholdOperator: to.Ptr(armmonitor.ConditionalOperatorGreaterThan), - }, - }, - Enabled: to.Ptr(armmonitor.EnabledTrue), - Schedule: &armmonitor.Schedule{ - FrequencyInMinutes: to.Ptr[int32](15), - TimeWindowInMinutes: to.Ptr[int32](15), - }, - Source: &armmonitor.Source{ - DataSourceID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.OperationalInsights/workspaces/sampleWorkspace"), - Query: to.Ptr("Heartbeat | summarize AggregatedValue = count() by bin(TimeGenerated, 5m)"), - QueryType: to.Ptr(armmonitor.QueryTypeResultCount), - }, - }, - }, - 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-04-16/examples/getScheduledQueryRules.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("b67f7fec-69fc-4974-9099-a26bd6ffeda3", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "Rac46PostSwapRG", - "logalertfoo", - 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-04-16/examples/patchScheduledQueryRules.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("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "my-resource-group", - "logalertfoo", - armmonitor.LogSearchRuleResourcePatch{ - Properties: &armmonitor.LogSearchRulePatch{ - Enabled: to.Ptr(armmonitor.EnabledTrue), - }, - }, - 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-04-16/examples/deleteScheduledQueryRules.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("b67f7fec-69fc-4974-9099-a26bd6ffeda3", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "Rac46PostSwapRG", - "logalertfoo", - 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/2018-04-16/examples/listScheduledQueryRules.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("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(&armmonitor.ScheduledQueryRulesClientListBySubscriptionOptions{Filter: 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-04-16/examples/listScheduledQueryRules.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("14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("gigtest", - &armmonitor.ScheduledQueryRulesClientListByResourceGroupOptions{Filter: 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/ze_generated_example_tenantactivitylogs_client_test.go b/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_tenantactivitylogs_client_test.go deleted file mode 100644 index 63da293fad3e..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_tenantactivitylogs_client_test.go +++ /dev/null @@ -1,44 +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() { - 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 - } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_vminsights_client_test.go b/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_vminsights_client_test.go deleted file mode 100644 index 6f66d671c492..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/ze_generated_example_vminsights_client_test.go +++ /dev/null @@ -1,38 +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() { - 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 -} diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_models_serde.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_models_serde.go deleted file mode 100644 index c728613aef33..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_models_serde.go +++ /dev/null @@ -1,2265 +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 - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type ActionGroup. -func (a ActionGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "armRoleReceivers", a.ArmRoleReceivers) - populate(objectMap, "automationRunbookReceivers", a.AutomationRunbookReceivers) - populate(objectMap, "azureAppPushReceivers", a.AzureAppPushReceivers) - populate(objectMap, "azureFunctionReceivers", a.AzureFunctionReceivers) - populate(objectMap, "emailReceivers", a.EmailReceivers) - populate(objectMap, "enabled", a.Enabled) - populate(objectMap, "eventHubReceivers", a.EventHubReceivers) - populate(objectMap, "groupShortName", a.GroupShortName) - populate(objectMap, "itsmReceivers", a.ItsmReceivers) - populate(objectMap, "logicAppReceivers", a.LogicAppReceivers) - populate(objectMap, "smsReceivers", a.SmsReceivers) - populate(objectMap, "voiceReceivers", a.VoiceReceivers) - populate(objectMap, "webhookReceivers", a.WebhookReceivers) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ActionGroupAutoGenerated. -func (a ActionGroupAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "actionGroupId", a.ActionGroupID) - populate(objectMap, "webhookProperties", a.WebhookProperties) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ActionGroupPatchBody. -func (a ActionGroupPatchBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ActionGroupResource. -func (a ActionGroupResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", a.ID) - populate(objectMap, "identity", a.Identity) - populate(objectMap, "kind", a.Kind) - populate(objectMap, "location", a.Location) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ActionList. -func (a ActionList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "actionGroups", a.ActionGroups) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ActivityLogAlertResource. -func (a ActivityLogAlertResource) 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, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AlertRule. -func (a AlertRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "action", a.Action) - populate(objectMap, "actions", a.Actions) - populate(objectMap, "condition", a.Condition) - populate(objectMap, "description", a.Description) - populate(objectMap, "isEnabled", a.IsEnabled) - populateTimeRFC3339(objectMap, "lastUpdatedTime", a.LastUpdatedTime) - populate(objectMap, "name", a.Name) - populate(objectMap, "provisioningState", a.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRule. -func (a *AlertRule) UnmarshalJSON(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 "action": - a.Action, err = unmarshalRuleActionClassification(val) - delete(rawMsg, key) - case "actions": - a.Actions, err = unmarshalRuleActionClassificationArray(val) - delete(rawMsg, key) - case "condition": - a.Condition, err = unmarshalRuleConditionClassification(val) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &a.Description) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &a.IsEnabled) - delete(rawMsg, key) - case "lastUpdatedTime": - err = unpopulateTimeRFC3339(val, "LastUpdatedTime", &a.LastUpdatedTime) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AlertRuleAllOfCondition. -func (a AlertRuleAllOfCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allOf", a.AllOf) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AlertRuleAnyOfOrLeafCondition. -func (a AlertRuleAnyOfOrLeafCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "anyOf", a.AnyOf) - populate(objectMap, "containsAny", a.ContainsAny) - populate(objectMap, "equals", a.Equals) - populate(objectMap, "field", a.Field) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AlertRuleLeafCondition. -func (a AlertRuleLeafCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "containsAny", a.ContainsAny) - populate(objectMap, "equals", a.Equals) - populate(objectMap, "field", a.Field) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AlertRulePatchObject. -func (a AlertRulePatchObject) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AlertRuleProperties. -func (a AlertRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "actions", a.Actions) - populate(objectMap, "condition", a.Condition) - populate(objectMap, "description", a.Description) - populate(objectMap, "enabled", a.Enabled) - populate(objectMap, "scopes", a.Scopes) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AlertRuleResource. -func (a AlertRuleResource) 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, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AlertRuleResourcePatch. -func (a AlertRuleResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AlertingAction. -func (a AlertingAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "aznsAction", a.AznsAction) - objectMap["odata.type"] = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction" - populate(objectMap, "severity", a.Severity) - populate(objectMap, "throttlingInMin", a.ThrottlingInMin) - populate(objectMap, "trigger", a.Trigger) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertingAction. -func (a *AlertingAction) UnmarshalJSON(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 "aznsAction": - err = unpopulate(val, "AznsAction", &a.AznsAction) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &a.ODataType) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &a.Severity) - delete(rawMsg, key) - case "throttlingInMin": - err = unpopulate(val, "ThrottlingInMin", &a.ThrottlingInMin) - delete(rawMsg, key) - case "trigger": - err = unpopulate(val, "Trigger", &a.Trigger) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AutoscaleNotification. -func (a AutoscaleNotification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "email", a.Email) - populate(objectMap, "operation", a.Operation) - populate(objectMap, "webhooks", a.Webhooks) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AutoscaleProfile. -func (a AutoscaleProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "capacity", a.Capacity) - populate(objectMap, "fixedDate", a.FixedDate) - populate(objectMap, "name", a.Name) - populate(objectMap, "recurrence", a.Recurrence) - populate(objectMap, "rules", a.Rules) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AutoscaleSetting. -func (a AutoscaleSetting) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "enabled", a.Enabled) - populate(objectMap, "name", a.Name) - populate(objectMap, "notifications", a.Notifications) - populate(objectMap, "profiles", a.Profiles) - populate(objectMap, "targetResourceLocation", a.TargetResourceLocation) - populate(objectMap, "targetResourceUri", a.TargetResourceURI) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AutoscaleSettingResource. -func (a AutoscaleSettingResource) 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, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AutoscaleSettingResourcePatch. -func (a AutoscaleSettingResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AzNsActionGroup. -func (a AzNsActionGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "actionGroup", a.ActionGroup) - populate(objectMap, "customWebhookPayload", a.CustomWebhookPayload) - populate(objectMap, "emailSubject", a.EmailSubject) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AzureMonitorPrivateLinkScope. -func (a AzureMonitorPrivateLinkScope) 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, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AzureMonitorPrivateLinkScopeProperties. -func (a AzureMonitorPrivateLinkScopeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "privateEndpointConnections", a.PrivateEndpointConnections) - populate(objectMap, "provisioningState", a.ProvisioningState) - return json.Marshal(objectMap) -} - -// 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, "identity", a.Identity) - populate(objectMap, "kind", a.Kind) - populate(objectMap, "location", a.Location) - populate(objectMap, "name", a.Name) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// 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) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Criteria. -func (c Criteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "dimensions", c.Dimensions) - populate(objectMap, "metricName", c.MetricName) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointResource. -func (d DataCollectionEndpointResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", d.Etag) - populate(objectMap, "id", d.ID) - populate(objectMap, "kind", d.Kind) - populate(objectMap, "location", d.Location) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "systemData", d.SystemData) - populate(objectMap, "tags", d.Tags) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointResourceSystemData. -func (d DataCollectionEndpointResourceSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "createdAt", d.CreatedAt) - populate(objectMap, "createdBy", d.CreatedBy) - populate(objectMap, "createdByType", d.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", d.LastModifiedAt) - populate(objectMap, "lastModifiedBy", d.LastModifiedBy) - populate(objectMap, "lastModifiedByType", d.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointResourceSystemData. -func (d *DataCollectionEndpointResourceSystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &d.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &d.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &d.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &d.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &d.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &d.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRule. -func (d DataCollectionRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "dataCollectionEndpointId", d.DataCollectionEndpointID) - populate(objectMap, "dataFlows", d.DataFlows) - populate(objectMap, "dataSources", d.DataSources) - populate(objectMap, "description", d.Description) - populate(objectMap, "destinations", d.Destinations) - populate(objectMap, "immutableId", d.ImmutableID) - populate(objectMap, "metadata", d.Metadata) - populate(objectMap, "provisioningState", d.ProvisioningState) - populate(objectMap, "streamDeclarations", d.StreamDeclarations) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociationProxyOnlyResourceSystemData. -func (d DataCollectionRuleAssociationProxyOnlyResourceSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "createdAt", d.CreatedAt) - populate(objectMap, "createdBy", d.CreatedBy) - populate(objectMap, "createdByType", d.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", d.LastModifiedAt) - populate(objectMap, "lastModifiedBy", d.LastModifiedBy) - populate(objectMap, "lastModifiedByType", d.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleAssociationProxyOnlyResourceSystemData. -func (d *DataCollectionRuleAssociationProxyOnlyResourceSystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &d.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &d.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &d.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &d.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &d.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &d.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleDataSources. -func (d DataCollectionRuleDataSources) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "extensions", d.Extensions) - populate(objectMap, "iisLogs", d.IisLogs) - populate(objectMap, "logFiles", d.LogFiles) - populate(objectMap, "performanceCounters", d.PerformanceCounters) - populate(objectMap, "syslog", d.Syslog) - populate(objectMap, "windowsEventLogs", d.WindowsEventLogs) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleDestinations. -func (d DataCollectionRuleDestinations) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "azureMonitorMetrics", d.AzureMonitorMetrics) - populate(objectMap, "logAnalytics", d.LogAnalytics) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleResource. -func (d DataCollectionRuleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", d.Etag) - populate(objectMap, "id", d.ID) - populate(objectMap, "kind", d.Kind) - populate(objectMap, "location", d.Location) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "systemData", d.SystemData) - populate(objectMap, "tags", d.Tags) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleResourceProperties. -func (d DataCollectionRuleResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "dataCollectionEndpointId", d.DataCollectionEndpointID) - populate(objectMap, "dataFlows", d.DataFlows) - populate(objectMap, "dataSources", d.DataSources) - populate(objectMap, "description", d.Description) - populate(objectMap, "destinations", d.Destinations) - populate(objectMap, "immutableId", d.ImmutableID) - populate(objectMap, "metadata", d.Metadata) - populate(objectMap, "provisioningState", d.ProvisioningState) - populate(objectMap, "streamDeclarations", d.StreamDeclarations) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleResourceSystemData. -func (d DataCollectionRuleResourceSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "createdAt", d.CreatedAt) - populate(objectMap, "createdBy", d.CreatedBy) - populate(objectMap, "createdByType", d.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", d.LastModifiedAt) - populate(objectMap, "lastModifiedBy", d.LastModifiedBy) - populate(objectMap, "lastModifiedByType", d.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleResourceSystemData. -func (d *DataCollectionRuleResourceSystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &d.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &d.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &d.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &d.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &d.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &d.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataFlow. -func (d DataFlow) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "destinations", d.Destinations) - populate(objectMap, "outputStream", d.OutputStream) - populate(objectMap, "streams", d.Streams) - populate(objectMap, "transformKql", d.TransformKql) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type DataSourcesSpec. -func (d DataSourcesSpec) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "extensions", d.Extensions) - populate(objectMap, "iisLogs", d.IisLogs) - populate(objectMap, "logFiles", d.LogFiles) - populate(objectMap, "performanceCounters", d.PerformanceCounters) - populate(objectMap, "syslog", d.Syslog) - populate(objectMap, "windowsEventLogs", d.WindowsEventLogs) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type DestinationsSpec. -func (d DestinationsSpec) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "azureMonitorMetrics", d.AzureMonitorMetrics) - populate(objectMap, "logAnalytics", d.LogAnalytics) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type DiagnosticSettings. -func (d DiagnosticSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "eventHubAuthorizationRuleId", d.EventHubAuthorizationRuleID) - populate(objectMap, "eventHubName", d.EventHubName) - populate(objectMap, "logAnalyticsDestinationType", d.LogAnalyticsDestinationType) - populate(objectMap, "logs", d.Logs) - populate(objectMap, "metrics", d.Metrics) - populate(objectMap, "serviceBusRuleId", d.ServiceBusRuleID) - populate(objectMap, "storageAccountId", d.StorageAccountID) - populate(objectMap, "workspaceId", d.WorkspaceID) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Dimension. -func (d Dimension) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "name", d.Name) - populate(objectMap, "operator", d.Operator) - populate(objectMap, "values", d.Values) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type DynamicMetricCriteria. -func (d DynamicMetricCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "alertSensitivity", d.AlertSensitivity) - objectMap["criterionType"] = CriterionTypeDynamicThresholdCriterion - populate(objectMap, "dimensions", d.Dimensions) - populate(objectMap, "failingPeriods", d.FailingPeriods) - populateTimeRFC3339(objectMap, "ignoreDataBefore", d.IgnoreDataBefore) - populate(objectMap, "metricName", d.MetricName) - populate(objectMap, "metricNamespace", d.MetricNamespace) - populate(objectMap, "name", d.Name) - populate(objectMap, "operator", d.Operator) - populate(objectMap, "skipMetricValidation", d.SkipMetricValidation) - populate(objectMap, "timeAggregation", d.TimeAggregation) - if d.AdditionalProperties != nil { - for key, val := range d.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DynamicMetricCriteria. -func (d *DynamicMetricCriteria) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "alertSensitivity": - err = unpopulate(val, "AlertSensitivity", &d.AlertSensitivity) - delete(rawMsg, key) - case "criterionType": - err = unpopulate(val, "CriterionType", &d.CriterionType) - delete(rawMsg, key) - case "dimensions": - err = unpopulate(val, "Dimensions", &d.Dimensions) - delete(rawMsg, key) - case "failingPeriods": - err = unpopulate(val, "FailingPeriods", &d.FailingPeriods) - delete(rawMsg, key) - case "ignoreDataBefore": - err = unpopulateTimeRFC3339(val, "IgnoreDataBefore", &d.IgnoreDataBefore) - delete(rawMsg, key) - case "metricName": - err = unpopulate(val, "MetricName", &d.MetricName) - delete(rawMsg, key) - case "metricNamespace": - err = unpopulate(val, "MetricNamespace", &d.MetricNamespace) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "operator": - err = unpopulate(val, "Operator", &d.Operator) - delete(rawMsg, key) - case "skipMetricValidation": - err = unpopulate(val, "SkipMetricValidation", &d.SkipMetricValidation) - delete(rawMsg, key) - case "timeAggregation": - err = unpopulate(val, "TimeAggregation", &d.TimeAggregation) - delete(rawMsg, key) - default: - if d.AdditionalProperties == nil { - d.AdditionalProperties = map[string]interface{}{} - } - if val != nil { - var aux interface{} - err = json.Unmarshal(val, &aux) - d.AdditionalProperties[key] = aux - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EmailNotification. -func (e EmailNotification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "customEmails", e.CustomEmails) - populate(objectMap, "sendToSubscriptionAdministrator", e.SendToSubscriptionAdministrator) - populate(objectMap, "sendToSubscriptionCoAdministrators", e.SendToSubscriptionCoAdministrators) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventData. -func (e *EventData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "authorization": - err = unpopulate(val, "Authorization", &e.Authorization) - delete(rawMsg, key) - case "caller": - err = unpopulate(val, "Caller", &e.Caller) - delete(rawMsg, key) - case "category": - err = unpopulate(val, "Category", &e.Category) - delete(rawMsg, key) - case "claims": - err = unpopulate(val, "Claims", &e.Claims) - delete(rawMsg, key) - case "correlationId": - err = unpopulate(val, "CorrelationID", &e.CorrelationID) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &e.Description) - delete(rawMsg, key) - case "eventDataId": - err = unpopulate(val, "EventDataID", &e.EventDataID) - delete(rawMsg, key) - case "eventName": - err = unpopulate(val, "EventName", &e.EventName) - delete(rawMsg, key) - case "eventTimestamp": - err = unpopulateTimeRFC3339(val, "EventTimestamp", &e.EventTimestamp) - delete(rawMsg, key) - case "httpRequest": - err = unpopulate(val, "HTTPRequest", &e.HTTPRequest) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &e.ID) - delete(rawMsg, key) - case "level": - err = unpopulate(val, "Level", &e.Level) - delete(rawMsg, key) - case "operationId": - err = unpopulate(val, "OperationID", &e.OperationID) - delete(rawMsg, key) - case "operationName": - err = unpopulate(val, "OperationName", &e.OperationName) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &e.Properties) - delete(rawMsg, key) - case "resourceGroupName": - err = unpopulate(val, "ResourceGroupName", &e.ResourceGroupName) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &e.ResourceID) - delete(rawMsg, key) - case "resourceProviderName": - err = unpopulate(val, "ResourceProviderName", &e.ResourceProviderName) - delete(rawMsg, key) - case "resourceType": - err = unpopulate(val, "ResourceType", &e.ResourceType) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &e.Status) - delete(rawMsg, key) - case "subStatus": - err = unpopulate(val, "SubStatus", &e.SubStatus) - delete(rawMsg, key) - case "submissionTimestamp": - err = unpopulateTimeRFC3339(val, "SubmissionTimestamp", &e.SubmissionTimestamp) - delete(rawMsg, key) - case "subscriptionId": - err = unpopulate(val, "SubscriptionID", &e.SubscriptionID) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &e.TenantID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ExtensionDataSource. -func (e ExtensionDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "extensionName", e.ExtensionName) - populate(objectMap, "extensionSettings", &e.ExtensionSettings) - populate(objectMap, "inputDataSources", e.InputDataSources) - populate(objectMap, "name", e.Name) - populate(objectMap, "streams", e.Streams) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type IisLogsDataSource. -func (i IisLogsDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "logDirectories", i.LogDirectories) - populate(objectMap, "name", i.Name) - populate(objectMap, "streams", i.Streams) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Incident. -func (i *Incident) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "activatedTime": - err = unpopulateTimeRFC3339(val, "ActivatedTime", &i.ActivatedTime) - delete(rawMsg, key) - case "isActive": - err = unpopulate(val, "IsActive", &i.IsActive) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &i.Name) - delete(rawMsg, key) - case "resolvedTime": - err = unpopulateTimeRFC3339(val, "ResolvedTime", &i.ResolvedTime) - delete(rawMsg, key) - case "ruleName": - err = unpopulate(val, "RuleName", &i.RuleName) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LocationThresholdRuleCondition. -func (l LocationThresholdRuleCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "dataSource", l.DataSource) - populate(objectMap, "failedLocationCount", l.FailedLocationCount) - objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition" - populate(objectMap, "windowSize", l.WindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LocationThresholdRuleCondition. -func (l *LocationThresholdRuleCondition) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataSource": - l.DataSource, err = unmarshalRuleDataSourceClassification(val) - delete(rawMsg, key) - case "failedLocationCount": - err = unpopulate(val, "FailedLocationCount", &l.FailedLocationCount) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &l.ODataType) - delete(rawMsg, key) - case "windowSize": - err = unpopulate(val, "WindowSize", &l.WindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LogFilesDataSource. -func (l LogFilesDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "filePatterns", l.FilePatterns) - populate(objectMap, "format", l.Format) - populate(objectMap, "name", l.Name) - populate(objectMap, "settings", l.Settings) - populate(objectMap, "streams", l.Streams) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type LogProfileProperties. -func (l LogProfileProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "categories", l.Categories) - populate(objectMap, "locations", l.Locations) - populate(objectMap, "retentionPolicy", l.RetentionPolicy) - populate(objectMap, "serviceBusRuleId", l.ServiceBusRuleID) - populate(objectMap, "storageAccountId", l.StorageAccountID) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type LogProfileResource. -func (l LogProfileResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", l.ID) - populate(objectMap, "location", l.Location) - populate(objectMap, "name", l.Name) - populate(objectMap, "properties", l.Properties) - populate(objectMap, "tags", l.Tags) - populate(objectMap, "type", l.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type LogProfileResourcePatch. -func (l LogProfileResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", l.Properties) - populate(objectMap, "tags", l.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type LogSearchRule. -func (l LogSearchRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "action", l.Action) - populate(objectMap, "autoMitigate", l.AutoMitigate) - populate(objectMap, "createdWithApiVersion", l.CreatedWithAPIVersion) - populate(objectMap, "description", l.Description) - populate(objectMap, "displayName", l.DisplayName) - populate(objectMap, "enabled", l.Enabled) - populate(objectMap, "isLegacyLogAnalyticsRule", l.IsLegacyLogAnalyticsRule) - populateTimeRFC3339(objectMap, "lastUpdatedTime", l.LastUpdatedTime) - populate(objectMap, "provisioningState", l.ProvisioningState) - populate(objectMap, "schedule", l.Schedule) - populate(objectMap, "source", l.Source) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogSearchRule. -func (l *LogSearchRule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "action": - l.Action, err = unmarshalActionClassification(val) - delete(rawMsg, key) - case "autoMitigate": - err = unpopulate(val, "AutoMitigate", &l.AutoMitigate) - delete(rawMsg, key) - case "createdWithApiVersion": - err = unpopulate(val, "CreatedWithAPIVersion", &l.CreatedWithAPIVersion) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &l.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &l.DisplayName) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &l.Enabled) - delete(rawMsg, key) - case "isLegacyLogAnalyticsRule": - err = unpopulate(val, "IsLegacyLogAnalyticsRule", &l.IsLegacyLogAnalyticsRule) - delete(rawMsg, key) - case "lastUpdatedTime": - err = unpopulateTimeRFC3339(val, "LastUpdatedTime", &l.LastUpdatedTime) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &l.ProvisioningState) - delete(rawMsg, key) - case "schedule": - err = unpopulate(val, "Schedule", &l.Schedule) - delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &l.Source) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LogSearchRuleResource. -func (l LogSearchRuleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", l.Etag) - populate(objectMap, "id", l.ID) - populate(objectMap, "kind", l.Kind) - populate(objectMap, "location", l.Location) - populate(objectMap, "name", l.Name) - populate(objectMap, "properties", l.Properties) - populate(objectMap, "tags", l.Tags) - populate(objectMap, "type", l.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type LogSearchRuleResourcePatch. -func (l LogSearchRuleResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", l.Properties) - populate(objectMap, "tags", l.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type LogToMetricAction. -func (l LogToMetricAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "criteria", l.Criteria) - objectMap["odata.type"] = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogToMetricAction. -func (l *LogToMetricAction) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "criteria": - err = unpopulate(val, "Criteria", &l.Criteria) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &l.ODataType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ManagementEventRuleCondition. -func (m ManagementEventRuleCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "aggregation", m.Aggregation) - populate(objectMap, "dataSource", m.DataSource) - objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementEventRuleCondition. -func (m *ManagementEventRuleCondition) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "aggregation": - err = unpopulate(val, "Aggregation", &m.Aggregation) - delete(rawMsg, key) - case "dataSource": - m.DataSource, err = unmarshalRuleDataSourceClassification(val) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &m.ODataType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertAction. -func (m MetricAlertAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "actionGroupId", m.ActionGroupID) - populate(objectMap, "webHookProperties", m.WebHookProperties) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertCriteria. -func (m MetricAlertCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["odata.type"] = m.ODataType - if m.AdditionalProperties != nil { - for key, val := range m.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertCriteria. -func (m *MetricAlertCriteria) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "odata.type": - err = unpopulate(val, "ODataType", &m.ODataType) - delete(rawMsg, key) - default: - if m.AdditionalProperties == nil { - m.AdditionalProperties = map[string]interface{}{} - } - if val != nil { - var aux interface{} - err = json.Unmarshal(val, &aux) - m.AdditionalProperties[key] = aux - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertMultipleResourceMultipleMetricCriteria. -func (m MetricAlertMultipleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allOf", m.AllOf) - objectMap["odata.type"] = OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria - if m.AdditionalProperties != nil { - for key, val := range m.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertMultipleResourceMultipleMetricCriteria. -func (m *MetricAlertMultipleResourceMultipleMetricCriteria) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "allOf": - m.AllOf, err = unmarshalMultiMetricCriteriaClassificationArray(val) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &m.ODataType) - delete(rawMsg, key) - default: - if m.AdditionalProperties == nil { - m.AdditionalProperties = map[string]interface{}{} - } - if val != nil { - var aux interface{} - err = json.Unmarshal(val, &aux) - m.AdditionalProperties[key] = aux - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertProperties. -func (m MetricAlertProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "actions", m.Actions) - populate(objectMap, "autoMitigate", m.AutoMitigate) - populate(objectMap, "criteria", m.Criteria) - populate(objectMap, "description", m.Description) - populate(objectMap, "enabled", m.Enabled) - populate(objectMap, "evaluationFrequency", m.EvaluationFrequency) - populate(objectMap, "isMigrated", m.IsMigrated) - populateTimeRFC3339(objectMap, "lastUpdatedTime", m.LastUpdatedTime) - populate(objectMap, "scopes", m.Scopes) - populate(objectMap, "severity", m.Severity) - populate(objectMap, "targetResourceRegion", m.TargetResourceRegion) - populate(objectMap, "targetResourceType", m.TargetResourceType) - populate(objectMap, "windowSize", m.WindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertProperties. -func (m *MetricAlertProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actions": - err = unpopulate(val, "Actions", &m.Actions) - delete(rawMsg, key) - case "autoMitigate": - err = unpopulate(val, "AutoMitigate", &m.AutoMitigate) - delete(rawMsg, key) - case "criteria": - m.Criteria, err = unmarshalMetricAlertCriteriaClassification(val) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &m.Description) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &m.Enabled) - delete(rawMsg, key) - case "evaluationFrequency": - err = unpopulate(val, "EvaluationFrequency", &m.EvaluationFrequency) - delete(rawMsg, key) - case "isMigrated": - err = unpopulate(val, "IsMigrated", &m.IsMigrated) - delete(rawMsg, key) - case "lastUpdatedTime": - err = unpopulateTimeRFC3339(val, "LastUpdatedTime", &m.LastUpdatedTime) - delete(rawMsg, key) - case "scopes": - err = unpopulate(val, "Scopes", &m.Scopes) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &m.Severity) - delete(rawMsg, key) - case "targetResourceRegion": - err = unpopulate(val, "TargetResourceRegion", &m.TargetResourceRegion) - delete(rawMsg, key) - case "targetResourceType": - err = unpopulate(val, "TargetResourceType", &m.TargetResourceType) - delete(rawMsg, key) - case "windowSize": - err = unpopulate(val, "WindowSize", &m.WindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertPropertiesPatch. -func (m MetricAlertPropertiesPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "actions", m.Actions) - populate(objectMap, "autoMitigate", m.AutoMitigate) - populate(objectMap, "criteria", m.Criteria) - populate(objectMap, "description", m.Description) - populate(objectMap, "enabled", m.Enabled) - populate(objectMap, "evaluationFrequency", m.EvaluationFrequency) - populate(objectMap, "isMigrated", m.IsMigrated) - populateTimeRFC3339(objectMap, "lastUpdatedTime", m.LastUpdatedTime) - populate(objectMap, "scopes", m.Scopes) - populate(objectMap, "severity", m.Severity) - populate(objectMap, "targetResourceRegion", m.TargetResourceRegion) - populate(objectMap, "targetResourceType", m.TargetResourceType) - populate(objectMap, "windowSize", m.WindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertPropertiesPatch. -func (m *MetricAlertPropertiesPatch) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actions": - err = unpopulate(val, "Actions", &m.Actions) - delete(rawMsg, key) - case "autoMitigate": - err = unpopulate(val, "AutoMitigate", &m.AutoMitigate) - delete(rawMsg, key) - case "criteria": - m.Criteria, err = unmarshalMetricAlertCriteriaClassification(val) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &m.Description) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &m.Enabled) - delete(rawMsg, key) - case "evaluationFrequency": - err = unpopulate(val, "EvaluationFrequency", &m.EvaluationFrequency) - delete(rawMsg, key) - case "isMigrated": - err = unpopulate(val, "IsMigrated", &m.IsMigrated) - delete(rawMsg, key) - case "lastUpdatedTime": - err = unpopulateTimeRFC3339(val, "LastUpdatedTime", &m.LastUpdatedTime) - delete(rawMsg, key) - case "scopes": - err = unpopulate(val, "Scopes", &m.Scopes) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &m.Severity) - delete(rawMsg, key) - case "targetResourceRegion": - err = unpopulate(val, "TargetResourceRegion", &m.TargetResourceRegion) - delete(rawMsg, key) - case "targetResourceType": - err = unpopulate(val, "TargetResourceType", &m.TargetResourceType) - delete(rawMsg, key) - case "windowSize": - err = unpopulate(val, "WindowSize", &m.WindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertResource. -func (m MetricAlertResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", m.ID) - populate(objectMap, "location", m.Location) - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "tags", m.Tags) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertResourcePatch. -func (m MetricAlertResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "tags", m.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertSingleResourceMultipleMetricCriteria. -func (m MetricAlertSingleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allOf", m.AllOf) - objectMap["odata.type"] = OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria - if m.AdditionalProperties != nil { - for key, val := range m.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertSingleResourceMultipleMetricCriteria. -func (m *MetricAlertSingleResourceMultipleMetricCriteria) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "allOf": - err = unpopulate(val, "AllOf", &m.AllOf) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &m.ODataType) - delete(rawMsg, key) - default: - if m.AdditionalProperties == nil { - m.AdditionalProperties = map[string]interface{}{} - } - if val != nil { - var aux interface{} - err = json.Unmarshal(val, &aux) - m.AdditionalProperties[key] = aux - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertStatusProperties. -func (m *MetricAlertStatusProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dimensions": - err = unpopulate(val, "Dimensions", &m.Dimensions) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &m.Status) - delete(rawMsg, key) - case "timestamp": - err = unpopulateTimeRFC3339(val, "Timestamp", &m.Timestamp) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricCriteria. -func (m MetricCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["criterionType"] = CriterionTypeStaticThresholdCriterion - populate(objectMap, "dimensions", m.Dimensions) - populate(objectMap, "metricName", m.MetricName) - populate(objectMap, "metricNamespace", m.MetricNamespace) - populate(objectMap, "name", m.Name) - populate(objectMap, "operator", m.Operator) - populate(objectMap, "skipMetricValidation", m.SkipMetricValidation) - populate(objectMap, "threshold", m.Threshold) - populate(objectMap, "timeAggregation", m.TimeAggregation) - if m.AdditionalProperties != nil { - for key, val := range m.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricCriteria. -func (m *MetricCriteria) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "criterionType": - err = unpopulate(val, "CriterionType", &m.CriterionType) - delete(rawMsg, key) - case "dimensions": - err = unpopulate(val, "Dimensions", &m.Dimensions) - delete(rawMsg, key) - case "metricName": - err = unpopulate(val, "MetricName", &m.MetricName) - delete(rawMsg, key) - case "metricNamespace": - err = unpopulate(val, "MetricNamespace", &m.MetricNamespace) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "operator": - err = unpopulate(val, "Operator", &m.Operator) - delete(rawMsg, key) - case "skipMetricValidation": - err = unpopulate(val, "SkipMetricValidation", &m.SkipMetricValidation) - delete(rawMsg, key) - case "threshold": - err = unpopulate(val, "Threshold", &m.Threshold) - delete(rawMsg, key) - case "timeAggregation": - err = unpopulate(val, "TimeAggregation", &m.TimeAggregation) - delete(rawMsg, key) - default: - if m.AdditionalProperties == nil { - m.AdditionalProperties = map[string]interface{}{} - } - if val != nil { - var aux interface{} - err = json.Unmarshal(val, &aux) - m.AdditionalProperties[key] = aux - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricDimension. -func (m MetricDimension) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "name", m.Name) - populate(objectMap, "operator", m.Operator) - populate(objectMap, "values", m.Values) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type MetricTrigger. -func (m MetricTrigger) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "dimensions", m.Dimensions) - populate(objectMap, "dividePerInstance", m.DividePerInstance) - populate(objectMap, "metricName", m.MetricName) - populate(objectMap, "metricNamespace", m.MetricNamespace) - populate(objectMap, "metricResourceLocation", m.MetricResourceLocation) - populate(objectMap, "metricResourceUri", m.MetricResourceURI) - populate(objectMap, "operator", m.Operator) - populate(objectMap, "statistic", m.Statistic) - populate(objectMap, "threshold", m.Threshold) - populate(objectMap, "timeAggregation", m.TimeAggregation) - populate(objectMap, "timeGrain", m.TimeGrain) - populate(objectMap, "timeWindow", m.TimeWindow) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricValue. -func (m *MetricValue) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "average": - err = unpopulate(val, "Average", &m.Average) - delete(rawMsg, key) - case "count": - err = unpopulate(val, "Count", &m.Count) - delete(rawMsg, key) - case "maximum": - err = unpopulate(val, "Maximum", &m.Maximum) - delete(rawMsg, key) - case "minimum": - err = unpopulate(val, "Minimum", &m.Minimum) - delete(rawMsg, key) - case "timeStamp": - err = unpopulateTimeRFC3339(val, "TimeStamp", &m.TimeStamp) - delete(rawMsg, key) - case "total": - err = unpopulate(val, "Total", &m.Total) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MultiMetricCriteria. -func (m MultiMetricCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["criterionType"] = m.CriterionType - populate(objectMap, "dimensions", m.Dimensions) - populate(objectMap, "metricName", m.MetricName) - populate(objectMap, "metricNamespace", m.MetricNamespace) - populate(objectMap, "name", m.Name) - populate(objectMap, "skipMetricValidation", m.SkipMetricValidation) - populate(objectMap, "timeAggregation", m.TimeAggregation) - if m.AdditionalProperties != nil { - for key, val := range m.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MultiMetricCriteria. -func (m *MultiMetricCriteria) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "criterionType": - err = unpopulate(val, "CriterionType", &m.CriterionType) - delete(rawMsg, key) - case "dimensions": - err = unpopulate(val, "Dimensions", &m.Dimensions) - delete(rawMsg, key) - case "metricName": - err = unpopulate(val, "MetricName", &m.MetricName) - delete(rawMsg, key) - case "metricNamespace": - err = unpopulate(val, "MetricNamespace", &m.MetricNamespace) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "skipMetricValidation": - err = unpopulate(val, "SkipMetricValidation", &m.SkipMetricValidation) - delete(rawMsg, key) - case "timeAggregation": - err = unpopulate(val, "TimeAggregation", &m.TimeAggregation) - delete(rawMsg, key) - default: - if m.AdditionalProperties == nil { - m.AdditionalProperties = map[string]interface{}{} - } - if val != nil { - var aux interface{} - err = json.Unmarshal(val, &aux) - m.AdditionalProperties[key] = aux - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NotificationRequestBody. -func (n NotificationRequestBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "alertType", n.AlertType) - populate(objectMap, "armRoleReceivers", n.ArmRoleReceivers) - populate(objectMap, "automationRunbookReceivers", n.AutomationRunbookReceivers) - populate(objectMap, "azureAppPushReceivers", n.AzureAppPushReceivers) - populate(objectMap, "azureFunctionReceivers", n.AzureFunctionReceivers) - populate(objectMap, "emailReceivers", n.EmailReceivers) - populate(objectMap, "eventHubReceivers", n.EventHubReceivers) - populate(objectMap, "itsmReceivers", n.ItsmReceivers) - populate(objectMap, "logicAppReceivers", n.LogicAppReceivers) - populate(objectMap, "smsReceivers", n.SmsReceivers) - populate(objectMap, "voiceReceivers", n.VoiceReceivers) - populate(objectMap, "webhookReceivers", n.WebhookReceivers) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatus. -func (o *OperationStatus) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endTime": - err = unpopulateTimeRFC3339(val, "EndTime", &o.EndTime) - delete(rawMsg, key) - case "error": - err = unpopulate(val, "Error", &o.Error) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &o.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &o.StartTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &o.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PerfCounterDataSource. -func (p PerfCounterDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "counterSpecifiers", p.CounterSpecifiers) - populate(objectMap, "name", p.Name) - populate(objectMap, "samplingFrequencyInSeconds", p.SamplingFrequencyInSeconds) - populate(objectMap, "streams", p.Streams) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. -func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "groupId", p.GroupID) - populate(objectMap, "requiredMembers", p.RequiredMembers) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkScopesResource. -func (p PrivateLinkScopesResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", p.ID) - populate(objectMap, "location", p.Location) - populate(objectMap, "name", p.Name) - populate(objectMap, "tags", p.Tags) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type RecurrentSchedule. -func (r RecurrentSchedule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "days", r.Days) - populate(objectMap, "hours", r.Hours) - populate(objectMap, "minutes", r.Minutes) - populate(objectMap, "timeZone", r.TimeZone) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - 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) -} - -// MarshalJSON implements the json.Marshaller interface for type ResourceForUpdate. -func (r ResourceForUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "tags", r.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type RuleCondition. -func (r RuleCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "dataSource", r.DataSource) - objectMap["odata.type"] = r.ODataType - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleCondition. -func (r *RuleCondition) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataSource": - r.DataSource, err = unmarshalRuleDataSourceClassification(val) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &r.ODataType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RuleEmailAction. -func (r RuleEmailAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "customEmails", r.CustomEmails) - objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.RuleEmailAction" - populate(objectMap, "sendToServiceOwners", r.SendToServiceOwners) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleEmailAction. -func (r *RuleEmailAction) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "customEmails": - err = unpopulate(val, "CustomEmails", &r.CustomEmails) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &r.ODataType) - delete(rawMsg, key) - case "sendToServiceOwners": - err = unpopulate(val, "SendToServiceOwners", &r.SendToServiceOwners) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RuleManagementEventDataSource. -func (r RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "claims", r.Claims) - populate(objectMap, "eventName", r.EventName) - populate(objectMap, "eventSource", r.EventSource) - populate(objectMap, "legacyResourceId", r.LegacyResourceID) - populate(objectMap, "level", r.Level) - populate(objectMap, "metricNamespace", r.MetricNamespace) - objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource" - populate(objectMap, "operationName", r.OperationName) - populate(objectMap, "resourceGroupName", r.ResourceGroupName) - populate(objectMap, "resourceLocation", r.ResourceLocation) - populate(objectMap, "resourceProviderName", r.ResourceProviderName) - populate(objectMap, "resourceUri", r.ResourceURI) - populate(objectMap, "status", r.Status) - populate(objectMap, "subStatus", r.SubStatus) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleManagementEventDataSource. -func (r *RuleManagementEventDataSource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "claims": - err = unpopulate(val, "Claims", &r.Claims) - delete(rawMsg, key) - case "eventName": - err = unpopulate(val, "EventName", &r.EventName) - delete(rawMsg, key) - case "eventSource": - err = unpopulate(val, "EventSource", &r.EventSource) - delete(rawMsg, key) - case "legacyResourceId": - err = unpopulate(val, "LegacyResourceID", &r.LegacyResourceID) - delete(rawMsg, key) - case "level": - err = unpopulate(val, "Level", &r.Level) - delete(rawMsg, key) - case "metricNamespace": - err = unpopulate(val, "MetricNamespace", &r.MetricNamespace) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &r.ODataType) - delete(rawMsg, key) - case "operationName": - err = unpopulate(val, "OperationName", &r.OperationName) - delete(rawMsg, key) - case "resourceGroupName": - err = unpopulate(val, "ResourceGroupName", &r.ResourceGroupName) - delete(rawMsg, key) - case "resourceLocation": - err = unpopulate(val, "ResourceLocation", &r.ResourceLocation) - delete(rawMsg, key) - case "resourceProviderName": - err = unpopulate(val, "ResourceProviderName", &r.ResourceProviderName) - delete(rawMsg, key) - case "resourceUri": - err = unpopulate(val, "ResourceURI", &r.ResourceURI) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - case "subStatus": - err = unpopulate(val, "SubStatus", &r.SubStatus) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RuleMetricDataSource. -func (r RuleMetricDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "legacyResourceId", r.LegacyResourceID) - populate(objectMap, "metricName", r.MetricName) - populate(objectMap, "metricNamespace", r.MetricNamespace) - objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource" - populate(objectMap, "resourceLocation", r.ResourceLocation) - populate(objectMap, "resourceUri", r.ResourceURI) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleMetricDataSource. -func (r *RuleMetricDataSource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "legacyResourceId": - err = unpopulate(val, "LegacyResourceID", &r.LegacyResourceID) - delete(rawMsg, key) - case "metricName": - err = unpopulate(val, "MetricName", &r.MetricName) - delete(rawMsg, key) - case "metricNamespace": - err = unpopulate(val, "MetricNamespace", &r.MetricNamespace) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &r.ODataType) - delete(rawMsg, key) - case "resourceLocation": - err = unpopulate(val, "ResourceLocation", &r.ResourceLocation) - delete(rawMsg, key) - case "resourceUri": - err = unpopulate(val, "ResourceURI", &r.ResourceURI) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RuleWebhookAction. -func (r RuleWebhookAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction" - populate(objectMap, "properties", r.Properties) - populate(objectMap, "serviceUri", r.ServiceURI) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleWebhookAction. -func (r *RuleWebhookAction) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "odata.type": - err = unpopulate(val, "ODataType", &r.ODataType) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "serviceUri": - err = unpopulate(val, "ServiceURI", &r.ServiceURI) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScaleRuleMetricDimension. -func (s ScaleRuleMetricDimension) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "DimensionName", s.DimensionName) - populate(objectMap, "Operator", s.Operator) - populate(objectMap, "Values", s.Values) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Source. -func (s Source) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "authorizedResources", s.AuthorizedResources) - populate(objectMap, "dataSourceId", s.DataSourceID) - populate(objectMap, "query", s.Query) - populate(objectMap, "queryType", s.QueryType) - return json.Marshal(objectMap) -} - -// 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) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SyslogDataSource. -func (s SyslogDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "facilityNames", s.FacilityNames) - populate(objectMap, "logLevels", s.LogLevels) - populate(objectMap, "name", s.Name) - populate(objectMap, "streams", s.Streams) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TagsResource. -func (t TagsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "tags", t.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ThresholdRuleCondition. -func (t ThresholdRuleCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "dataSource", t.DataSource) - objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition" - populate(objectMap, "operator", t.Operator) - populate(objectMap, "threshold", t.Threshold) - populate(objectMap, "timeAggregation", t.TimeAggregation) - populate(objectMap, "windowSize", t.WindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ThresholdRuleCondition. -func (t *ThresholdRuleCondition) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataSource": - t.DataSource, err = unmarshalRuleDataSourceClassification(val) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &t.ODataType) - delete(rawMsg, key) - case "operator": - err = unpopulate(val, "Operator", &t.Operator) - delete(rawMsg, key) - case "threshold": - err = unpopulate(val, "Threshold", &t.Threshold) - delete(rawMsg, key) - case "timeAggregation": - err = unpopulate(val, "TimeAggregation", &t.TimeAggregation) - delete(rawMsg, key) - case "windowSize": - err = unpopulate(val, "WindowSize", &t.WindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TimeWindow. -func (t TimeWindow) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "end", t.End) - populateTimeRFC3339(objectMap, "start", t.Start) - populate(objectMap, "timeZone", t.TimeZone) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TimeWindow. -func (t *TimeWindow) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "end": - err = unpopulateTimeRFC3339(val, "End", &t.End) - delete(rawMsg, key) - case "start": - err = unpopulateTimeRFC3339(val, "Start", &t.Start) - delete(rawMsg, key) - case "timeZone": - err = unpopulate(val, "TimeZone", &t.TimeZone) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TrackedEntityResource. -func (t TrackedEntityResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", t.Etag) - populate(objectMap, "id", t.ID) - populate(objectMap, "kind", t.Kind) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type VMInsightsOnboardingStatusProperties. -func (v VMInsightsOnboardingStatusProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "data", v.Data) - populate(objectMap, "dataStatus", v.DataStatus) - populate(objectMap, "onboardingStatus", v.OnboardingStatus) - populate(objectMap, "resourceId", v.ResourceID) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type WebhookNotification. -func (w WebhookNotification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", w.Properties) - populate(objectMap, "serviceUri", w.ServiceURI) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type WebtestLocationAvailabilityCriteria. -func (w WebtestLocationAvailabilityCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "componentId", w.ComponentID) - populate(objectMap, "failedLocationCount", w.FailedLocationCount) - objectMap["odata.type"] = OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria - populate(objectMap, "webTestId", w.WebTestID) - if w.AdditionalProperties != nil { - for key, val := range w.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WebtestLocationAvailabilityCriteria. -func (w *WebtestLocationAvailabilityCriteria) UnmarshalJSON(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 "componentId": - err = unpopulate(val, "ComponentID", &w.ComponentID) - delete(rawMsg, key) - case "failedLocationCount": - err = unpopulate(val, "FailedLocationCount", &w.FailedLocationCount) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &w.ODataType) - delete(rawMsg, key) - case "webTestId": - err = unpopulate(val, "WebTestID", &w.WebTestID) - delete(rawMsg, key) - default: - if w.AdditionalProperties == nil { - w.AdditionalProperties = map[string]interface{}{} - } - if val != nil { - var aux interface{} - err = json.Unmarshal(val, &aux) - w.AdditionalProperties[key] = aux - } - 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 WindowsEventLogDataSource. -func (w WindowsEventLogDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "name", w.Name) - populate(objectMap, "streams", w.Streams) - populate(objectMap, "xPathQueries", w.XPathQueries) - return json.Marshal(objectMap) -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, fn string, v interface{}) error { - if data == nil { - return nil - } - if err := json.Unmarshal(data, v); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - return nil -}