From 548dca9aac8ab872f8bed8214e0ee139d8d299d4 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 27 Sep 2018 16:26:09 -0700 Subject: [PATCH] Generated from a2ed141f095adf20aeb11d3bd796d5906fce4f6b (#2806) Update sqr documentation to include LogToMetricAction --- .../preview/monitor/mgmt/insights/models.go | 8 +- .../mgmt/2018-03-01/insights/models.go | 86 +++++++++++++++++-- .../insights/scheduledqueryrules.go | 6 +- .../mgmt/2018-09-01/insights/models.go | 86 +++++++++++++++++-- .../insights/scheduledqueryrules.go | 6 +- 5 files changed, 172 insertions(+), 20 deletions(-) diff --git a/profiles/preview/preview/monitor/mgmt/insights/models.go b/profiles/preview/preview/monitor/mgmt/insights/models.go index 0f1bc537a62e..2383a9fa375c 100644 --- a/profiles/preview/preview/monitor/mgmt/insights/models.go +++ b/profiles/preview/preview/monitor/mgmt/insights/models.go @@ -143,8 +143,9 @@ const ( type OdataTypeBasicAction = original.OdataTypeBasicAction const ( - OdataTypeAction OdataTypeBasicAction = original.OdataTypeAction - OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction OdataTypeBasicAction = original.OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction + OdataTypeAction OdataTypeBasicAction = original.OdataTypeAction + OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction OdataTypeBasicAction = original.OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction + OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction OdataTypeBasicAction = original.OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction ) type OdataTypeBasicMetricAlertCriteria = original.OdataTypeBasicMetricAlertCriteria @@ -311,12 +312,14 @@ type BaselineMetadataValue = original.BaselineMetadataValue type BaselineProperties = original.BaselineProperties type BaselineResponse = original.BaselineResponse type CalculateBaselineResponse = original.CalculateBaselineResponse +type Criteria = original.Criteria type DiagnosticSettings = original.DiagnosticSettings type DiagnosticSettingsCategory = original.DiagnosticSettingsCategory type DiagnosticSettingsCategoryResource = original.DiagnosticSettingsCategoryResource type DiagnosticSettingsCategoryResourceCollection = original.DiagnosticSettingsCategoryResourceCollection type DiagnosticSettingsResource = original.DiagnosticSettingsResource type DiagnosticSettingsResourceCollection = original.DiagnosticSettingsResourceCollection +type Dimension = original.Dimension type EmailNotification = original.EmailNotification type EmailReceiver = original.EmailReceiver type EnableRequest = original.EnableRequest @@ -344,6 +347,7 @@ type LogSearchRuleResource = original.LogSearchRuleResource type LogSearchRuleResourceCollection = original.LogSearchRuleResourceCollection type LogSearchRuleResourcePatch = original.LogSearchRuleResourcePatch type LogSettings = original.LogSettings +type LogToMetricAction = original.LogToMetricAction type ManagementEventAggregationCondition = original.ManagementEventAggregationCondition type ManagementEventRuleCondition = original.ManagementEventRuleCondition type MetadataValue = original.MetadataValue diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/models.go b/services/preview/monitor/mgmt/2018-03-01/insights/models.go index 5cf5d1171284..1a947a9478e5 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/models.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/models.go @@ -238,11 +238,13 @@ const ( OdataTypeAction OdataTypeBasicAction = "Action" // OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction ... OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction OdataTypeBasicAction = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction" + // OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction ... + OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction OdataTypeBasicAction = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction" ) // PossibleOdataTypeBasicActionValues returns an array of possible values for the OdataTypeBasicAction const type. func PossibleOdataTypeBasicActionValues() []OdataTypeBasicAction { - return []OdataTypeBasicAction{OdataTypeAction, OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction} + return []OdataTypeBasicAction{OdataTypeAction, OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction, OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction} } // OdataTypeBasicMetricAlertCriteria enumerates the values for odata type basic metric alert criteria. @@ -514,12 +516,13 @@ func PossibleUnitValues() []Unit { // BasicAction action descriptor. type BasicAction interface { AsAlertingAction() (*AlertingAction, bool) + AsLogToMetricAction() (*LogToMetricAction, bool) AsAction() (*Action, bool) } // Action action descriptor. type Action struct { - // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction' + // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` } @@ -535,6 +538,10 @@ func unmarshalBasicAction(body []byte) (BasicAction, error) { var aa AlertingAction err := json.Unmarshal(body, &aa) return aa, err + case string(OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction): + var ltma LogToMetricAction + err := json.Unmarshal(body, <ma) + return ltma, err default: var a Action err := json.Unmarshal(body, &a) @@ -575,6 +582,11 @@ func (a Action) AsAlertingAction() (*AlertingAction, bool) { return nil, false } +// AsLogToMetricAction is the BasicAction implementation for Action. +func (a Action) AsLogToMetricAction() (*LogToMetricAction, bool) { + return nil, false +} + // AsAction is the BasicAction implementation for Action. func (a Action) AsAction() (*Action, bool) { return &a, true @@ -1033,7 +1045,7 @@ type AlertingAction struct { ThrottlingInMin *int32 `json:"throttlingInMin,omitempty"` // Trigger - The trigger condition that results in the alert rule being. Trigger *TriggerCondition `json:"trigger,omitempty"` - // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction' + // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` } @@ -1064,6 +1076,11 @@ func (aa AlertingAction) AsAlertingAction() (*AlertingAction, bool) { return &aa, true } +// AsLogToMetricAction is the BasicAction implementation for AlertingAction. +func (aa AlertingAction) AsLogToMetricAction() (*LogToMetricAction, bool) { + return nil, false +} + // AsAction is the BasicAction implementation for AlertingAction. func (aa AlertingAction) AsAction() (*Action, bool) { return nil, false @@ -1804,6 +1821,14 @@ type CalculateBaselineResponse struct { Baseline *[]Baseline `json:"baseline,omitempty"` } +// Criteria specifies the criteria for converting log to metric. +type Criteria struct { + // MetricName - Name of the metric + MetricName *string `json:"metricName,omitempty"` + // Dimensions - List of Dimensions for creating metric + Dimensions *[]Dimension `json:"dimensions,omitempty"` +} + // DiagnosticSettings the diagnostic settings. type DiagnosticSettings struct { // StorageAccountID - The resource ID of the storage account to which you would like to send Diagnostic Logs. @@ -2006,6 +2031,16 @@ type DiagnosticSettingsResourceCollection struct { Value *[]DiagnosticSettingsResource `json:"value,omitempty"` } +// Dimension specifies the criteria for converting log to metric. +type Dimension struct { + // Name - Name of the dimension + Name *string `json:"name,omitempty"` + // Operator - Operator for dimension values + Operator *string `json:"operator,omitempty"` + // Values - List of dimension values + Values *[]string `json:"values,omitempty"` +} + // EmailNotification email notification of an autoscale event. type EmailNotification struct { // SendToSubscriptionAdministrator - a value indicating whether to send email to subscription administrator. @@ -2658,7 +2693,7 @@ type LogSearchRule struct { ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` // Source - Data Source against which rule will Query Data Source *Source `json:"source,omitempty"` - // Schedule - Schedule (Frequnecy, Time Window) for rule. + // Schedule - Schedule (Frequnecy, Time Window) for rule. Required for action type - AlertingAction Schedule *Schedule `json:"schedule,omitempty"` // Action - Action needs to be taken on rule execution. Action BasicAction `json:"action,omitempty"` @@ -2927,6 +2962,47 @@ type LogSettings struct { RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` } +// LogToMetricAction specifiy action need to be taken when rule type is converting log to metric +type LogToMetricAction struct { + // Criteria - Severity of the alert + Criteria *Criteria `json:"criteria,omitempty"` + // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' + OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for LogToMetricAction. +func (ltma LogToMetricAction) MarshalJSON() ([]byte, error) { + ltma.OdataType = OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction + objectMap := make(map[string]interface{}) + if ltma.Criteria != nil { + objectMap["criteria"] = ltma.Criteria + } + if ltma.OdataType != "" { + objectMap["odata.type"] = ltma.OdataType + } + return json.Marshal(objectMap) +} + +// AsAlertingAction is the BasicAction implementation for LogToMetricAction. +func (ltma LogToMetricAction) AsAlertingAction() (*AlertingAction, bool) { + return nil, false +} + +// AsLogToMetricAction is the BasicAction implementation for LogToMetricAction. +func (ltma LogToMetricAction) AsLogToMetricAction() (*LogToMetricAction, bool) { + return <ma, true +} + +// AsAction is the BasicAction implementation for LogToMetricAction. +func (ltma LogToMetricAction) AsAction() (*Action, bool) { + return nil, false +} + +// AsBasicAction is the BasicAction implementation for LogToMetricAction. +func (ltma LogToMetricAction) AsBasicAction() (BasicAction, bool) { + return <ma, true +} + // ManagementEventAggregationCondition how the data that is collected should be combined over time. type ManagementEventAggregationCondition struct { // Operator - the condition operator. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' @@ -4449,7 +4525,7 @@ type SmsReceiver struct { // Source specifies the log search query. type Source struct { - // Query - Log search query. + // Query - Log search query. Required for action type - AlertingAction Query *string `json:"query,omitempty"` // AuthorizedResources - List of Resource referred into query AuthorizedResources *[]string `json:"authorizedResources,omitempty"` diff --git a/services/preview/monitor/mgmt/2018-03-01/insights/scheduledqueryrules.go b/services/preview/monitor/mgmt/2018-03-01/insights/scheduledqueryrules.go index d8cc76492783..e4c7daba9b0c 100644 --- a/services/preview/monitor/mgmt/2018-03-01/insights/scheduledqueryrules.go +++ b/services/preview/monitor/mgmt/2018-03-01/insights/scheduledqueryrules.go @@ -50,10 +50,8 @@ func (client ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, reso {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.LogSearchRule", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source.Query", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogSearchRule.Source.DataSourceID", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "parameters.LogSearchRule.Schedule", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source.DataSourceID", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.LogSearchRule.Schedule", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Schedule.FrequencyInMinutes", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.LogSearchRule.Schedule.TimeWindowInMinutes", Name: validation.Null, Rule: true, Chain: nil}, }}, diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/models.go b/services/preview/monitor/mgmt/2018-09-01/insights/models.go index 7841d9863971..cfa9f36a560e 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/models.go +++ b/services/preview/monitor/mgmt/2018-09-01/insights/models.go @@ -238,11 +238,13 @@ const ( OdataTypeAction OdataTypeBasicAction = "Action" // OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction ... OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction OdataTypeBasicAction = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction" + // OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction ... + OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction OdataTypeBasicAction = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction" ) // PossibleOdataTypeBasicActionValues returns an array of possible values for the OdataTypeBasicAction const type. func PossibleOdataTypeBasicActionValues() []OdataTypeBasicAction { - return []OdataTypeBasicAction{OdataTypeAction, OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction} + return []OdataTypeBasicAction{OdataTypeAction, OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction, OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction} } // OdataTypeBasicMetricAlertCriteria enumerates the values for odata type basic metric alert criteria. @@ -514,12 +516,13 @@ func PossibleUnitValues() []Unit { // BasicAction action descriptor. type BasicAction interface { AsAlertingAction() (*AlertingAction, bool) + AsLogToMetricAction() (*LogToMetricAction, bool) AsAction() (*Action, bool) } // Action action descriptor. type Action struct { - // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction' + // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` } @@ -535,6 +538,10 @@ func unmarshalBasicAction(body []byte) (BasicAction, error) { var aa AlertingAction err := json.Unmarshal(body, &aa) return aa, err + case string(OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction): + var ltma LogToMetricAction + err := json.Unmarshal(body, <ma) + return ltma, err default: var a Action err := json.Unmarshal(body, &a) @@ -575,6 +582,11 @@ func (a Action) AsAlertingAction() (*AlertingAction, bool) { return nil, false } +// AsLogToMetricAction is the BasicAction implementation for Action. +func (a Action) AsLogToMetricAction() (*LogToMetricAction, bool) { + return nil, false +} + // AsAction is the BasicAction implementation for Action. func (a Action) AsAction() (*Action, bool) { return &a, true @@ -1033,7 +1045,7 @@ type AlertingAction struct { ThrottlingInMin *int32 `json:"throttlingInMin,omitempty"` // Trigger - The trigger condition that results in the alert rule being. Trigger *TriggerCondition `json:"trigger,omitempty"` - // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction' + // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` } @@ -1064,6 +1076,11 @@ func (aa AlertingAction) AsAlertingAction() (*AlertingAction, bool) { return &aa, true } +// AsLogToMetricAction is the BasicAction implementation for AlertingAction. +func (aa AlertingAction) AsLogToMetricAction() (*LogToMetricAction, bool) { + return nil, false +} + // AsAction is the BasicAction implementation for AlertingAction. func (aa AlertingAction) AsAction() (*Action, bool) { return nil, false @@ -1804,6 +1821,14 @@ type CalculateBaselineResponse struct { Baseline *[]Baseline `json:"baseline,omitempty"` } +// Criteria specifies the criteria for converting log to metric. +type Criteria struct { + // MetricName - Name of the metric + MetricName *string `json:"metricName,omitempty"` + // Dimensions - List of Dimensions for creating metric + Dimensions *[]Dimension `json:"dimensions,omitempty"` +} + // DiagnosticSettings the diagnostic settings. type DiagnosticSettings struct { // StorageAccountID - The resource ID of the storage account to which you would like to send Diagnostic Logs. @@ -2006,6 +2031,16 @@ type DiagnosticSettingsResourceCollection struct { Value *[]DiagnosticSettingsResource `json:"value,omitempty"` } +// Dimension specifies the criteria for converting log to metric. +type Dimension struct { + // Name - Name of the dimension + Name *string `json:"name,omitempty"` + // Operator - Operator for dimension values + Operator *string `json:"operator,omitempty"` + // Values - List of dimension values + Values *[]string `json:"values,omitempty"` +} + // EmailNotification email notification of an autoscale event. type EmailNotification struct { // SendToSubscriptionAdministrator - a value indicating whether to send email to subscription administrator. @@ -2658,7 +2693,7 @@ type LogSearchRule struct { ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` // Source - Data Source against which rule will Query Data Source *Source `json:"source,omitempty"` - // Schedule - Schedule (Frequnecy, Time Window) for rule. + // Schedule - Schedule (Frequnecy, Time Window) for rule. Required for action type - AlertingAction Schedule *Schedule `json:"schedule,omitempty"` // Action - Action needs to be taken on rule execution. Action BasicAction `json:"action,omitempty"` @@ -2927,6 +2962,47 @@ type LogSettings struct { RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` } +// LogToMetricAction specifiy action need to be taken when rule type is converting log to metric +type LogToMetricAction struct { + // Criteria - Severity of the alert + Criteria *Criteria `json:"criteria,omitempty"` + // OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' + OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for LogToMetricAction. +func (ltma LogToMetricAction) MarshalJSON() ([]byte, error) { + ltma.OdataType = OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction + objectMap := make(map[string]interface{}) + if ltma.Criteria != nil { + objectMap["criteria"] = ltma.Criteria + } + if ltma.OdataType != "" { + objectMap["odata.type"] = ltma.OdataType + } + return json.Marshal(objectMap) +} + +// AsAlertingAction is the BasicAction implementation for LogToMetricAction. +func (ltma LogToMetricAction) AsAlertingAction() (*AlertingAction, bool) { + return nil, false +} + +// AsLogToMetricAction is the BasicAction implementation for LogToMetricAction. +func (ltma LogToMetricAction) AsLogToMetricAction() (*LogToMetricAction, bool) { + return <ma, true +} + +// AsAction is the BasicAction implementation for LogToMetricAction. +func (ltma LogToMetricAction) AsAction() (*Action, bool) { + return nil, false +} + +// AsBasicAction is the BasicAction implementation for LogToMetricAction. +func (ltma LogToMetricAction) AsBasicAction() (BasicAction, bool) { + return <ma, true +} + // ManagementEventAggregationCondition how the data that is collected should be combined over time. type ManagementEventAggregationCondition struct { // Operator - the condition operator. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' @@ -4474,7 +4550,7 @@ type SmsReceiver struct { // Source specifies the log search query. type Source struct { - // Query - Log search query. + // Query - Log search query. Required for action type - AlertingAction Query *string `json:"query,omitempty"` // AuthorizedResources - List of Resource referred into query AuthorizedResources *[]string `json:"authorizedResources,omitempty"` diff --git a/services/preview/monitor/mgmt/2018-09-01/insights/scheduledqueryrules.go b/services/preview/monitor/mgmt/2018-09-01/insights/scheduledqueryrules.go index d8cc76492783..e4c7daba9b0c 100644 --- a/services/preview/monitor/mgmt/2018-09-01/insights/scheduledqueryrules.go +++ b/services/preview/monitor/mgmt/2018-09-01/insights/scheduledqueryrules.go @@ -50,10 +50,8 @@ func (client ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, reso {TargetValue: parameters, Constraints: []validation.Constraint{{Target: "parameters.LogSearchRule", Name: validation.Null, Rule: true, Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source.Query", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.LogSearchRule.Source.DataSourceID", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "parameters.LogSearchRule.Schedule", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source.DataSourceID", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.LogSearchRule.Schedule", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Schedule.FrequencyInMinutes", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.LogSearchRule.Schedule.TimeWindowInMinutes", Name: validation.Null, Rule: true, Chain: nil}, }},