...

Source file src/github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights/models.go

Documentation: github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights

     1  package insights
     2  
     3  // Copyright (c) Microsoft Corporation. All rights reserved.
     4  // Licensed under the MIT License. See License.txt in the project root for license information.
     5  //
     6  // Code generated by Microsoft (R) AutoRest Code Generator.
     7  // Changes may cause incorrect behavior and will be lost if the code is regenerated.
     8  
     9  import (
    10  	"context"
    11  	"encoding/json"
    12  	"github.com/Azure/go-autorest/autorest"
    13  	"github.com/Azure/go-autorest/autorest/date"
    14  	"github.com/Azure/go-autorest/autorest/to"
    15  	"github.com/Azure/go-autorest/tracing"
    16  	"net/http"
    17  )
    18  
    19  // The package's fully qualified name.
    20  const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights"
    21  
    22  // BasicAction action descriptor.
    23  type BasicAction interface {
    24  	AsAlertingAction() (*AlertingAction, bool)
    25  	AsLogToMetricAction() (*LogToMetricAction, bool)
    26  	AsAction() (*Action, bool)
    27  }
    28  
    29  // Action action descriptor.
    30  type Action struct {
    31  	// OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction'
    32  	OdataType OdataTypeBasicAction `json:"odata.type,omitempty"`
    33  }
    34  
    35  func unmarshalBasicAction(body []byte) (BasicAction, error) {
    36  	var m map[string]interface{}
    37  	err := json.Unmarshal(body, &m)
    38  	if err != nil {
    39  		return nil, err
    40  	}
    41  
    42  	switch m["odata.type"] {
    43  	case string(OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction):
    44  		var aa AlertingAction
    45  		err := json.Unmarshal(body, &aa)
    46  		return aa, err
    47  	case string(OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction):
    48  		var ltma LogToMetricAction
    49  		err := json.Unmarshal(body, &ltma)
    50  		return ltma, err
    51  	default:
    52  		var a Action
    53  		err := json.Unmarshal(body, &a)
    54  		return a, err
    55  	}
    56  }
    57  func unmarshalBasicActionArray(body []byte) ([]BasicAction, error) {
    58  	var rawMessages []*json.RawMessage
    59  	err := json.Unmarshal(body, &rawMessages)
    60  	if err != nil {
    61  		return nil, err
    62  	}
    63  
    64  	aArray := make([]BasicAction, len(rawMessages))
    65  
    66  	for index, rawMessage := range rawMessages {
    67  		a, err := unmarshalBasicAction(*rawMessage)
    68  		if err != nil {
    69  			return nil, err
    70  		}
    71  		aArray[index] = a
    72  	}
    73  	return aArray, nil
    74  }
    75  
    76  // MarshalJSON is the custom marshaler for Action.
    77  func (a Action) MarshalJSON() ([]byte, error) {
    78  	a.OdataType = OdataTypeAction
    79  	objectMap := make(map[string]interface{})
    80  	if a.OdataType != "" {
    81  		objectMap["odata.type"] = a.OdataType
    82  	}
    83  	return json.Marshal(objectMap)
    84  }
    85  
    86  // AsAlertingAction is the BasicAction implementation for Action.
    87  func (a Action) AsAlertingAction() (*AlertingAction, bool) {
    88  	return nil, false
    89  }
    90  
    91  // AsLogToMetricAction is the BasicAction implementation for Action.
    92  func (a Action) AsLogToMetricAction() (*LogToMetricAction, bool) {
    93  	return nil, false
    94  }
    95  
    96  // AsAction is the BasicAction implementation for Action.
    97  func (a Action) AsAction() (*Action, bool) {
    98  	return &a, true
    99  }
   100  
   101  // AsBasicAction is the BasicAction implementation for Action.
   102  func (a Action) AsBasicAction() (BasicAction, bool) {
   103  	return &a, true
   104  }
   105  
   106  // ActionGroup an Azure action group.
   107  type ActionGroup struct {
   108  	// GroupShortName - The short name of the action group. This will be used in SMS messages.
   109  	GroupShortName *string `json:"groupShortName,omitempty"`
   110  	// Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications.
   111  	Enabled *bool `json:"enabled,omitempty"`
   112  	// EmailReceivers - The list of email receivers that are part of this action group.
   113  	EmailReceivers *[]EmailReceiver `json:"emailReceivers,omitempty"`
   114  	// SmsReceivers - The list of SMS receivers that are part of this action group.
   115  	SmsReceivers *[]SmsReceiver `json:"smsReceivers,omitempty"`
   116  	// WebhookReceivers - The list of webhook receivers that are part of this action group.
   117  	WebhookReceivers *[]WebhookReceiver `json:"webhookReceivers,omitempty"`
   118  	// ItsmReceivers - The list of ITSM receivers that are part of this action group.
   119  	ItsmReceivers *[]ItsmReceiver `json:"itsmReceivers,omitempty"`
   120  	// AzureAppPushReceivers - The list of AzureAppPush receivers that are part of this action group.
   121  	AzureAppPushReceivers *[]AzureAppPushReceiver `json:"azureAppPushReceivers,omitempty"`
   122  	// AutomationRunbookReceivers - The list of AutomationRunbook receivers that are part of this action group.
   123  	AutomationRunbookReceivers *[]AutomationRunbookReceiver `json:"automationRunbookReceivers,omitempty"`
   124  	// VoiceReceivers - The list of voice receivers that are part of this action group.
   125  	VoiceReceivers *[]VoiceReceiver `json:"voiceReceivers,omitempty"`
   126  	// LogicAppReceivers - The list of logic app receivers that are part of this action group.
   127  	LogicAppReceivers *[]LogicAppReceiver `json:"logicAppReceivers,omitempty"`
   128  	// AzureFunctionReceivers - The list of azure function receivers that are part of this action group.
   129  	AzureFunctionReceivers *[]AzureFunctionReceiver `json:"azureFunctionReceivers,omitempty"`
   130  }
   131  
   132  // ActionGroupList a list of action groups.
   133  type ActionGroupList struct {
   134  	autorest.Response `json:"-"`
   135  	// Value - The list of action groups.
   136  	Value *[]ActionGroupResource `json:"value,omitempty"`
   137  	// NextLink - Provides the link to retrieve the next set of elements.
   138  	NextLink *string `json:"nextLink,omitempty"`
   139  }
   140  
   141  // ActionGroupPatch an Azure action group for patch operations.
   142  type ActionGroupPatch struct {
   143  	// Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated.
   144  	Enabled *bool `json:"enabled,omitempty"`
   145  }
   146  
   147  // ActionGroupPatchBody an action group object for the body of patch operations.
   148  type ActionGroupPatchBody struct {
   149  	// Tags - Resource tags
   150  	Tags map[string]*string `json:"tags"`
   151  	// ActionGroupPatch - The action group settings for an update operation.
   152  	*ActionGroupPatch `json:"properties,omitempty"`
   153  }
   154  
   155  // MarshalJSON is the custom marshaler for ActionGroupPatchBody.
   156  func (agpb ActionGroupPatchBody) MarshalJSON() ([]byte, error) {
   157  	objectMap := make(map[string]interface{})
   158  	if agpb.Tags != nil {
   159  		objectMap["tags"] = agpb.Tags
   160  	}
   161  	if agpb.ActionGroupPatch != nil {
   162  		objectMap["properties"] = agpb.ActionGroupPatch
   163  	}
   164  	return json.Marshal(objectMap)
   165  }
   166  
   167  // UnmarshalJSON is the custom unmarshaler for ActionGroupPatchBody struct.
   168  func (agpb *ActionGroupPatchBody) UnmarshalJSON(body []byte) error {
   169  	var m map[string]*json.RawMessage
   170  	err := json.Unmarshal(body, &m)
   171  	if err != nil {
   172  		return err
   173  	}
   174  	for k, v := range m {
   175  		switch k {
   176  		case "tags":
   177  			if v != nil {
   178  				var tags map[string]*string
   179  				err = json.Unmarshal(*v, &tags)
   180  				if err != nil {
   181  					return err
   182  				}
   183  				agpb.Tags = tags
   184  			}
   185  		case "properties":
   186  			if v != nil {
   187  				var actionGroupPatch ActionGroupPatch
   188  				err = json.Unmarshal(*v, &actionGroupPatch)
   189  				if err != nil {
   190  					return err
   191  				}
   192  				agpb.ActionGroupPatch = &actionGroupPatch
   193  			}
   194  		}
   195  	}
   196  
   197  	return nil
   198  }
   199  
   200  // ActionGroupResource an action group resource.
   201  type ActionGroupResource struct {
   202  	autorest.Response `json:"-"`
   203  	// ActionGroup - The action groups properties of the resource.
   204  	*ActionGroup `json:"properties,omitempty"`
   205  	// ID - READ-ONLY; Azure resource Id
   206  	ID *string `json:"id,omitempty"`
   207  	// Name - READ-ONLY; Azure resource name
   208  	Name *string `json:"name,omitempty"`
   209  	// Type - READ-ONLY; Azure resource type
   210  	Type *string `json:"type,omitempty"`
   211  	// Location - Resource location
   212  	Location *string `json:"location,omitempty"`
   213  	// Tags - Resource tags
   214  	Tags map[string]*string `json:"tags"`
   215  }
   216  
   217  // MarshalJSON is the custom marshaler for ActionGroupResource.
   218  func (agr ActionGroupResource) MarshalJSON() ([]byte, error) {
   219  	objectMap := make(map[string]interface{})
   220  	if agr.ActionGroup != nil {
   221  		objectMap["properties"] = agr.ActionGroup
   222  	}
   223  	if agr.Location != nil {
   224  		objectMap["location"] = agr.Location
   225  	}
   226  	if agr.Tags != nil {
   227  		objectMap["tags"] = agr.Tags
   228  	}
   229  	return json.Marshal(objectMap)
   230  }
   231  
   232  // UnmarshalJSON is the custom unmarshaler for ActionGroupResource struct.
   233  func (agr *ActionGroupResource) UnmarshalJSON(body []byte) error {
   234  	var m map[string]*json.RawMessage
   235  	err := json.Unmarshal(body, &m)
   236  	if err != nil {
   237  		return err
   238  	}
   239  	for k, v := range m {
   240  		switch k {
   241  		case "properties":
   242  			if v != nil {
   243  				var actionGroup ActionGroup
   244  				err = json.Unmarshal(*v, &actionGroup)
   245  				if err != nil {
   246  					return err
   247  				}
   248  				agr.ActionGroup = &actionGroup
   249  			}
   250  		case "id":
   251  			if v != nil {
   252  				var ID string
   253  				err = json.Unmarshal(*v, &ID)
   254  				if err != nil {
   255  					return err
   256  				}
   257  				agr.ID = &ID
   258  			}
   259  		case "name":
   260  			if v != nil {
   261  				var name string
   262  				err = json.Unmarshal(*v, &name)
   263  				if err != nil {
   264  					return err
   265  				}
   266  				agr.Name = &name
   267  			}
   268  		case "type":
   269  			if v != nil {
   270  				var typeVar string
   271  				err = json.Unmarshal(*v, &typeVar)
   272  				if err != nil {
   273  					return err
   274  				}
   275  				agr.Type = &typeVar
   276  			}
   277  		case "location":
   278  			if v != nil {
   279  				var location string
   280  				err = json.Unmarshal(*v, &location)
   281  				if err != nil {
   282  					return err
   283  				}
   284  				agr.Location = &location
   285  			}
   286  		case "tags":
   287  			if v != nil {
   288  				var tags map[string]*string
   289  				err = json.Unmarshal(*v, &tags)
   290  				if err != nil {
   291  					return err
   292  				}
   293  				agr.Tags = tags
   294  			}
   295  		}
   296  	}
   297  
   298  	return nil
   299  }
   300  
   301  // ActivityLogAlert an Azure activity log alert.
   302  type ActivityLogAlert struct {
   303  	// Scopes - A list of resourceIds that will be used as prefixes. The alert will only apply to activityLogs with resourceIds that fall under one of these prefixes. This list must include at least one item.
   304  	Scopes *[]string `json:"scopes,omitempty"`
   305  	// Enabled - Indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated.
   306  	Enabled *bool `json:"enabled,omitempty"`
   307  	// Condition - The condition that will cause this alert to activate.
   308  	Condition *ActivityLogAlertAllOfCondition `json:"condition,omitempty"`
   309  	// Actions - The actions that will activate when the condition is met.
   310  	Actions *ActivityLogAlertActionList `json:"actions,omitempty"`
   311  	// Description - A description of this activity log alert.
   312  	Description *string `json:"description,omitempty"`
   313  }
   314  
   315  // ActivityLogAlertActionGroup a pointer to an Azure Action Group.
   316  type ActivityLogAlertActionGroup struct {
   317  	// ActionGroupID - The resourceId of the action group. This cannot be null or empty.
   318  	ActionGroupID *string `json:"actionGroupId,omitempty"`
   319  	// WebhookProperties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload.
   320  	WebhookProperties map[string]*string `json:"webhookProperties"`
   321  }
   322  
   323  // MarshalJSON is the custom marshaler for ActivityLogAlertActionGroup.
   324  func (alaag ActivityLogAlertActionGroup) MarshalJSON() ([]byte, error) {
   325  	objectMap := make(map[string]interface{})
   326  	if alaag.ActionGroupID != nil {
   327  		objectMap["actionGroupId"] = alaag.ActionGroupID
   328  	}
   329  	if alaag.WebhookProperties != nil {
   330  		objectMap["webhookProperties"] = alaag.WebhookProperties
   331  	}
   332  	return json.Marshal(objectMap)
   333  }
   334  
   335  // ActivityLogAlertActionList a list of activity log alert actions.
   336  type ActivityLogAlertActionList struct {
   337  	// ActionGroups - The list of activity log alerts.
   338  	ActionGroups *[]ActivityLogAlertActionGroup `json:"actionGroups,omitempty"`
   339  }
   340  
   341  // ActivityLogAlertAllOfCondition an Activity Log alert condition that is met when all its member
   342  // conditions are met.
   343  type ActivityLogAlertAllOfCondition struct {
   344  	// AllOf - The list of activity log alert conditions.
   345  	AllOf *[]ActivityLogAlertLeafCondition `json:"allOf,omitempty"`
   346  }
   347  
   348  // ActivityLogAlertLeafCondition an Activity Log alert condition that is met by comparing an activity log
   349  // field and value.
   350  type ActivityLogAlertLeafCondition struct {
   351  	// Field - The name of the field that this condition will examine. The possible values for this field are (case-insensitive): 'resourceId', 'category', 'caller', 'level', 'operationName', 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties.'.
   352  	Field *string `json:"field,omitempty"`
   353  	// Equals - The field value will be compared to this value (case-insensitive) to determine if the condition is met.
   354  	Equals *string `json:"equals,omitempty"`
   355  }
   356  
   357  // ActivityLogAlertList a list of activity log alerts.
   358  type ActivityLogAlertList struct {
   359  	autorest.Response `json:"-"`
   360  	// Value - The list of activity log alerts.
   361  	Value *[]ActivityLogAlertResource `json:"value,omitempty"`
   362  	// NextLink - Provides the link to retrieve the next set of elements.
   363  	NextLink *string `json:"nextLink,omitempty"`
   364  }
   365  
   366  // ActivityLogAlertPatch an Azure activity log alert for patch operations.
   367  type ActivityLogAlertPatch struct {
   368  	// Enabled - Indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated.
   369  	Enabled *bool `json:"enabled,omitempty"`
   370  }
   371  
   372  // ActivityLogAlertPatchBody an activity log alert object for the body of patch operations.
   373  type ActivityLogAlertPatchBody struct {
   374  	// Tags - Resource tags
   375  	Tags map[string]*string `json:"tags"`
   376  	// ActivityLogAlertPatch - The activity log alert settings for an update operation.
   377  	*ActivityLogAlertPatch `json:"properties,omitempty"`
   378  }
   379  
   380  // MarshalJSON is the custom marshaler for ActivityLogAlertPatchBody.
   381  func (alapb ActivityLogAlertPatchBody) MarshalJSON() ([]byte, error) {
   382  	objectMap := make(map[string]interface{})
   383  	if alapb.Tags != nil {
   384  		objectMap["tags"] = alapb.Tags
   385  	}
   386  	if alapb.ActivityLogAlertPatch != nil {
   387  		objectMap["properties"] = alapb.ActivityLogAlertPatch
   388  	}
   389  	return json.Marshal(objectMap)
   390  }
   391  
   392  // UnmarshalJSON is the custom unmarshaler for ActivityLogAlertPatchBody struct.
   393  func (alapb *ActivityLogAlertPatchBody) UnmarshalJSON(body []byte) error {
   394  	var m map[string]*json.RawMessage
   395  	err := json.Unmarshal(body, &m)
   396  	if err != nil {
   397  		return err
   398  	}
   399  	for k, v := range m {
   400  		switch k {
   401  		case "tags":
   402  			if v != nil {
   403  				var tags map[string]*string
   404  				err = json.Unmarshal(*v, &tags)
   405  				if err != nil {
   406  					return err
   407  				}
   408  				alapb.Tags = tags
   409  			}
   410  		case "properties":
   411  			if v != nil {
   412  				var activityLogAlertPatch ActivityLogAlertPatch
   413  				err = json.Unmarshal(*v, &activityLogAlertPatch)
   414  				if err != nil {
   415  					return err
   416  				}
   417  				alapb.ActivityLogAlertPatch = &activityLogAlertPatch
   418  			}
   419  		}
   420  	}
   421  
   422  	return nil
   423  }
   424  
   425  // ActivityLogAlertResource an activity log alert resource.
   426  type ActivityLogAlertResource struct {
   427  	autorest.Response `json:"-"`
   428  	// ActivityLogAlert - The activity log alert properties of the resource.
   429  	*ActivityLogAlert `json:"properties,omitempty"`
   430  	// ID - READ-ONLY; Azure resource Id
   431  	ID *string `json:"id,omitempty"`
   432  	// Name - READ-ONLY; Azure resource name
   433  	Name *string `json:"name,omitempty"`
   434  	// Type - READ-ONLY; Azure resource type
   435  	Type *string `json:"type,omitempty"`
   436  	// Location - Resource location
   437  	Location *string `json:"location,omitempty"`
   438  	// Tags - Resource tags
   439  	Tags map[string]*string `json:"tags"`
   440  }
   441  
   442  // MarshalJSON is the custom marshaler for ActivityLogAlertResource.
   443  func (alar ActivityLogAlertResource) MarshalJSON() ([]byte, error) {
   444  	objectMap := make(map[string]interface{})
   445  	if alar.ActivityLogAlert != nil {
   446  		objectMap["properties"] = alar.ActivityLogAlert
   447  	}
   448  	if alar.Location != nil {
   449  		objectMap["location"] = alar.Location
   450  	}
   451  	if alar.Tags != nil {
   452  		objectMap["tags"] = alar.Tags
   453  	}
   454  	return json.Marshal(objectMap)
   455  }
   456  
   457  // UnmarshalJSON is the custom unmarshaler for ActivityLogAlertResource struct.
   458  func (alar *ActivityLogAlertResource) UnmarshalJSON(body []byte) error {
   459  	var m map[string]*json.RawMessage
   460  	err := json.Unmarshal(body, &m)
   461  	if err != nil {
   462  		return err
   463  	}
   464  	for k, v := range m {
   465  		switch k {
   466  		case "properties":
   467  			if v != nil {
   468  				var activityLogAlert ActivityLogAlert
   469  				err = json.Unmarshal(*v, &activityLogAlert)
   470  				if err != nil {
   471  					return err
   472  				}
   473  				alar.ActivityLogAlert = &activityLogAlert
   474  			}
   475  		case "id":
   476  			if v != nil {
   477  				var ID string
   478  				err = json.Unmarshal(*v, &ID)
   479  				if err != nil {
   480  					return err
   481  				}
   482  				alar.ID = &ID
   483  			}
   484  		case "name":
   485  			if v != nil {
   486  				var name string
   487  				err = json.Unmarshal(*v, &name)
   488  				if err != nil {
   489  					return err
   490  				}
   491  				alar.Name = &name
   492  			}
   493  		case "type":
   494  			if v != nil {
   495  				var typeVar string
   496  				err = json.Unmarshal(*v, &typeVar)
   497  				if err != nil {
   498  					return err
   499  				}
   500  				alar.Type = &typeVar
   501  			}
   502  		case "location":
   503  			if v != nil {
   504  				var location string
   505  				err = json.Unmarshal(*v, &location)
   506  				if err != nil {
   507  					return err
   508  				}
   509  				alar.Location = &location
   510  			}
   511  		case "tags":
   512  			if v != nil {
   513  				var tags map[string]*string
   514  				err = json.Unmarshal(*v, &tags)
   515  				if err != nil {
   516  					return err
   517  				}
   518  				alar.Tags = tags
   519  			}
   520  		}
   521  	}
   522  
   523  	return nil
   524  }
   525  
   526  // AlertingAction specify action need to be taken when rule type is Alert
   527  type AlertingAction struct {
   528  	// Severity - Severity of the alert. Possible values include: 'Zero', 'One', 'Two', 'Three', 'Four'
   529  	Severity AlertSeverity `json:"severity,omitempty"`
   530  	// AznsAction - Azure action group reference.
   531  	AznsAction *AzNsActionGroup `json:"aznsAction,omitempty"`
   532  	// ThrottlingInMin - time (in minutes) for which Alerts should be throttled or suppressed.
   533  	ThrottlingInMin *int32 `json:"throttlingInMin,omitempty"`
   534  	// Trigger - The trigger condition that results in the alert rule being.
   535  	Trigger *TriggerCondition `json:"trigger,omitempty"`
   536  	// OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction'
   537  	OdataType OdataTypeBasicAction `json:"odata.type,omitempty"`
   538  }
   539  
   540  // MarshalJSON is the custom marshaler for AlertingAction.
   541  func (aa AlertingAction) MarshalJSON() ([]byte, error) {
   542  	aa.OdataType = OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction
   543  	objectMap := make(map[string]interface{})
   544  	if aa.Severity != "" {
   545  		objectMap["severity"] = aa.Severity
   546  	}
   547  	if aa.AznsAction != nil {
   548  		objectMap["aznsAction"] = aa.AznsAction
   549  	}
   550  	if aa.ThrottlingInMin != nil {
   551  		objectMap["throttlingInMin"] = aa.ThrottlingInMin
   552  	}
   553  	if aa.Trigger != nil {
   554  		objectMap["trigger"] = aa.Trigger
   555  	}
   556  	if aa.OdataType != "" {
   557  		objectMap["odata.type"] = aa.OdataType
   558  	}
   559  	return json.Marshal(objectMap)
   560  }
   561  
   562  // AsAlertingAction is the BasicAction implementation for AlertingAction.
   563  func (aa AlertingAction) AsAlertingAction() (*AlertingAction, bool) {
   564  	return &aa, true
   565  }
   566  
   567  // AsLogToMetricAction is the BasicAction implementation for AlertingAction.
   568  func (aa AlertingAction) AsLogToMetricAction() (*LogToMetricAction, bool) {
   569  	return nil, false
   570  }
   571  
   572  // AsAction is the BasicAction implementation for AlertingAction.
   573  func (aa AlertingAction) AsAction() (*Action, bool) {
   574  	return nil, false
   575  }
   576  
   577  // AsBasicAction is the BasicAction implementation for AlertingAction.
   578  func (aa AlertingAction) AsBasicAction() (BasicAction, bool) {
   579  	return &aa, true
   580  }
   581  
   582  // AlertRule an alert rule.
   583  type AlertRule struct {
   584  	// Name - the name of the alert rule.
   585  	Name *string `json:"name,omitempty"`
   586  	// Description - the description of the alert rule that will be included in the alert email.
   587  	Description *string `json:"description,omitempty"`
   588  	// IsEnabled - the flag that indicates whether the alert rule is enabled.
   589  	IsEnabled *bool `json:"isEnabled,omitempty"`
   590  	// Condition - the condition that results in the alert rule being activated.
   591  	Condition BasicRuleCondition `json:"condition,omitempty"`
   592  	// Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved.
   593  	Actions *[]BasicRuleAction `json:"actions,omitempty"`
   594  	// LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format.
   595  	LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"`
   596  }
   597  
   598  // MarshalJSON is the custom marshaler for AlertRule.
   599  func (ar AlertRule) MarshalJSON() ([]byte, error) {
   600  	objectMap := make(map[string]interface{})
   601  	if ar.Name != nil {
   602  		objectMap["name"] = ar.Name
   603  	}
   604  	if ar.Description != nil {
   605  		objectMap["description"] = ar.Description
   606  	}
   607  	if ar.IsEnabled != nil {
   608  		objectMap["isEnabled"] = ar.IsEnabled
   609  	}
   610  	objectMap["condition"] = ar.Condition
   611  	if ar.Actions != nil {
   612  		objectMap["actions"] = ar.Actions
   613  	}
   614  	return json.Marshal(objectMap)
   615  }
   616  
   617  // UnmarshalJSON is the custom unmarshaler for AlertRule struct.
   618  func (ar *AlertRule) UnmarshalJSON(body []byte) error {
   619  	var m map[string]*json.RawMessage
   620  	err := json.Unmarshal(body, &m)
   621  	if err != nil {
   622  		return err
   623  	}
   624  	for k, v := range m {
   625  		switch k {
   626  		case "name":
   627  			if v != nil {
   628  				var name string
   629  				err = json.Unmarshal(*v, &name)
   630  				if err != nil {
   631  					return err
   632  				}
   633  				ar.Name = &name
   634  			}
   635  		case "description":
   636  			if v != nil {
   637  				var description string
   638  				err = json.Unmarshal(*v, &description)
   639  				if err != nil {
   640  					return err
   641  				}
   642  				ar.Description = &description
   643  			}
   644  		case "isEnabled":
   645  			if v != nil {
   646  				var isEnabled bool
   647  				err = json.Unmarshal(*v, &isEnabled)
   648  				if err != nil {
   649  					return err
   650  				}
   651  				ar.IsEnabled = &isEnabled
   652  			}
   653  		case "condition":
   654  			if v != nil {
   655  				condition, err := unmarshalBasicRuleCondition(*v)
   656  				if err != nil {
   657  					return err
   658  				}
   659  				ar.Condition = condition
   660  			}
   661  		case "actions":
   662  			if v != nil {
   663  				actions, err := unmarshalBasicRuleActionArray(*v)
   664  				if err != nil {
   665  					return err
   666  				}
   667  				ar.Actions = &actions
   668  			}
   669  		case "lastUpdatedTime":
   670  			if v != nil {
   671  				var lastUpdatedTime date.Time
   672  				err = json.Unmarshal(*v, &lastUpdatedTime)
   673  				if err != nil {
   674  					return err
   675  				}
   676  				ar.LastUpdatedTime = &lastUpdatedTime
   677  			}
   678  		}
   679  	}
   680  
   681  	return nil
   682  }
   683  
   684  // AlertRuleResource the alert rule resource.
   685  type AlertRuleResource struct {
   686  	autorest.Response `json:"-"`
   687  	// AlertRule - The alert rule properties of the resource.
   688  	*AlertRule `json:"properties,omitempty"`
   689  	// ID - READ-ONLY; Azure resource Id
   690  	ID *string `json:"id,omitempty"`
   691  	// Name - READ-ONLY; Azure resource name
   692  	Name *string `json:"name,omitempty"`
   693  	// Type - READ-ONLY; Azure resource type
   694  	Type *string `json:"type,omitempty"`
   695  	// Location - Resource location
   696  	Location *string `json:"location,omitempty"`
   697  	// Tags - Resource tags
   698  	Tags map[string]*string `json:"tags"`
   699  }
   700  
   701  // MarshalJSON is the custom marshaler for AlertRuleResource.
   702  func (arr AlertRuleResource) MarshalJSON() ([]byte, error) {
   703  	objectMap := make(map[string]interface{})
   704  	if arr.AlertRule != nil {
   705  		objectMap["properties"] = arr.AlertRule
   706  	}
   707  	if arr.Location != nil {
   708  		objectMap["location"] = arr.Location
   709  	}
   710  	if arr.Tags != nil {
   711  		objectMap["tags"] = arr.Tags
   712  	}
   713  	return json.Marshal(objectMap)
   714  }
   715  
   716  // UnmarshalJSON is the custom unmarshaler for AlertRuleResource struct.
   717  func (arr *AlertRuleResource) UnmarshalJSON(body []byte) error {
   718  	var m map[string]*json.RawMessage
   719  	err := json.Unmarshal(body, &m)
   720  	if err != nil {
   721  		return err
   722  	}
   723  	for k, v := range m {
   724  		switch k {
   725  		case "properties":
   726  			if v != nil {
   727  				var alertRule AlertRule
   728  				err = json.Unmarshal(*v, &alertRule)
   729  				if err != nil {
   730  					return err
   731  				}
   732  				arr.AlertRule = &alertRule
   733  			}
   734  		case "id":
   735  			if v != nil {
   736  				var ID string
   737  				err = json.Unmarshal(*v, &ID)
   738  				if err != nil {
   739  					return err
   740  				}
   741  				arr.ID = &ID
   742  			}
   743  		case "name":
   744  			if v != nil {
   745  				var name string
   746  				err = json.Unmarshal(*v, &name)
   747  				if err != nil {
   748  					return err
   749  				}
   750  				arr.Name = &name
   751  			}
   752  		case "type":
   753  			if v != nil {
   754  				var typeVar string
   755  				err = json.Unmarshal(*v, &typeVar)
   756  				if err != nil {
   757  					return err
   758  				}
   759  				arr.Type = &typeVar
   760  			}
   761  		case "location":
   762  			if v != nil {
   763  				var location string
   764  				err = json.Unmarshal(*v, &location)
   765  				if err != nil {
   766  					return err
   767  				}
   768  				arr.Location = &location
   769  			}
   770  		case "tags":
   771  			if v != nil {
   772  				var tags map[string]*string
   773  				err = json.Unmarshal(*v, &tags)
   774  				if err != nil {
   775  					return err
   776  				}
   777  				arr.Tags = tags
   778  			}
   779  		}
   780  	}
   781  
   782  	return nil
   783  }
   784  
   785  // AlertRuleResourceCollection represents a collection of alert rule resources.
   786  type AlertRuleResourceCollection struct {
   787  	autorest.Response `json:"-"`
   788  	// Value - the values for the alert rule resources.
   789  	Value *[]AlertRuleResource `json:"value,omitempty"`
   790  }
   791  
   792  // AlertRuleResourcePatch the alert rule object for patch operations.
   793  type AlertRuleResourcePatch struct {
   794  	// Tags - Resource tags
   795  	Tags map[string]*string `json:"tags"`
   796  	// AlertRule - The properties of an alert rule.
   797  	*AlertRule `json:"properties,omitempty"`
   798  }
   799  
   800  // MarshalJSON is the custom marshaler for AlertRuleResourcePatch.
   801  func (arrp AlertRuleResourcePatch) MarshalJSON() ([]byte, error) {
   802  	objectMap := make(map[string]interface{})
   803  	if arrp.Tags != nil {
   804  		objectMap["tags"] = arrp.Tags
   805  	}
   806  	if arrp.AlertRule != nil {
   807  		objectMap["properties"] = arrp.AlertRule
   808  	}
   809  	return json.Marshal(objectMap)
   810  }
   811  
   812  // UnmarshalJSON is the custom unmarshaler for AlertRuleResourcePatch struct.
   813  func (arrp *AlertRuleResourcePatch) UnmarshalJSON(body []byte) error {
   814  	var m map[string]*json.RawMessage
   815  	err := json.Unmarshal(body, &m)
   816  	if err != nil {
   817  		return err
   818  	}
   819  	for k, v := range m {
   820  		switch k {
   821  		case "tags":
   822  			if v != nil {
   823  				var tags map[string]*string
   824  				err = json.Unmarshal(*v, &tags)
   825  				if err != nil {
   826  					return err
   827  				}
   828  				arrp.Tags = tags
   829  			}
   830  		case "properties":
   831  			if v != nil {
   832  				var alertRule AlertRule
   833  				err = json.Unmarshal(*v, &alertRule)
   834  				if err != nil {
   835  					return err
   836  				}
   837  				arrp.AlertRule = &alertRule
   838  			}
   839  		}
   840  	}
   841  
   842  	return nil
   843  }
   844  
   845  // AutomationRunbookReceiver the Azure Automation Runbook notification receiver.
   846  type AutomationRunbookReceiver struct {
   847  	// AutomationAccountID - The Azure automation account Id which holds this runbook and authenticate to Azure resource.
   848  	AutomationAccountID *string `json:"automationAccountId,omitempty"`
   849  	// RunbookName - The name for this runbook.
   850  	RunbookName *string `json:"runbookName,omitempty"`
   851  	// WebhookResourceID - The resource id for webhook linked to this runbook.
   852  	WebhookResourceID *string `json:"webhookResourceId,omitempty"`
   853  	// IsGlobalRunbook - Indicates whether this instance is global runbook.
   854  	IsGlobalRunbook *bool `json:"isGlobalRunbook,omitempty"`
   855  	// Name - Indicates name of the webhook.
   856  	Name *string `json:"name,omitempty"`
   857  	// ServiceURI - The URI where webhooks should be sent.
   858  	ServiceURI *string `json:"serviceUri,omitempty"`
   859  }
   860  
   861  // AutoscaleNotification autoscale notification.
   862  type AutoscaleNotification struct {
   863  	// Operation - the operation associated with the notification and its value must be "scale"
   864  	Operation *string `json:"operation,omitempty"`
   865  	// Email - the email notification.
   866  	Email *EmailNotification `json:"email,omitempty"`
   867  	// Webhooks - the collection of webhook notifications.
   868  	Webhooks *[]WebhookNotification `json:"webhooks,omitempty"`
   869  }
   870  
   871  // AutoscaleProfile autoscale profile.
   872  type AutoscaleProfile struct {
   873  	// Name - the name of the profile.
   874  	Name *string `json:"name,omitempty"`
   875  	// Capacity - the number of instances that can be used during this profile.
   876  	Capacity *ScaleCapacity `json:"capacity,omitempty"`
   877  	// Rules - the collection of rules that provide the triggers and parameters for the scaling action. A maximum of 10 rules can be specified.
   878  	Rules *[]ScaleRule `json:"rules,omitempty"`
   879  	// FixedDate - the specific date-time for the profile. This element is not used if the Recurrence element is used.
   880  	FixedDate *TimeWindow `json:"fixedDate,omitempty"`
   881  	// Recurrence - the repeating times at which this profile begins. This element is not used if the FixedDate element is used.
   882  	Recurrence *Recurrence `json:"recurrence,omitempty"`
   883  }
   884  
   885  // AutoscaleSetting a setting that contains all of the configuration for the automatic scaling of a
   886  // resource.
   887  type AutoscaleSetting struct {
   888  	// Profiles - the collection of automatic scaling profiles that specify different scaling parameters for different time periods. A maximum of 20 profiles can be specified.
   889  	Profiles *[]AutoscaleProfile `json:"profiles,omitempty"`
   890  	// Notifications - the collection of notifications.
   891  	Notifications *[]AutoscaleNotification `json:"notifications,omitempty"`
   892  	// Enabled - the enabled flag. Specifies whether automatic scaling is enabled for the resource. The default value is 'true'.
   893  	Enabled *bool `json:"enabled,omitempty"`
   894  	// Name - the name of the autoscale setting.
   895  	Name *string `json:"name,omitempty"`
   896  	// TargetResourceURI - the resource identifier of the resource that the autoscale setting should be added to.
   897  	TargetResourceURI *string `json:"targetResourceUri,omitempty"`
   898  }
   899  
   900  // AutoscaleSettingResource the autoscale setting resource.
   901  type AutoscaleSettingResource struct {
   902  	autorest.Response `json:"-"`
   903  	// AutoscaleSetting - The autoscale setting of the resource.
   904  	*AutoscaleSetting `json:"properties,omitempty"`
   905  	// ID - READ-ONLY; Azure resource Id
   906  	ID *string `json:"id,omitempty"`
   907  	// Name - READ-ONLY; Azure resource name
   908  	Name *string `json:"name,omitempty"`
   909  	// Type - READ-ONLY; Azure resource type
   910  	Type *string `json:"type,omitempty"`
   911  	// Location - Resource location
   912  	Location *string `json:"location,omitempty"`
   913  	// Tags - Resource tags
   914  	Tags map[string]*string `json:"tags"`
   915  }
   916  
   917  // MarshalJSON is the custom marshaler for AutoscaleSettingResource.
   918  func (asr AutoscaleSettingResource) MarshalJSON() ([]byte, error) {
   919  	objectMap := make(map[string]interface{})
   920  	if asr.AutoscaleSetting != nil {
   921  		objectMap["properties"] = asr.AutoscaleSetting
   922  	}
   923  	if asr.Location != nil {
   924  		objectMap["location"] = asr.Location
   925  	}
   926  	if asr.Tags != nil {
   927  		objectMap["tags"] = asr.Tags
   928  	}
   929  	return json.Marshal(objectMap)
   930  }
   931  
   932  // UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResource struct.
   933  func (asr *AutoscaleSettingResource) UnmarshalJSON(body []byte) error {
   934  	var m map[string]*json.RawMessage
   935  	err := json.Unmarshal(body, &m)
   936  	if err != nil {
   937  		return err
   938  	}
   939  	for k, v := range m {
   940  		switch k {
   941  		case "properties":
   942  			if v != nil {
   943  				var autoscaleSetting AutoscaleSetting
   944  				err = json.Unmarshal(*v, &autoscaleSetting)
   945  				if err != nil {
   946  					return err
   947  				}
   948  				asr.AutoscaleSetting = &autoscaleSetting
   949  			}
   950  		case "id":
   951  			if v != nil {
   952  				var ID string
   953  				err = json.Unmarshal(*v, &ID)
   954  				if err != nil {
   955  					return err
   956  				}
   957  				asr.ID = &ID
   958  			}
   959  		case "name":
   960  			if v != nil {
   961  				var name string
   962  				err = json.Unmarshal(*v, &name)
   963  				if err != nil {
   964  					return err
   965  				}
   966  				asr.Name = &name
   967  			}
   968  		case "type":
   969  			if v != nil {
   970  				var typeVar string
   971  				err = json.Unmarshal(*v, &typeVar)
   972  				if err != nil {
   973  					return err
   974  				}
   975  				asr.Type = &typeVar
   976  			}
   977  		case "location":
   978  			if v != nil {
   979  				var location string
   980  				err = json.Unmarshal(*v, &location)
   981  				if err != nil {
   982  					return err
   983  				}
   984  				asr.Location = &location
   985  			}
   986  		case "tags":
   987  			if v != nil {
   988  				var tags map[string]*string
   989  				err = json.Unmarshal(*v, &tags)
   990  				if err != nil {
   991  					return err
   992  				}
   993  				asr.Tags = tags
   994  			}
   995  		}
   996  	}
   997  
   998  	return nil
   999  }
  1000  
  1001  // AutoscaleSettingResourceCollection represents a collection of autoscale setting resources.
  1002  type AutoscaleSettingResourceCollection struct {
  1003  	autorest.Response `json:"-"`
  1004  	// Value - the values for the autoscale setting resources.
  1005  	Value *[]AutoscaleSettingResource `json:"value,omitempty"`
  1006  	// NextLink - URL to get the next set of results.
  1007  	NextLink *string `json:"nextLink,omitempty"`
  1008  }
  1009  
  1010  // AutoscaleSettingResourceCollectionIterator provides access to a complete listing of
  1011  // AutoscaleSettingResource values.
  1012  type AutoscaleSettingResourceCollectionIterator struct {
  1013  	i    int
  1014  	page AutoscaleSettingResourceCollectionPage
  1015  }
  1016  
  1017  // NextWithContext advances to the next value.  If there was an error making
  1018  // the request the iterator does not advance and the error is returned.
  1019  func (iter *AutoscaleSettingResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) {
  1020  	if tracing.IsEnabled() {
  1021  		ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionIterator.NextWithContext")
  1022  		defer func() {
  1023  			sc := -1
  1024  			if iter.Response().Response.Response != nil {
  1025  				sc = iter.Response().Response.Response.StatusCode
  1026  			}
  1027  			tracing.EndSpan(ctx, sc, err)
  1028  		}()
  1029  	}
  1030  	iter.i++
  1031  	if iter.i < len(iter.page.Values()) {
  1032  		return nil
  1033  	}
  1034  	err = iter.page.NextWithContext(ctx)
  1035  	if err != nil {
  1036  		iter.i--
  1037  		return err
  1038  	}
  1039  	iter.i = 0
  1040  	return nil
  1041  }
  1042  
  1043  // Next advances to the next value.  If there was an error making
  1044  // the request the iterator does not advance and the error is returned.
  1045  // Deprecated: Use NextWithContext() instead.
  1046  func (iter *AutoscaleSettingResourceCollectionIterator) Next() error {
  1047  	return iter.NextWithContext(context.Background())
  1048  }
  1049  
  1050  // NotDone returns true if the enumeration should be started or is not yet complete.
  1051  func (iter AutoscaleSettingResourceCollectionIterator) NotDone() bool {
  1052  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  1053  }
  1054  
  1055  // Response returns the raw server response from the last page request.
  1056  func (iter AutoscaleSettingResourceCollectionIterator) Response() AutoscaleSettingResourceCollection {
  1057  	return iter.page.Response()
  1058  }
  1059  
  1060  // Value returns the current value or a zero-initialized value if the
  1061  // iterator has advanced beyond the end of the collection.
  1062  func (iter AutoscaleSettingResourceCollectionIterator) Value() AutoscaleSettingResource {
  1063  	if !iter.page.NotDone() {
  1064  		return AutoscaleSettingResource{}
  1065  	}
  1066  	return iter.page.Values()[iter.i]
  1067  }
  1068  
  1069  // Creates a new instance of the AutoscaleSettingResourceCollectionIterator type.
  1070  func NewAutoscaleSettingResourceCollectionIterator(page AutoscaleSettingResourceCollectionPage) AutoscaleSettingResourceCollectionIterator {
  1071  	return AutoscaleSettingResourceCollectionIterator{page: page}
  1072  }
  1073  
  1074  // IsEmpty returns true if the ListResult contains no values.
  1075  func (asrc AutoscaleSettingResourceCollection) IsEmpty() bool {
  1076  	return asrc.Value == nil || len(*asrc.Value) == 0
  1077  }
  1078  
  1079  // hasNextLink returns true if the NextLink is not empty.
  1080  func (asrc AutoscaleSettingResourceCollection) hasNextLink() bool {
  1081  	return asrc.NextLink != nil && len(*asrc.NextLink) != 0
  1082  }
  1083  
  1084  // autoscaleSettingResourceCollectionPreparer prepares a request to retrieve the next set of results.
  1085  // It returns nil if no more results exist.
  1086  func (asrc AutoscaleSettingResourceCollection) autoscaleSettingResourceCollectionPreparer(ctx context.Context) (*http.Request, error) {
  1087  	if !asrc.hasNextLink() {
  1088  		return nil, nil
  1089  	}
  1090  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1091  		autorest.AsJSON(),
  1092  		autorest.AsGet(),
  1093  		autorest.WithBaseURL(to.String(asrc.NextLink)))
  1094  }
  1095  
  1096  // AutoscaleSettingResourceCollectionPage contains a page of AutoscaleSettingResource values.
  1097  type AutoscaleSettingResourceCollectionPage struct {
  1098  	fn   func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error)
  1099  	asrc AutoscaleSettingResourceCollection
  1100  }
  1101  
  1102  // NextWithContext advances to the next page of values.  If there was an error making
  1103  // the request the page does not advance and the error is returned.
  1104  func (page *AutoscaleSettingResourceCollectionPage) NextWithContext(ctx context.Context) (err error) {
  1105  	if tracing.IsEnabled() {
  1106  		ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionPage.NextWithContext")
  1107  		defer func() {
  1108  			sc := -1
  1109  			if page.Response().Response.Response != nil {
  1110  				sc = page.Response().Response.Response.StatusCode
  1111  			}
  1112  			tracing.EndSpan(ctx, sc, err)
  1113  		}()
  1114  	}
  1115  	for {
  1116  		next, err := page.fn(ctx, page.asrc)
  1117  		if err != nil {
  1118  			return err
  1119  		}
  1120  		page.asrc = next
  1121  		if !next.hasNextLink() || !next.IsEmpty() {
  1122  			break
  1123  		}
  1124  	}
  1125  	return nil
  1126  }
  1127  
  1128  // Next advances to the next page of values.  If there was an error making
  1129  // the request the page does not advance and the error is returned.
  1130  // Deprecated: Use NextWithContext() instead.
  1131  func (page *AutoscaleSettingResourceCollectionPage) Next() error {
  1132  	return page.NextWithContext(context.Background())
  1133  }
  1134  
  1135  // NotDone returns true if the page enumeration should be started or is not yet complete.
  1136  func (page AutoscaleSettingResourceCollectionPage) NotDone() bool {
  1137  	return !page.asrc.IsEmpty()
  1138  }
  1139  
  1140  // Response returns the raw server response from the last page request.
  1141  func (page AutoscaleSettingResourceCollectionPage) Response() AutoscaleSettingResourceCollection {
  1142  	return page.asrc
  1143  }
  1144  
  1145  // Values returns the slice of values for the current page or nil if there are no values.
  1146  func (page AutoscaleSettingResourceCollectionPage) Values() []AutoscaleSettingResource {
  1147  	if page.asrc.IsEmpty() {
  1148  		return nil
  1149  	}
  1150  	return *page.asrc.Value
  1151  }
  1152  
  1153  // Creates a new instance of the AutoscaleSettingResourceCollectionPage type.
  1154  func NewAutoscaleSettingResourceCollectionPage(cur AutoscaleSettingResourceCollection, getNextPage func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error)) AutoscaleSettingResourceCollectionPage {
  1155  	return AutoscaleSettingResourceCollectionPage{
  1156  		fn:   getNextPage,
  1157  		asrc: cur,
  1158  	}
  1159  }
  1160  
  1161  // AutoscaleSettingResourcePatch the autoscale setting object for patch operations.
  1162  type AutoscaleSettingResourcePatch struct {
  1163  	// Tags - Resource tags
  1164  	Tags map[string]*string `json:"tags"`
  1165  	// AutoscaleSetting - The autoscale setting properties of the update operation.
  1166  	*AutoscaleSetting `json:"properties,omitempty"`
  1167  }
  1168  
  1169  // MarshalJSON is the custom marshaler for AutoscaleSettingResourcePatch.
  1170  func (asrp AutoscaleSettingResourcePatch) MarshalJSON() ([]byte, error) {
  1171  	objectMap := make(map[string]interface{})
  1172  	if asrp.Tags != nil {
  1173  		objectMap["tags"] = asrp.Tags
  1174  	}
  1175  	if asrp.AutoscaleSetting != nil {
  1176  		objectMap["properties"] = asrp.AutoscaleSetting
  1177  	}
  1178  	return json.Marshal(objectMap)
  1179  }
  1180  
  1181  // UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResourcePatch struct.
  1182  func (asrp *AutoscaleSettingResourcePatch) UnmarshalJSON(body []byte) error {
  1183  	var m map[string]*json.RawMessage
  1184  	err := json.Unmarshal(body, &m)
  1185  	if err != nil {
  1186  		return err
  1187  	}
  1188  	for k, v := range m {
  1189  		switch k {
  1190  		case "tags":
  1191  			if v != nil {
  1192  				var tags map[string]*string
  1193  				err = json.Unmarshal(*v, &tags)
  1194  				if err != nil {
  1195  					return err
  1196  				}
  1197  				asrp.Tags = tags
  1198  			}
  1199  		case "properties":
  1200  			if v != nil {
  1201  				var autoscaleSetting AutoscaleSetting
  1202  				err = json.Unmarshal(*v, &autoscaleSetting)
  1203  				if err != nil {
  1204  					return err
  1205  				}
  1206  				asrp.AutoscaleSetting = &autoscaleSetting
  1207  			}
  1208  		}
  1209  	}
  1210  
  1211  	return nil
  1212  }
  1213  
  1214  // AzNsActionGroup azure action group
  1215  type AzNsActionGroup struct {
  1216  	// ActionGroup - Azure Action Group reference.
  1217  	ActionGroup *[]string `json:"actionGroup,omitempty"`
  1218  	// EmailSubject - Custom subject override for all email ids in Azure action group
  1219  	EmailSubject *string `json:"emailSubject,omitempty"`
  1220  	// CustomWebhookPayload - Custom payload to be sent for all webhook URI in Azure action group
  1221  	CustomWebhookPayload *string `json:"customWebhookPayload,omitempty"`
  1222  }
  1223  
  1224  // AzureAppPushReceiver the Azure mobile App push notification receiver.
  1225  type AzureAppPushReceiver struct {
  1226  	// Name - The name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group.
  1227  	Name *string `json:"name,omitempty"`
  1228  	// EmailAddress - The email address registered for the Azure mobile app.
  1229  	EmailAddress *string `json:"emailAddress,omitempty"`
  1230  }
  1231  
  1232  // AzureFunctionReceiver an azure function receiver.
  1233  type AzureFunctionReceiver struct {
  1234  	// Name - The name of the azure function receiver. Names must be unique across all receivers within an action group.
  1235  	Name *string `json:"name,omitempty"`
  1236  	// FunctionAppResourceID - The azure resource id of the function app.
  1237  	FunctionAppResourceID *string `json:"functionAppResourceId,omitempty"`
  1238  	// FunctionName - The function name in the function app.
  1239  	FunctionName *string `json:"functionName,omitempty"`
  1240  	// HTTPTriggerURL - The http trigger url where http request sent to.
  1241  	HTTPTriggerURL *string `json:"httpTriggerUrl,omitempty"`
  1242  }
  1243  
  1244  // Baseline the baseline values for a single sensitivity value.
  1245  type Baseline struct {
  1246  	// Sensitivity - the sensitivity of the baseline. Possible values include: 'SensitivityLow', 'SensitivityMedium', 'SensitivityHigh'
  1247  	Sensitivity Sensitivity `json:"sensitivity,omitempty"`
  1248  	// LowThresholds - The low thresholds of the baseline.
  1249  	LowThresholds *[]float64 `json:"lowThresholds,omitempty"`
  1250  	// HighThresholds - The high thresholds of the baseline.
  1251  	HighThresholds *[]float64 `json:"highThresholds,omitempty"`
  1252  }
  1253  
  1254  // BaselineMetadataValue represents a baseline metadata value.
  1255  type BaselineMetadataValue struct {
  1256  	// Name - the name of the metadata.
  1257  	Name *LocalizableString `json:"name,omitempty"`
  1258  	// Value - the value of the metadata.
  1259  	Value *string `json:"value,omitempty"`
  1260  }
  1261  
  1262  // BaselineProperties the baseline properties class.
  1263  type BaselineProperties struct {
  1264  	// Timespan - 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.
  1265  	Timespan *string `json:"timespan,omitempty"`
  1266  	// Interval - 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.
  1267  	Interval *string `json:"interval,omitempty"`
  1268  	// Aggregation - The aggregation type of the metric.
  1269  	Aggregation *string `json:"aggregation,omitempty"`
  1270  	// Timestamps - the array of timestamps of the baselines.
  1271  	Timestamps *[]date.Time `json:"timestamps,omitempty"`
  1272  	// Baseline - the baseline values for each sensitivity.
  1273  	Baseline *[]Baseline `json:"baseline,omitempty"`
  1274  	// Metadata - the baseline metadata values.
  1275  	Metadata *[]BaselineMetadataValue `json:"metadata,omitempty"`
  1276  }
  1277  
  1278  // BaselineResponse the response to a baseline query.
  1279  type BaselineResponse struct {
  1280  	autorest.Response `json:"-"`
  1281  	// ID - READ-ONLY; the metric baseline Id.
  1282  	ID *string `json:"id,omitempty"`
  1283  	// Type - READ-ONLY; the resource type of the baseline resource.
  1284  	Type *string `json:"type,omitempty"`
  1285  	// Name - READ-ONLY; the name and the display name of the metric, i.e. it is localizable string.
  1286  	Name *LocalizableString `json:"name,omitempty"`
  1287  	// BaselineProperties - the properties of the baseline.
  1288  	*BaselineProperties `json:"properties,omitempty"`
  1289  }
  1290  
  1291  // MarshalJSON is the custom marshaler for BaselineResponse.
  1292  func (br BaselineResponse) MarshalJSON() ([]byte, error) {
  1293  	objectMap := make(map[string]interface{})
  1294  	if br.BaselineProperties != nil {
  1295  		objectMap["properties"] = br.BaselineProperties
  1296  	}
  1297  	return json.Marshal(objectMap)
  1298  }
  1299  
  1300  // UnmarshalJSON is the custom unmarshaler for BaselineResponse struct.
  1301  func (br *BaselineResponse) UnmarshalJSON(body []byte) error {
  1302  	var m map[string]*json.RawMessage
  1303  	err := json.Unmarshal(body, &m)
  1304  	if err != nil {
  1305  		return err
  1306  	}
  1307  	for k, v := range m {
  1308  		switch k {
  1309  		case "id":
  1310  			if v != nil {
  1311  				var ID string
  1312  				err = json.Unmarshal(*v, &ID)
  1313  				if err != nil {
  1314  					return err
  1315  				}
  1316  				br.ID = &ID
  1317  			}
  1318  		case "type":
  1319  			if v != nil {
  1320  				var typeVar string
  1321  				err = json.Unmarshal(*v, &typeVar)
  1322  				if err != nil {
  1323  					return err
  1324  				}
  1325  				br.Type = &typeVar
  1326  			}
  1327  		case "name":
  1328  			if v != nil {
  1329  				var name LocalizableString
  1330  				err = json.Unmarshal(*v, &name)
  1331  				if err != nil {
  1332  					return err
  1333  				}
  1334  				br.Name = &name
  1335  			}
  1336  		case "properties":
  1337  			if v != nil {
  1338  				var baselineProperties BaselineProperties
  1339  				err = json.Unmarshal(*v, &baselineProperties)
  1340  				if err != nil {
  1341  					return err
  1342  				}
  1343  				br.BaselineProperties = &baselineProperties
  1344  			}
  1345  		}
  1346  	}
  1347  
  1348  	return nil
  1349  }
  1350  
  1351  // CalculateBaselineResponse the response to a calculate baseline call.
  1352  type CalculateBaselineResponse struct {
  1353  	autorest.Response `json:"-"`
  1354  	// Type - the resource type of the baseline resource.
  1355  	Type *string `json:"type,omitempty"`
  1356  	// Timestamps - the array of timestamps of the baselines.
  1357  	Timestamps *[]date.Time `json:"timestamps,omitempty"`
  1358  	// Baseline - the baseline values for each sensitivity.
  1359  	Baseline *[]Baseline `json:"baseline,omitempty"`
  1360  }
  1361  
  1362  // Criteria specifies the criteria for converting log to metric.
  1363  type Criteria struct {
  1364  	// MetricName - Name of the metric
  1365  	MetricName *string `json:"metricName,omitempty"`
  1366  	// Dimensions - List of Dimensions for creating metric
  1367  	Dimensions *[]Dimension `json:"dimensions,omitempty"`
  1368  }
  1369  
  1370  // DiagnosticSettings the diagnostic settings.
  1371  type DiagnosticSettings struct {
  1372  	// StorageAccountID - The resource ID of the storage account to which you would like to send Diagnostic Logs.
  1373  	StorageAccountID *string `json:"storageAccountId,omitempty"`
  1374  	// ServiceBusRuleID - The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility.
  1375  	ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"`
  1376  	// EventHubAuthorizationRuleID - The resource Id for the event hub authorization rule.
  1377  	EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"`
  1378  	// EventHubName - The name of the event hub. If none is specified, the default event hub will be selected.
  1379  	EventHubName *string `json:"eventHubName,omitempty"`
  1380  	// Metrics - The list of metric settings.
  1381  	Metrics *[]MetricSettings `json:"metrics,omitempty"`
  1382  	// Logs - The list of logs settings.
  1383  	Logs *[]LogSettings `json:"logs,omitempty"`
  1384  	// WorkspaceID - The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2
  1385  	WorkspaceID *string `json:"workspaceId,omitempty"`
  1386  	// LogAnalyticsDestinationType - A string indicating whether the export to Log Analytics should use the default destination type, i.e. AzureDiagnostics, or use a destination type constructed as follows: <normalized service identity>_<normalized category name>. Possible values are: Dedicated and null (null is default.)
  1387  	LogAnalyticsDestinationType *string `json:"logAnalyticsDestinationType,omitempty"`
  1388  }
  1389  
  1390  // DiagnosticSettingsCategory the diagnostic settings Category.
  1391  type DiagnosticSettingsCategory struct {
  1392  	// CategoryType - The type of the diagnostic settings category. Possible values include: 'Metrics', 'Logs'
  1393  	CategoryType CategoryType `json:"categoryType,omitempty"`
  1394  }
  1395  
  1396  // DiagnosticSettingsCategoryResource the diagnostic settings category resource.
  1397  type DiagnosticSettingsCategoryResource struct {
  1398  	autorest.Response `json:"-"`
  1399  	// DiagnosticSettingsCategory - The properties of a Diagnostic Settings Category.
  1400  	*DiagnosticSettingsCategory `json:"properties,omitempty"`
  1401  	// ID - READ-ONLY; Azure resource Id
  1402  	ID *string `json:"id,omitempty"`
  1403  	// Name - READ-ONLY; Azure resource name
  1404  	Name *string `json:"name,omitempty"`
  1405  	// Type - READ-ONLY; Azure resource type
  1406  	Type *string `json:"type,omitempty"`
  1407  }
  1408  
  1409  // MarshalJSON is the custom marshaler for DiagnosticSettingsCategoryResource.
  1410  func (dscr DiagnosticSettingsCategoryResource) MarshalJSON() ([]byte, error) {
  1411  	objectMap := make(map[string]interface{})
  1412  	if dscr.DiagnosticSettingsCategory != nil {
  1413  		objectMap["properties"] = dscr.DiagnosticSettingsCategory
  1414  	}
  1415  	return json.Marshal(objectMap)
  1416  }
  1417  
  1418  // UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsCategoryResource struct.
  1419  func (dscr *DiagnosticSettingsCategoryResource) UnmarshalJSON(body []byte) error {
  1420  	var m map[string]*json.RawMessage
  1421  	err := json.Unmarshal(body, &m)
  1422  	if err != nil {
  1423  		return err
  1424  	}
  1425  	for k, v := range m {
  1426  		switch k {
  1427  		case "properties":
  1428  			if v != nil {
  1429  				var diagnosticSettingsCategory DiagnosticSettingsCategory
  1430  				err = json.Unmarshal(*v, &diagnosticSettingsCategory)
  1431  				if err != nil {
  1432  					return err
  1433  				}
  1434  				dscr.DiagnosticSettingsCategory = &diagnosticSettingsCategory
  1435  			}
  1436  		case "id":
  1437  			if v != nil {
  1438  				var ID string
  1439  				err = json.Unmarshal(*v, &ID)
  1440  				if err != nil {
  1441  					return err
  1442  				}
  1443  				dscr.ID = &ID
  1444  			}
  1445  		case "name":
  1446  			if v != nil {
  1447  				var name string
  1448  				err = json.Unmarshal(*v, &name)
  1449  				if err != nil {
  1450  					return err
  1451  				}
  1452  				dscr.Name = &name
  1453  			}
  1454  		case "type":
  1455  			if v != nil {
  1456  				var typeVar string
  1457  				err = json.Unmarshal(*v, &typeVar)
  1458  				if err != nil {
  1459  					return err
  1460  				}
  1461  				dscr.Type = &typeVar
  1462  			}
  1463  		}
  1464  	}
  1465  
  1466  	return nil
  1467  }
  1468  
  1469  // DiagnosticSettingsCategoryResourceCollection represents a collection of diagnostic setting category
  1470  // resources.
  1471  type DiagnosticSettingsCategoryResourceCollection struct {
  1472  	autorest.Response `json:"-"`
  1473  	// Value - The collection of diagnostic settings category resources.
  1474  	Value *[]DiagnosticSettingsCategoryResource `json:"value,omitempty"`
  1475  }
  1476  
  1477  // DiagnosticSettingsResource the diagnostic setting resource.
  1478  type DiagnosticSettingsResource struct {
  1479  	autorest.Response `json:"-"`
  1480  	// DiagnosticSettings - Properties of a Diagnostic Settings Resource.
  1481  	*DiagnosticSettings `json:"properties,omitempty"`
  1482  	// ID - READ-ONLY; Azure resource Id
  1483  	ID *string `json:"id,omitempty"`
  1484  	// Name - READ-ONLY; Azure resource name
  1485  	Name *string `json:"name,omitempty"`
  1486  	// Type - READ-ONLY; Azure resource type
  1487  	Type *string `json:"type,omitempty"`
  1488  }
  1489  
  1490  // MarshalJSON is the custom marshaler for DiagnosticSettingsResource.
  1491  func (dsr DiagnosticSettingsResource) MarshalJSON() ([]byte, error) {
  1492  	objectMap := make(map[string]interface{})
  1493  	if dsr.DiagnosticSettings != nil {
  1494  		objectMap["properties"] = dsr.DiagnosticSettings
  1495  	}
  1496  	return json.Marshal(objectMap)
  1497  }
  1498  
  1499  // UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsResource struct.
  1500  func (dsr *DiagnosticSettingsResource) UnmarshalJSON(body []byte) error {
  1501  	var m map[string]*json.RawMessage
  1502  	err := json.Unmarshal(body, &m)
  1503  	if err != nil {
  1504  		return err
  1505  	}
  1506  	for k, v := range m {
  1507  		switch k {
  1508  		case "properties":
  1509  			if v != nil {
  1510  				var diagnosticSettings DiagnosticSettings
  1511  				err = json.Unmarshal(*v, &diagnosticSettings)
  1512  				if err != nil {
  1513  					return err
  1514  				}
  1515  				dsr.DiagnosticSettings = &diagnosticSettings
  1516  			}
  1517  		case "id":
  1518  			if v != nil {
  1519  				var ID string
  1520  				err = json.Unmarshal(*v, &ID)
  1521  				if err != nil {
  1522  					return err
  1523  				}
  1524  				dsr.ID = &ID
  1525  			}
  1526  		case "name":
  1527  			if v != nil {
  1528  				var name string
  1529  				err = json.Unmarshal(*v, &name)
  1530  				if err != nil {
  1531  					return err
  1532  				}
  1533  				dsr.Name = &name
  1534  			}
  1535  		case "type":
  1536  			if v != nil {
  1537  				var typeVar string
  1538  				err = json.Unmarshal(*v, &typeVar)
  1539  				if err != nil {
  1540  					return err
  1541  				}
  1542  				dsr.Type = &typeVar
  1543  			}
  1544  		}
  1545  	}
  1546  
  1547  	return nil
  1548  }
  1549  
  1550  // DiagnosticSettingsResourceCollection represents a collection of alert rule resources.
  1551  type DiagnosticSettingsResourceCollection struct {
  1552  	autorest.Response `json:"-"`
  1553  	// Value - The collection of diagnostic settings resources;.
  1554  	Value *[]DiagnosticSettingsResource `json:"value,omitempty"`
  1555  }
  1556  
  1557  // Dimension specifies the criteria for converting log to metric.
  1558  type Dimension struct {
  1559  	// Name - Name of the dimension
  1560  	Name *string `json:"name,omitempty"`
  1561  	// Operator - Operator for dimension values
  1562  	Operator *string `json:"operator,omitempty"`
  1563  	// Values - List of dimension values
  1564  	Values *[]string `json:"values,omitempty"`
  1565  }
  1566  
  1567  // DynamicMetricCriteria criterion for dynamic threshold.
  1568  type DynamicMetricCriteria struct {
  1569  	// Operator - The operator used to compare the metric value against the threshold. Possible values include: 'DynamicThresholdOperatorGreaterThan', 'DynamicThresholdOperatorLessThan', 'DynamicThresholdOperatorGreaterOrLessThan'
  1570  	Operator DynamicThresholdOperator `json:"operator,omitempty"`
  1571  	// AlertSensitivity - The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric series pattern. Possible values include: 'Low', 'Medium', 'High'
  1572  	AlertSensitivity DynamicThresholdSensitivity `json:"alertSensitivity,omitempty"`
  1573  	// FailingPeriods - The minimum number of violations required within the selected lookback time window required to raise an alert.
  1574  	FailingPeriods *DynamicThresholdFailingPeriods `json:"failingPeriods,omitempty"`
  1575  	// IgnoreDataBefore - Use this option to set the date from which to start learning the metric historical data and calculate the dynamic thresholds (in ISO8601 format)
  1576  	IgnoreDataBefore *date.Time `json:"ignoreDataBefore,omitempty"`
  1577  	// AdditionalProperties - Unmatched properties from the message are deserialized this collection
  1578  	AdditionalProperties map[string]interface{} `json:""`
  1579  	// Name - Name of the criteria.
  1580  	Name *string `json:"name,omitempty"`
  1581  	// MetricName - Name of the metric.
  1582  	MetricName *string `json:"metricName,omitempty"`
  1583  	// MetricNamespace - Namespace of the metric.
  1584  	MetricNamespace *string `json:"metricNamespace,omitempty"`
  1585  	// TimeAggregation - the criteria time aggregation types.
  1586  	TimeAggregation interface{} `json:"timeAggregation,omitempty"`
  1587  	// Dimensions - List of dimension conditions.
  1588  	Dimensions *[]MetricDimension `json:"dimensions,omitempty"`
  1589  	// SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped.
  1590  	SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"`
  1591  	// CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion'
  1592  	CriterionType CriterionType `json:"criterionType,omitempty"`
  1593  }
  1594  
  1595  // MarshalJSON is the custom marshaler for DynamicMetricCriteria.
  1596  func (dmc DynamicMetricCriteria) MarshalJSON() ([]byte, error) {
  1597  	dmc.CriterionType = CriterionTypeDynamicThresholdCriterion
  1598  	objectMap := make(map[string]interface{})
  1599  	if dmc.Operator != "" {
  1600  		objectMap["operator"] = dmc.Operator
  1601  	}
  1602  	if dmc.AlertSensitivity != "" {
  1603  		objectMap["alertSensitivity"] = dmc.AlertSensitivity
  1604  	}
  1605  	if dmc.FailingPeriods != nil {
  1606  		objectMap["failingPeriods"] = dmc.FailingPeriods
  1607  	}
  1608  	if dmc.IgnoreDataBefore != nil {
  1609  		objectMap["ignoreDataBefore"] = dmc.IgnoreDataBefore
  1610  	}
  1611  	if dmc.Name != nil {
  1612  		objectMap["name"] = dmc.Name
  1613  	}
  1614  	if dmc.MetricName != nil {
  1615  		objectMap["metricName"] = dmc.MetricName
  1616  	}
  1617  	if dmc.MetricNamespace != nil {
  1618  		objectMap["metricNamespace"] = dmc.MetricNamespace
  1619  	}
  1620  	if dmc.TimeAggregation != nil {
  1621  		objectMap["timeAggregation"] = dmc.TimeAggregation
  1622  	}
  1623  	if dmc.Dimensions != nil {
  1624  		objectMap["dimensions"] = dmc.Dimensions
  1625  	}
  1626  	if dmc.SkipMetricValidation != nil {
  1627  		objectMap["skipMetricValidation"] = dmc.SkipMetricValidation
  1628  	}
  1629  	if dmc.CriterionType != "" {
  1630  		objectMap["criterionType"] = dmc.CriterionType
  1631  	}
  1632  	for k, v := range dmc.AdditionalProperties {
  1633  		objectMap[k] = v
  1634  	}
  1635  	return json.Marshal(objectMap)
  1636  }
  1637  
  1638  // AsMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria.
  1639  func (dmc DynamicMetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) {
  1640  	return nil, false
  1641  }
  1642  
  1643  // AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria.
  1644  func (dmc DynamicMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) {
  1645  	return &dmc, true
  1646  }
  1647  
  1648  // AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria.
  1649  func (dmc DynamicMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) {
  1650  	return nil, false
  1651  }
  1652  
  1653  // AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria.
  1654  func (dmc DynamicMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) {
  1655  	return &dmc, true
  1656  }
  1657  
  1658  // UnmarshalJSON is the custom unmarshaler for DynamicMetricCriteria struct.
  1659  func (dmc *DynamicMetricCriteria) UnmarshalJSON(body []byte) error {
  1660  	var m map[string]*json.RawMessage
  1661  	err := json.Unmarshal(body, &m)
  1662  	if err != nil {
  1663  		return err
  1664  	}
  1665  	for k, v := range m {
  1666  		switch k {
  1667  		case "operator":
  1668  			if v != nil {
  1669  				var operator DynamicThresholdOperator
  1670  				err = json.Unmarshal(*v, &operator)
  1671  				if err != nil {
  1672  					return err
  1673  				}
  1674  				dmc.Operator = operator
  1675  			}
  1676  		case "alertSensitivity":
  1677  			if v != nil {
  1678  				var alertSensitivity DynamicThresholdSensitivity
  1679  				err = json.Unmarshal(*v, &alertSensitivity)
  1680  				if err != nil {
  1681  					return err
  1682  				}
  1683  				dmc.AlertSensitivity = alertSensitivity
  1684  			}
  1685  		case "failingPeriods":
  1686  			if v != nil {
  1687  				var failingPeriods DynamicThresholdFailingPeriods
  1688  				err = json.Unmarshal(*v, &failingPeriods)
  1689  				if err != nil {
  1690  					return err
  1691  				}
  1692  				dmc.FailingPeriods = &failingPeriods
  1693  			}
  1694  		case "ignoreDataBefore":
  1695  			if v != nil {
  1696  				var ignoreDataBefore date.Time
  1697  				err = json.Unmarshal(*v, &ignoreDataBefore)
  1698  				if err != nil {
  1699  					return err
  1700  				}
  1701  				dmc.IgnoreDataBefore = &ignoreDataBefore
  1702  			}
  1703  		default:
  1704  			if v != nil {
  1705  				var additionalProperties interface{}
  1706  				err = json.Unmarshal(*v, &additionalProperties)
  1707  				if err != nil {
  1708  					return err
  1709  				}
  1710  				if dmc.AdditionalProperties == nil {
  1711  					dmc.AdditionalProperties = make(map[string]interface{})
  1712  				}
  1713  				dmc.AdditionalProperties[k] = additionalProperties
  1714  			}
  1715  		case "name":
  1716  			if v != nil {
  1717  				var name string
  1718  				err = json.Unmarshal(*v, &name)
  1719  				if err != nil {
  1720  					return err
  1721  				}
  1722  				dmc.Name = &name
  1723  			}
  1724  		case "metricName":
  1725  			if v != nil {
  1726  				var metricName string
  1727  				err = json.Unmarshal(*v, &metricName)
  1728  				if err != nil {
  1729  					return err
  1730  				}
  1731  				dmc.MetricName = &metricName
  1732  			}
  1733  		case "metricNamespace":
  1734  			if v != nil {
  1735  				var metricNamespace string
  1736  				err = json.Unmarshal(*v, &metricNamespace)
  1737  				if err != nil {
  1738  					return err
  1739  				}
  1740  				dmc.MetricNamespace = &metricNamespace
  1741  			}
  1742  		case "timeAggregation":
  1743  			if v != nil {
  1744  				var timeAggregation interface{}
  1745  				err = json.Unmarshal(*v, &timeAggregation)
  1746  				if err != nil {
  1747  					return err
  1748  				}
  1749  				dmc.TimeAggregation = timeAggregation
  1750  			}
  1751  		case "dimensions":
  1752  			if v != nil {
  1753  				var dimensions []MetricDimension
  1754  				err = json.Unmarshal(*v, &dimensions)
  1755  				if err != nil {
  1756  					return err
  1757  				}
  1758  				dmc.Dimensions = &dimensions
  1759  			}
  1760  		case "skipMetricValidation":
  1761  			if v != nil {
  1762  				var skipMetricValidation bool
  1763  				err = json.Unmarshal(*v, &skipMetricValidation)
  1764  				if err != nil {
  1765  					return err
  1766  				}
  1767  				dmc.SkipMetricValidation = &skipMetricValidation
  1768  			}
  1769  		case "criterionType":
  1770  			if v != nil {
  1771  				var criterionType CriterionType
  1772  				err = json.Unmarshal(*v, &criterionType)
  1773  				if err != nil {
  1774  					return err
  1775  				}
  1776  				dmc.CriterionType = criterionType
  1777  			}
  1778  		}
  1779  	}
  1780  
  1781  	return nil
  1782  }
  1783  
  1784  // DynamicThresholdFailingPeriods the minimum number of violations required within the selected lookback
  1785  // time window required to raise an alert.
  1786  type DynamicThresholdFailingPeriods struct {
  1787  	// NumberOfEvaluationPeriods - 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.
  1788  	NumberOfEvaluationPeriods *float64 `json:"numberOfEvaluationPeriods,omitempty"`
  1789  	// MinFailingPeriodsToAlert - The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods.
  1790  	MinFailingPeriodsToAlert *float64 `json:"minFailingPeriodsToAlert,omitempty"`
  1791  }
  1792  
  1793  // EmailNotification email notification of an autoscale event.
  1794  type EmailNotification struct {
  1795  	// SendToSubscriptionAdministrator - a value indicating whether to send email to subscription administrator.
  1796  	SendToSubscriptionAdministrator *bool `json:"sendToSubscriptionAdministrator,omitempty"`
  1797  	// SendToSubscriptionCoAdministrators - a value indicating whether to send email to subscription co-administrators.
  1798  	SendToSubscriptionCoAdministrators *bool `json:"sendToSubscriptionCoAdministrators,omitempty"`
  1799  	// CustomEmails - the custom e-mails list. This value can be null or empty, in which case this attribute will be ignored.
  1800  	CustomEmails *[]string `json:"customEmails,omitempty"`
  1801  }
  1802  
  1803  // EmailReceiver an email receiver.
  1804  type EmailReceiver struct {
  1805  	// Name - The name of the email receiver. Names must be unique across all receivers within an action group.
  1806  	Name *string `json:"name,omitempty"`
  1807  	// EmailAddress - The email address of this receiver.
  1808  	EmailAddress *string `json:"emailAddress,omitempty"`
  1809  	// Status - READ-ONLY; The receiver status of the e-mail. Possible values include: 'ReceiverStatusNotSpecified', 'ReceiverStatusEnabled', 'ReceiverStatusDisabled'
  1810  	Status ReceiverStatus `json:"status,omitempty"`
  1811  }
  1812  
  1813  // MarshalJSON is the custom marshaler for EmailReceiver.
  1814  func (er EmailReceiver) MarshalJSON() ([]byte, error) {
  1815  	objectMap := make(map[string]interface{})
  1816  	if er.Name != nil {
  1817  		objectMap["name"] = er.Name
  1818  	}
  1819  	if er.EmailAddress != nil {
  1820  		objectMap["emailAddress"] = er.EmailAddress
  1821  	}
  1822  	return json.Marshal(objectMap)
  1823  }
  1824  
  1825  // EnableRequest describes a receiver that should be resubscribed.
  1826  type EnableRequest struct {
  1827  	// ReceiverName - The name of the receiver to resubscribe.
  1828  	ReceiverName *string `json:"receiverName,omitempty"`
  1829  }
  1830  
  1831  // ErrorResponse describes the format of Error response.
  1832  type ErrorResponse struct {
  1833  	// Code - Error code
  1834  	Code *string `json:"code,omitempty"`
  1835  	// Message - Error message indicating why the operation failed.
  1836  	Message *string `json:"message,omitempty"`
  1837  }
  1838  
  1839  // EventCategoryCollection a collection of event categories. Currently possible values are: Administrative,
  1840  // Security, ServiceHealth, Alert, Recommendation, Policy.
  1841  type EventCategoryCollection struct {
  1842  	autorest.Response `json:"-"`
  1843  	// Value - the list that includes the Azure event categories.
  1844  	Value *[]LocalizableString `json:"value,omitempty"`
  1845  }
  1846  
  1847  // EventData the Azure event log entries are of type EventData
  1848  type EventData struct {
  1849  	// Authorization - READ-ONLY; The sender authorization information.
  1850  	Authorization *SenderAuthorization `json:"authorization,omitempty"`
  1851  	// Claims - READ-ONLY; key value pairs to identify ARM permissions.
  1852  	Claims map[string]*string `json:"claims"`
  1853  	// Caller - READ-ONLY; the email address of the user who has performed the operation, the UPN claim or SPN claim based on availability.
  1854  	Caller *string `json:"caller,omitempty"`
  1855  	// Description - READ-ONLY; the description of the event.
  1856  	Description *string `json:"description,omitempty"`
  1857  	// ID - READ-ONLY; the Id of this event as required by ARM for RBAC. It contains the EventDataID and a timestamp information.
  1858  	ID *string `json:"id,omitempty"`
  1859  	// EventDataID - READ-ONLY; the event data Id. This is a unique identifier for an event.
  1860  	EventDataID *string `json:"eventDataId,omitempty"`
  1861  	// CorrelationID - READ-ONLY; the correlation Id, usually a GUID in the string format. The correlation Id is shared among the events that belong to the same uber operation.
  1862  	CorrelationID *string `json:"correlationId,omitempty"`
  1863  	// EventName - READ-ONLY; the event name. This value should not be confused with OperationName. For practical purposes, OperationName might be more appealing to end users.
  1864  	EventName *LocalizableString `json:"eventName,omitempty"`
  1865  	// Category - READ-ONLY; the event category.
  1866  	Category *LocalizableString `json:"category,omitempty"`
  1867  	// HTTPRequest - READ-ONLY; the HTTP request info. Usually includes the 'clientRequestId', 'clientIpAddress' (IP address of the user who initiated the event) and 'method' (HTTP method e.g. PUT).
  1868  	HTTPRequest *HTTPRequestInfo `json:"httpRequest,omitempty"`
  1869  	// Level - READ-ONLY; the event level. Possible values include: 'Critical', 'Error', 'Warning', 'Informational', 'Verbose'
  1870  	Level EventLevel `json:"level,omitempty"`
  1871  	// ResourceGroupName - READ-ONLY; the resource group name of the impacted resource.
  1872  	ResourceGroupName *string `json:"resourceGroupName,omitempty"`
  1873  	// ResourceProviderName - READ-ONLY; the resource provider name of the impacted resource.
  1874  	ResourceProviderName *LocalizableString `json:"resourceProviderName,omitempty"`
  1875  	// ResourceID - READ-ONLY; the resource uri that uniquely identifies the resource that caused this event.
  1876  	ResourceID *string `json:"resourceId,omitempty"`
  1877  	// ResourceType - READ-ONLY; the resource type
  1878  	ResourceType *LocalizableString `json:"resourceType,omitempty"`
  1879  	// OperationID - READ-ONLY; It is usually a GUID shared among the events corresponding to single operation. This value should not be confused with EventName.
  1880  	OperationID *string `json:"operationId,omitempty"`
  1881  	// OperationName - READ-ONLY; the operation name.
  1882  	OperationName *LocalizableString `json:"operationName,omitempty"`
  1883  	// Properties - READ-ONLY; the set of <Key, Value> pairs (usually a Dictionary<String, String>) that includes details about the event.
  1884  	Properties map[string]*string `json:"properties"`
  1885  	// Status - READ-ONLY; a string describing the status of the operation. Some typical values are: Started, In progress, Succeeded, Failed, Resolved.
  1886  	Status *LocalizableString `json:"status,omitempty"`
  1887  	// SubStatus - READ-ONLY; the event sub status. Most of the time, when included, this captures the HTTP status code of the REST call. Common values are: OK (HTTP Status Code: 200), Created (HTTP Status Code: 201), Accepted (HTTP Status Code: 202), No Content (HTTP Status Code: 204), Bad Request(HTTP Status Code: 400), Not Found (HTTP Status Code: 404), Conflict (HTTP Status Code: 409), Internal Server Error (HTTP Status Code: 500), Service Unavailable (HTTP Status Code:503), Gateway Timeout (HTTP Status Code: 504)
  1888  	SubStatus *LocalizableString `json:"subStatus,omitempty"`
  1889  	// EventTimestamp - READ-ONLY; the timestamp of when the event was generated by the Azure service processing the request corresponding the event. It in ISO 8601 format.
  1890  	EventTimestamp *date.Time `json:"eventTimestamp,omitempty"`
  1891  	// SubmissionTimestamp - READ-ONLY; the timestamp of when the event became available for querying via this API. It is in ISO 8601 format. This value should not be confused eventTimestamp. As there might be a delay between the occurrence time of the event, and the time that the event is submitted to the Azure logging infrastructure.
  1892  	SubmissionTimestamp *date.Time `json:"submissionTimestamp,omitempty"`
  1893  	// SubscriptionID - READ-ONLY; the Azure subscription Id usually a GUID.
  1894  	SubscriptionID *string `json:"subscriptionId,omitempty"`
  1895  	// TenantID - READ-ONLY; the Azure tenant Id
  1896  	TenantID *string `json:"tenantId,omitempty"`
  1897  }
  1898  
  1899  // MarshalJSON is the custom marshaler for EventData.
  1900  func (ed EventData) MarshalJSON() ([]byte, error) {
  1901  	objectMap := make(map[string]interface{})
  1902  	return json.Marshal(objectMap)
  1903  }
  1904  
  1905  // EventDataCollection represents collection of events.
  1906  type EventDataCollection struct {
  1907  	autorest.Response `json:"-"`
  1908  	// Value - this list that includes the Azure audit logs.
  1909  	Value *[]EventData `json:"value,omitempty"`
  1910  	// NextLink - Provides the link to retrieve the next set of events.
  1911  	NextLink *string `json:"nextLink,omitempty"`
  1912  }
  1913  
  1914  // EventDataCollectionIterator provides access to a complete listing of EventData values.
  1915  type EventDataCollectionIterator struct {
  1916  	i    int
  1917  	page EventDataCollectionPage
  1918  }
  1919  
  1920  // NextWithContext advances to the next value.  If there was an error making
  1921  // the request the iterator does not advance and the error is returned.
  1922  func (iter *EventDataCollectionIterator) NextWithContext(ctx context.Context) (err error) {
  1923  	if tracing.IsEnabled() {
  1924  		ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionIterator.NextWithContext")
  1925  		defer func() {
  1926  			sc := -1
  1927  			if iter.Response().Response.Response != nil {
  1928  				sc = iter.Response().Response.Response.StatusCode
  1929  			}
  1930  			tracing.EndSpan(ctx, sc, err)
  1931  		}()
  1932  	}
  1933  	iter.i++
  1934  	if iter.i < len(iter.page.Values()) {
  1935  		return nil
  1936  	}
  1937  	err = iter.page.NextWithContext(ctx)
  1938  	if err != nil {
  1939  		iter.i--
  1940  		return err
  1941  	}
  1942  	iter.i = 0
  1943  	return nil
  1944  }
  1945  
  1946  // Next advances to the next value.  If there was an error making
  1947  // the request the iterator does not advance and the error is returned.
  1948  // Deprecated: Use NextWithContext() instead.
  1949  func (iter *EventDataCollectionIterator) Next() error {
  1950  	return iter.NextWithContext(context.Background())
  1951  }
  1952  
  1953  // NotDone returns true if the enumeration should be started or is not yet complete.
  1954  func (iter EventDataCollectionIterator) NotDone() bool {
  1955  	return iter.page.NotDone() && iter.i < len(iter.page.Values())
  1956  }
  1957  
  1958  // Response returns the raw server response from the last page request.
  1959  func (iter EventDataCollectionIterator) Response() EventDataCollection {
  1960  	return iter.page.Response()
  1961  }
  1962  
  1963  // Value returns the current value or a zero-initialized value if the
  1964  // iterator has advanced beyond the end of the collection.
  1965  func (iter EventDataCollectionIterator) Value() EventData {
  1966  	if !iter.page.NotDone() {
  1967  		return EventData{}
  1968  	}
  1969  	return iter.page.Values()[iter.i]
  1970  }
  1971  
  1972  // Creates a new instance of the EventDataCollectionIterator type.
  1973  func NewEventDataCollectionIterator(page EventDataCollectionPage) EventDataCollectionIterator {
  1974  	return EventDataCollectionIterator{page: page}
  1975  }
  1976  
  1977  // IsEmpty returns true if the ListResult contains no values.
  1978  func (edc EventDataCollection) IsEmpty() bool {
  1979  	return edc.Value == nil || len(*edc.Value) == 0
  1980  }
  1981  
  1982  // hasNextLink returns true if the NextLink is not empty.
  1983  func (edc EventDataCollection) hasNextLink() bool {
  1984  	return edc.NextLink != nil && len(*edc.NextLink) != 0
  1985  }
  1986  
  1987  // eventDataCollectionPreparer prepares a request to retrieve the next set of results.
  1988  // It returns nil if no more results exist.
  1989  func (edc EventDataCollection) eventDataCollectionPreparer(ctx context.Context) (*http.Request, error) {
  1990  	if !edc.hasNextLink() {
  1991  		return nil, nil
  1992  	}
  1993  	return autorest.Prepare((&http.Request{}).WithContext(ctx),
  1994  		autorest.AsJSON(),
  1995  		autorest.AsGet(),
  1996  		autorest.WithBaseURL(to.String(edc.NextLink)))
  1997  }
  1998  
  1999  // EventDataCollectionPage contains a page of EventData values.
  2000  type EventDataCollectionPage struct {
  2001  	fn  func(context.Context, EventDataCollection) (EventDataCollection, error)
  2002  	edc EventDataCollection
  2003  }
  2004  
  2005  // NextWithContext advances to the next page of values.  If there was an error making
  2006  // the request the page does not advance and the error is returned.
  2007  func (page *EventDataCollectionPage) NextWithContext(ctx context.Context) (err error) {
  2008  	if tracing.IsEnabled() {
  2009  		ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionPage.NextWithContext")
  2010  		defer func() {
  2011  			sc := -1
  2012  			if page.Response().Response.Response != nil {
  2013  				sc = page.Response().Response.Response.StatusCode
  2014  			}
  2015  			tracing.EndSpan(ctx, sc, err)
  2016  		}()
  2017  	}
  2018  	for {
  2019  		next, err := page.fn(ctx, page.edc)
  2020  		if err != nil {
  2021  			return err
  2022  		}
  2023  		page.edc = next
  2024  		if !next.hasNextLink() || !next.IsEmpty() {
  2025  			break
  2026  		}
  2027  	}
  2028  	return nil
  2029  }
  2030  
  2031  // Next advances to the next page of values.  If there was an error making
  2032  // the request the page does not advance and the error is returned.
  2033  // Deprecated: Use NextWithContext() instead.
  2034  func (page *EventDataCollectionPage) Next() error {
  2035  	return page.NextWithContext(context.Background())
  2036  }
  2037  
  2038  // NotDone returns true if the page enumeration should be started or is not yet complete.
  2039  func (page EventDataCollectionPage) NotDone() bool {
  2040  	return !page.edc.IsEmpty()
  2041  }
  2042  
  2043  // Response returns the raw server response from the last page request.
  2044  func (page EventDataCollectionPage) Response() EventDataCollection {
  2045  	return page.edc
  2046  }
  2047  
  2048  // Values returns the slice of values for the current page or nil if there are no values.
  2049  func (page EventDataCollectionPage) Values() []EventData {
  2050  	if page.edc.IsEmpty() {
  2051  		return nil
  2052  	}
  2053  	return *page.edc.Value
  2054  }
  2055  
  2056  // Creates a new instance of the EventDataCollectionPage type.
  2057  func NewEventDataCollectionPage(cur EventDataCollection, getNextPage func(context.Context, EventDataCollection) (EventDataCollection, error)) EventDataCollectionPage {
  2058  	return EventDataCollectionPage{
  2059  		fn:  getNextPage,
  2060  		edc: cur,
  2061  	}
  2062  }
  2063  
  2064  // HTTPRequestInfo the Http request info.
  2065  type HTTPRequestInfo struct {
  2066  	// ClientRequestID - the client request id.
  2067  	ClientRequestID *string `json:"clientRequestId,omitempty"`
  2068  	// ClientIPAddress - the client Ip Address
  2069  	ClientIPAddress *string `json:"clientIpAddress,omitempty"`
  2070  	// Method - the Http request method.
  2071  	Method *string `json:"method,omitempty"`
  2072  	// URI - the Uri.
  2073  	URI *string `json:"uri,omitempty"`
  2074  }
  2075  
  2076  // Incident an alert incident indicates the activation status of an alert rule.
  2077  type Incident struct {
  2078  	autorest.Response `json:"-"`
  2079  	// Name - READ-ONLY; Incident name.
  2080  	Name *string `json:"name,omitempty"`
  2081  	// RuleName - READ-ONLY; Rule name that is associated with the incident.
  2082  	RuleName *string `json:"ruleName,omitempty"`
  2083  	// IsActive - READ-ONLY; A boolean to indicate whether the incident is active or resolved.
  2084  	IsActive *bool `json:"isActive,omitempty"`
  2085  	// ActivatedTime - READ-ONLY; The time at which the incident was activated in ISO8601 format.
  2086  	ActivatedTime *date.Time `json:"activatedTime,omitempty"`
  2087  	// ResolvedTime - READ-ONLY; The time at which the incident was resolved in ISO8601 format. If null, it means the incident is still active.
  2088  	ResolvedTime *date.Time `json:"resolvedTime,omitempty"`
  2089  }
  2090  
  2091  // MarshalJSON is the custom marshaler for Incident.
  2092  func (i Incident) MarshalJSON() ([]byte, error) {
  2093  	objectMap := make(map[string]interface{})
  2094  	return json.Marshal(objectMap)
  2095  }
  2096  
  2097  // IncidentListResult the List incidents operation response.
  2098  type IncidentListResult struct {
  2099  	autorest.Response `json:"-"`
  2100  	// Value - the incident collection.
  2101  	Value *[]Incident `json:"value,omitempty"`
  2102  }
  2103  
  2104  // ItsmReceiver an Itsm receiver.
  2105  type ItsmReceiver struct {
  2106  	// Name - The name of the Itsm receiver. Names must be unique across all receivers within an action group.
  2107  	Name *string `json:"name,omitempty"`
  2108  	// WorkspaceID - OMS LA instance identifier.
  2109  	WorkspaceID *string `json:"workspaceId,omitempty"`
  2110  	// ConnectionID - Unique identification of ITSM connection among multiple defined in above workspace.
  2111  	ConnectionID *string `json:"connectionId,omitempty"`
  2112  	// TicketConfiguration - JSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as well.
  2113  	TicketConfiguration *string `json:"ticketConfiguration,omitempty"`
  2114  	// Region - Region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope'
  2115  	Region *string `json:"region,omitempty"`
  2116  }
  2117  
  2118  // LocalizableString the localizable string class.
  2119  type LocalizableString struct {
  2120  	// Value - the invariant value.
  2121  	Value *string `json:"value,omitempty"`
  2122  	// LocalizedValue - the locale specific value.
  2123  	LocalizedValue *string `json:"localizedValue,omitempty"`
  2124  }
  2125  
  2126  // LocationThresholdRuleCondition a rule condition based on a certain number of locations failing.
  2127  type LocationThresholdRuleCondition struct {
  2128  	// WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day.
  2129  	WindowSize *string `json:"windowSize,omitempty"`
  2130  	// FailedLocationCount - the number of locations that must fail to activate the alert.
  2131  	FailedLocationCount *int32 `json:"failedLocationCount,omitempty"`
  2132  	// DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource.
  2133  	DataSource BasicRuleDataSource `json:"dataSource,omitempty"`
  2134  	// OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition'
  2135  	OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"`
  2136  }
  2137  
  2138  // MarshalJSON is the custom marshaler for LocationThresholdRuleCondition.
  2139  func (ltrc LocationThresholdRuleCondition) MarshalJSON() ([]byte, error) {
  2140  	ltrc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition
  2141  	objectMap := make(map[string]interface{})
  2142  	if ltrc.WindowSize != nil {
  2143  		objectMap["windowSize"] = ltrc.WindowSize
  2144  	}
  2145  	if ltrc.FailedLocationCount != nil {
  2146  		objectMap["failedLocationCount"] = ltrc.FailedLocationCount
  2147  	}
  2148  	objectMap["dataSource"] = ltrc.DataSource
  2149  	if ltrc.OdataType != "" {
  2150  		objectMap["odata.type"] = ltrc.OdataType
  2151  	}
  2152  	return json.Marshal(objectMap)
  2153  }
  2154  
  2155  // AsThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition.
  2156  func (ltrc LocationThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) {
  2157  	return nil, false
  2158  }
  2159  
  2160  // AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition.
  2161  func (ltrc LocationThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) {
  2162  	return &ltrc, true
  2163  }
  2164  
  2165  // AsManagementEventRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition.
  2166  func (ltrc LocationThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) {
  2167  	return nil, false
  2168  }
  2169  
  2170  // AsRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition.
  2171  func (ltrc LocationThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) {
  2172  	return nil, false
  2173  }
  2174  
  2175  // AsBasicRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition.
  2176  func (ltrc LocationThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) {
  2177  	return &ltrc, true
  2178  }
  2179  
  2180  // UnmarshalJSON is the custom unmarshaler for LocationThresholdRuleCondition struct.
  2181  func (ltrc *LocationThresholdRuleCondition) UnmarshalJSON(body []byte) error {
  2182  	var m map[string]*json.RawMessage
  2183  	err := json.Unmarshal(body, &m)
  2184  	if err != nil {
  2185  		return err
  2186  	}
  2187  	for k, v := range m {
  2188  		switch k {
  2189  		case "windowSize":
  2190  			if v != nil {
  2191  				var windowSize string
  2192  				err = json.Unmarshal(*v, &windowSize)
  2193  				if err != nil {
  2194  					return err
  2195  				}
  2196  				ltrc.WindowSize = &windowSize
  2197  			}
  2198  		case "failedLocationCount":
  2199  			if v != nil {
  2200  				var failedLocationCount int32
  2201  				err = json.Unmarshal(*v, &failedLocationCount)
  2202  				if err != nil {
  2203  					return err
  2204  				}
  2205  				ltrc.FailedLocationCount = &failedLocationCount
  2206  			}
  2207  		case "dataSource":
  2208  			if v != nil {
  2209  				dataSource, err := unmarshalBasicRuleDataSource(*v)
  2210  				if err != nil {
  2211  					return err
  2212  				}
  2213  				ltrc.DataSource = dataSource
  2214  			}
  2215  		case "odata.type":
  2216  			if v != nil {
  2217  				var odataType OdataTypeBasicRuleCondition
  2218  				err = json.Unmarshal(*v, &odataType)
  2219  				if err != nil {
  2220  					return err
  2221  				}
  2222  				ltrc.OdataType = odataType
  2223  			}
  2224  		}
  2225  	}
  2226  
  2227  	return nil
  2228  }
  2229  
  2230  // LogicAppReceiver a logic app receiver.
  2231  type LogicAppReceiver struct {
  2232  	// Name - The name of the logic app receiver. Names must be unique across all receivers within an action group.
  2233  	Name *string `json:"name,omitempty"`
  2234  	// ResourceID - The azure resource id of the logic app receiver.
  2235  	ResourceID *string `json:"resourceId,omitempty"`
  2236  	// CallbackURL - The callback url where http request sent to.
  2237  	CallbackURL *string `json:"callbackUrl,omitempty"`
  2238  }
  2239  
  2240  // LogMetricTrigger a log metrics trigger descriptor.
  2241  type LogMetricTrigger struct {
  2242  	// ThresholdOperator - Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual'
  2243  	ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"`
  2244  	// Threshold - The threshold of the metric trigger.
  2245  	Threshold *float64 `json:"threshold,omitempty"`
  2246  	// MetricTriggerType - Metric Trigger Type - 'Consecutive' or 'Total'. Possible values include: 'MetricTriggerTypeConsecutive', 'MetricTriggerTypeTotal'
  2247  	MetricTriggerType MetricTriggerType `json:"metricTriggerType,omitempty"`
  2248  	// MetricColumn - Evaluation of metric on a particular column
  2249  	MetricColumn *string `json:"metricColumn,omitempty"`
  2250  }
  2251  
  2252  // LogProfileCollection represents a collection of log profiles.
  2253  type LogProfileCollection struct {
  2254  	autorest.Response `json:"-"`
  2255  	// Value - the values of the log profiles.
  2256  	Value *[]LogProfileResource `json:"value,omitempty"`
  2257  }
  2258  
  2259  // LogProfileProperties the log profile properties.
  2260  type LogProfileProperties struct {
  2261  	// StorageAccountID - the resource id of the storage account to which you would like to send the Activity Log.
  2262  	StorageAccountID *string `json:"storageAccountId,omitempty"`
  2263  	// ServiceBusRuleID - The service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}'.
  2264  	ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"`
  2265  	// Locations - List of regions for which Activity Log events should be stored or streamed. It is a comma separated list of valid ARM locations including the 'global' location.
  2266  	Locations *[]string `json:"locations,omitempty"`
  2267  	// Categories - the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.'
  2268  	Categories *[]string `json:"categories,omitempty"`
  2269  	// RetentionPolicy - the retention policy for the events in the log.
  2270  	RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"`
  2271  }
  2272  
  2273  // LogProfileResource the log profile resource.
  2274  type LogProfileResource struct {
  2275  	autorest.Response `json:"-"`
  2276  	// LogProfileProperties - The log profile properties of the resource.
  2277  	*LogProfileProperties `json:"properties,omitempty"`
  2278  	// ID - READ-ONLY; Azure resource Id
  2279  	ID *string `json:"id,omitempty"`
  2280  	// Name - READ-ONLY; Azure resource name
  2281  	Name *string `json:"name,omitempty"`
  2282  	// Type - READ-ONLY; Azure resource type
  2283  	Type *string `json:"type,omitempty"`
  2284  	// Location - Resource location
  2285  	Location *string `json:"location,omitempty"`
  2286  	// Tags - Resource tags
  2287  	Tags map[string]*string `json:"tags"`
  2288  }
  2289  
  2290  // MarshalJSON is the custom marshaler for LogProfileResource.
  2291  func (lpr LogProfileResource) MarshalJSON() ([]byte, error) {
  2292  	objectMap := make(map[string]interface{})
  2293  	if lpr.LogProfileProperties != nil {
  2294  		objectMap["properties"] = lpr.LogProfileProperties
  2295  	}
  2296  	if lpr.Location != nil {
  2297  		objectMap["location"] = lpr.Location
  2298  	}
  2299  	if lpr.Tags != nil {
  2300  		objectMap["tags"] = lpr.Tags
  2301  	}
  2302  	return json.Marshal(objectMap)
  2303  }
  2304  
  2305  // UnmarshalJSON is the custom unmarshaler for LogProfileResource struct.
  2306  func (lpr *LogProfileResource) UnmarshalJSON(body []byte) error {
  2307  	var m map[string]*json.RawMessage
  2308  	err := json.Unmarshal(body, &m)
  2309  	if err != nil {
  2310  		return err
  2311  	}
  2312  	for k, v := range m {
  2313  		switch k {
  2314  		case "properties":
  2315  			if v != nil {
  2316  				var logProfileProperties LogProfileProperties
  2317  				err = json.Unmarshal(*v, &logProfileProperties)
  2318  				if err != nil {
  2319  					return err
  2320  				}
  2321  				lpr.LogProfileProperties = &logProfileProperties
  2322  			}
  2323  		case "id":
  2324  			if v != nil {
  2325  				var ID string
  2326  				err = json.Unmarshal(*v, &ID)
  2327  				if err != nil {
  2328  					return err
  2329  				}
  2330  				lpr.ID = &ID
  2331  			}
  2332  		case "name":
  2333  			if v != nil {
  2334  				var name string
  2335  				err = json.Unmarshal(*v, &name)
  2336  				if err != nil {
  2337  					return err
  2338  				}
  2339  				lpr.Name = &name
  2340  			}
  2341  		case "type":
  2342  			if v != nil {
  2343  				var typeVar string
  2344  				err = json.Unmarshal(*v, &typeVar)
  2345  				if err != nil {
  2346  					return err
  2347  				}
  2348  				lpr.Type = &typeVar
  2349  			}
  2350  		case "location":
  2351  			if v != nil {
  2352  				var location string
  2353  				err = json.Unmarshal(*v, &location)
  2354  				if err != nil {
  2355  					return err
  2356  				}
  2357  				lpr.Location = &location
  2358  			}
  2359  		case "tags":
  2360  			if v != nil {
  2361  				var tags map[string]*string
  2362  				err = json.Unmarshal(*v, &tags)
  2363  				if err != nil {
  2364  					return err
  2365  				}
  2366  				lpr.Tags = tags
  2367  			}
  2368  		}
  2369  	}
  2370  
  2371  	return nil
  2372  }
  2373  
  2374  // LogProfileResourcePatch the log profile resource for patch operations.
  2375  type LogProfileResourcePatch struct {
  2376  	// Tags - Resource tags
  2377  	Tags map[string]*string `json:"tags"`
  2378  	// LogProfileProperties - The log profile properties for an update operation.
  2379  	*LogProfileProperties `json:"properties,omitempty"`
  2380  }
  2381  
  2382  // MarshalJSON is the custom marshaler for LogProfileResourcePatch.
  2383  func (lprp LogProfileResourcePatch) MarshalJSON() ([]byte, error) {
  2384  	objectMap := make(map[string]interface{})
  2385  	if lprp.Tags != nil {
  2386  		objectMap["tags"] = lprp.Tags
  2387  	}
  2388  	if lprp.LogProfileProperties != nil {
  2389  		objectMap["properties"] = lprp.LogProfileProperties
  2390  	}
  2391  	return json.Marshal(objectMap)
  2392  }
  2393  
  2394  // UnmarshalJSON is the custom unmarshaler for LogProfileResourcePatch struct.
  2395  func (lprp *LogProfileResourcePatch) UnmarshalJSON(body []byte) error {
  2396  	var m map[string]*json.RawMessage
  2397  	err := json.Unmarshal(body, &m)
  2398  	if err != nil {
  2399  		return err
  2400  	}
  2401  	for k, v := range m {
  2402  		switch k {
  2403  		case "tags":
  2404  			if v != nil {
  2405  				var tags map[string]*string
  2406  				err = json.Unmarshal(*v, &tags)
  2407  				if err != nil {
  2408  					return err
  2409  				}
  2410  				lprp.Tags = tags
  2411  			}
  2412  		case "properties":
  2413  			if v != nil {
  2414  				var logProfileProperties LogProfileProperties
  2415  				err = json.Unmarshal(*v, &logProfileProperties)
  2416  				if err != nil {
  2417  					return err
  2418  				}
  2419  				lprp.LogProfileProperties = &logProfileProperties
  2420  			}
  2421  		}
  2422  	}
  2423  
  2424  	return nil
  2425  }
  2426  
  2427  // LogSearchRule log Search Rule Definition
  2428  type LogSearchRule struct {
  2429  	// Description - The description of the Log Search rule.
  2430  	Description *string `json:"description,omitempty"`
  2431  	// Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'True', 'False'
  2432  	Enabled Enabled `json:"enabled,omitempty"`
  2433  	// LastUpdatedTime - READ-ONLY; Last time the rule was updated in IS08601 format.
  2434  	LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"`
  2435  	// ProvisioningState - READ-ONLY; Provisioning state of the scheduled query rule. Possible values include: 'Succeeded', 'Deploying', 'Canceled', 'Failed'
  2436  	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
  2437  	// Source - Data Source against which rule will Query Data
  2438  	Source *Source `json:"source,omitempty"`
  2439  	// Schedule - Schedule (Frequency, Time Window) for rule. Required for action type - AlertingAction
  2440  	Schedule *Schedule `json:"schedule,omitempty"`
  2441  	// Action - Action needs to be taken on rule execution.
  2442  	Action BasicAction `json:"action,omitempty"`
  2443  }
  2444  
  2445  // MarshalJSON is the custom marshaler for LogSearchRule.
  2446  func (lsr LogSearchRule) MarshalJSON() ([]byte, error) {
  2447  	objectMap := make(map[string]interface{})
  2448  	if lsr.Description != nil {
  2449  		objectMap["description"] = lsr.Description
  2450  	}
  2451  	if lsr.Enabled != "" {
  2452  		objectMap["enabled"] = lsr.Enabled
  2453  	}
  2454  	if lsr.Source != nil {
  2455  		objectMap["source"] = lsr.Source
  2456  	}
  2457  	if lsr.Schedule != nil {
  2458  		objectMap["schedule"] = lsr.Schedule
  2459  	}
  2460  	objectMap["action"] = lsr.Action
  2461  	return json.Marshal(objectMap)
  2462  }
  2463  
  2464  // UnmarshalJSON is the custom unmarshaler for LogSearchRule struct.
  2465  func (lsr *LogSearchRule) UnmarshalJSON(body []byte) error {
  2466  	var m map[string]*json.RawMessage
  2467  	err := json.Unmarshal(body, &m)
  2468  	if err != nil {
  2469  		return err
  2470  	}
  2471  	for k, v := range m {
  2472  		switch k {
  2473  		case "description":
  2474  			if v != nil {
  2475  				var description string
  2476  				err = json.Unmarshal(*v, &description)
  2477  				if err != nil {
  2478  					return err
  2479  				}
  2480  				lsr.Description = &description
  2481  			}
  2482  		case "enabled":
  2483  			if v != nil {
  2484  				var enabled Enabled
  2485  				err = json.Unmarshal(*v, &enabled)
  2486  				if err != nil {
  2487  					return err
  2488  				}
  2489  				lsr.Enabled = enabled
  2490  			}
  2491  		case "lastUpdatedTime":
  2492  			if v != nil {
  2493  				var lastUpdatedTime date.Time
  2494  				err = json.Unmarshal(*v, &lastUpdatedTime)
  2495  				if err != nil {
  2496  					return err
  2497  				}
  2498  				lsr.LastUpdatedTime = &lastUpdatedTime
  2499  			}
  2500  		case "provisioningState":
  2501  			if v != nil {
  2502  				var provisioningState ProvisioningState
  2503  				err = json.Unmarshal(*v, &provisioningState)
  2504  				if err != nil {
  2505  					return err
  2506  				}
  2507  				lsr.ProvisioningState = provisioningState
  2508  			}
  2509  		case "source":
  2510  			if v != nil {
  2511  				var source Source
  2512  				err = json.Unmarshal(*v, &source)
  2513  				if err != nil {
  2514  					return err
  2515  				}
  2516  				lsr.Source = &source
  2517  			}
  2518  		case "schedule":
  2519  			if v != nil {
  2520  				var schedule Schedule
  2521  				err = json.Unmarshal(*v, &schedule)
  2522  				if err != nil {
  2523  					return err
  2524  				}
  2525  				lsr.Schedule = &schedule
  2526  			}
  2527  		case "action":
  2528  			if v != nil {
  2529  				action, err := unmarshalBasicAction(*v)
  2530  				if err != nil {
  2531  					return err
  2532  				}
  2533  				lsr.Action = action
  2534  			}
  2535  		}
  2536  	}
  2537  
  2538  	return nil
  2539  }
  2540  
  2541  // LogSearchRulePatch log Search Rule Definition for Patching
  2542  type LogSearchRulePatch struct {
  2543  	// Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'True', 'False'
  2544  	Enabled Enabled `json:"enabled,omitempty"`
  2545  }
  2546  
  2547  // LogSearchRuleResource the Log Search Rule resource.
  2548  type LogSearchRuleResource struct {
  2549  	autorest.Response `json:"-"`
  2550  	// LogSearchRule - The rule properties of the resource.
  2551  	*LogSearchRule `json:"properties,omitempty"`
  2552  	// ID - READ-ONLY; Azure resource Id
  2553  	ID *string `json:"id,omitempty"`
  2554  	// Name - READ-ONLY; Azure resource name
  2555  	Name *string `json:"name,omitempty"`
  2556  	// Type - READ-ONLY; Azure resource type
  2557  	Type *string `json:"type,omitempty"`
  2558  	// Location - Resource location
  2559  	Location *string `json:"location,omitempty"`
  2560  	// Tags - Resource tags
  2561  	Tags map[string]*string `json:"tags"`
  2562  }
  2563  
  2564  // MarshalJSON is the custom marshaler for LogSearchRuleResource.
  2565  func (lsrr LogSearchRuleResource) MarshalJSON() ([]byte, error) {
  2566  	objectMap := make(map[string]interface{})
  2567  	if lsrr.LogSearchRule != nil {
  2568  		objectMap["properties"] = lsrr.LogSearchRule
  2569  	}
  2570  	if lsrr.Location != nil {
  2571  		objectMap["location"] = lsrr.Location
  2572  	}
  2573  	if lsrr.Tags != nil {
  2574  		objectMap["tags"] = lsrr.Tags
  2575  	}
  2576  	return json.Marshal(objectMap)
  2577  }
  2578  
  2579  // UnmarshalJSON is the custom unmarshaler for LogSearchRuleResource struct.
  2580  func (lsrr *LogSearchRuleResource) UnmarshalJSON(body []byte) error {
  2581  	var m map[string]*json.RawMessage
  2582  	err := json.Unmarshal(body, &m)
  2583  	if err != nil {
  2584  		return err
  2585  	}
  2586  	for k, v := range m {
  2587  		switch k {
  2588  		case "properties":
  2589  			if v != nil {
  2590  				var logSearchRule LogSearchRule
  2591  				err = json.Unmarshal(*v, &logSearchRule)
  2592  				if err != nil {
  2593  					return err
  2594  				}
  2595  				lsrr.LogSearchRule = &logSearchRule
  2596  			}
  2597  		case "id":
  2598  			if v != nil {
  2599  				var ID string
  2600  				err = json.Unmarshal(*v, &ID)
  2601  				if err != nil {
  2602  					return err
  2603  				}
  2604  				lsrr.ID = &ID
  2605  			}
  2606  		case "name":
  2607  			if v != nil {
  2608  				var name string
  2609  				err = json.Unmarshal(*v, &name)
  2610  				if err != nil {
  2611  					return err
  2612  				}
  2613  				lsrr.Name = &name
  2614  			}
  2615  		case "type":
  2616  			if v != nil {
  2617  				var typeVar string
  2618  				err = json.Unmarshal(*v, &typeVar)
  2619  				if err != nil {
  2620  					return err
  2621  				}
  2622  				lsrr.Type = &typeVar
  2623  			}
  2624  		case "location":
  2625  			if v != nil {
  2626  				var location string
  2627  				err = json.Unmarshal(*v, &location)
  2628  				if err != nil {
  2629  					return err
  2630  				}
  2631  				lsrr.Location = &location
  2632  			}
  2633  		case "tags":
  2634  			if v != nil {
  2635  				var tags map[string]*string
  2636  				err = json.Unmarshal(*v, &tags)
  2637  				if err != nil {
  2638  					return err
  2639  				}
  2640  				lsrr.Tags = tags
  2641  			}
  2642  		}
  2643  	}
  2644  
  2645  	return nil
  2646  }
  2647  
  2648  // LogSearchRuleResourceCollection represents a collection of Log Search rule resources.
  2649  type LogSearchRuleResourceCollection struct {
  2650  	autorest.Response `json:"-"`
  2651  	// Value - The values for the Log Search Rule resources.
  2652  	Value *[]LogSearchRuleResource `json:"value,omitempty"`
  2653  }
  2654  
  2655  // LogSearchRuleResourcePatch the log search rule resource for patch operations.
  2656  type LogSearchRuleResourcePatch struct {
  2657  	// Tags - Resource tags
  2658  	Tags map[string]*string `json:"tags"`
  2659  	// LogSearchRulePatch - The log search rule properties of the resource.
  2660  	*LogSearchRulePatch `json:"properties,omitempty"`
  2661  }
  2662  
  2663  // MarshalJSON is the custom marshaler for LogSearchRuleResourcePatch.
  2664  func (lsrrp LogSearchRuleResourcePatch) MarshalJSON() ([]byte, error) {
  2665  	objectMap := make(map[string]interface{})
  2666  	if lsrrp.Tags != nil {
  2667  		objectMap["tags"] = lsrrp.Tags
  2668  	}
  2669  	if lsrrp.LogSearchRulePatch != nil {
  2670  		objectMap["properties"] = lsrrp.LogSearchRulePatch
  2671  	}
  2672  	return json.Marshal(objectMap)
  2673  }
  2674  
  2675  // UnmarshalJSON is the custom unmarshaler for LogSearchRuleResourcePatch struct.
  2676  func (lsrrp *LogSearchRuleResourcePatch) UnmarshalJSON(body []byte) error {
  2677  	var m map[string]*json.RawMessage
  2678  	err := json.Unmarshal(body, &m)
  2679  	if err != nil {
  2680  		return err
  2681  	}
  2682  	for k, v := range m {
  2683  		switch k {
  2684  		case "tags":
  2685  			if v != nil {
  2686  				var tags map[string]*string
  2687  				err = json.Unmarshal(*v, &tags)
  2688  				if err != nil {
  2689  					return err
  2690  				}
  2691  				lsrrp.Tags = tags
  2692  			}
  2693  		case "properties":
  2694  			if v != nil {
  2695  				var logSearchRulePatch LogSearchRulePatch
  2696  				err = json.Unmarshal(*v, &logSearchRulePatch)
  2697  				if err != nil {
  2698  					return err
  2699  				}
  2700  				lsrrp.LogSearchRulePatch = &logSearchRulePatch
  2701  			}
  2702  		}
  2703  	}
  2704  
  2705  	return nil
  2706  }
  2707  
  2708  // LogSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log.
  2709  type LogSettings struct {
  2710  	// Category - Name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation.
  2711  	Category *string `json:"category,omitempty"`
  2712  	// Enabled - a value indicating whether this log is enabled.
  2713  	Enabled *bool `json:"enabled,omitempty"`
  2714  	// RetentionPolicy - the retention policy for this log.
  2715  	RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"`
  2716  }
  2717  
  2718  // LogToMetricAction specify action need to be taken when rule type is converting log to metric
  2719  type LogToMetricAction struct {
  2720  	// Criteria - Criteria of Metric
  2721  	Criteria *[]Criteria `json:"criteria,omitempty"`
  2722  	// OdataType - Possible values include: 'OdataTypeAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction'
  2723  	OdataType OdataTypeBasicAction `json:"odata.type,omitempty"`
  2724  }
  2725  
  2726  // MarshalJSON is the custom marshaler for LogToMetricAction.
  2727  func (ltma LogToMetricAction) MarshalJSON() ([]byte, error) {
  2728  	ltma.OdataType = OdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction
  2729  	objectMap := make(map[string]interface{})
  2730  	if ltma.Criteria != nil {
  2731  		objectMap["criteria"] = ltma.Criteria
  2732  	}
  2733  	if ltma.OdataType != "" {
  2734  		objectMap["odata.type"] = ltma.OdataType
  2735  	}
  2736  	return json.Marshal(objectMap)
  2737  }
  2738  
  2739  // AsAlertingAction is the BasicAction implementation for LogToMetricAction.
  2740  func (ltma LogToMetricAction) AsAlertingAction() (*AlertingAction, bool) {
  2741  	return nil, false
  2742  }
  2743  
  2744  // AsLogToMetricAction is the BasicAction implementation for LogToMetricAction.
  2745  func (ltma LogToMetricAction) AsLogToMetricAction() (*LogToMetricAction, bool) {
  2746  	return &ltma, true
  2747  }
  2748  
  2749  // AsAction is the BasicAction implementation for LogToMetricAction.
  2750  func (ltma LogToMetricAction) AsAction() (*Action, bool) {
  2751  	return nil, false
  2752  }
  2753  
  2754  // AsBasicAction is the BasicAction implementation for LogToMetricAction.
  2755  func (ltma LogToMetricAction) AsBasicAction() (BasicAction, bool) {
  2756  	return &ltma, true
  2757  }
  2758  
  2759  // ManagementEventAggregationCondition how the data that is collected should be combined over time.
  2760  type ManagementEventAggregationCondition struct {
  2761  	// Operator - the condition operator. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual'
  2762  	Operator ConditionOperator `json:"operator,omitempty"`
  2763  	// Threshold - The threshold value that activates the alert.
  2764  	Threshold *float64 `json:"threshold,omitempty"`
  2765  	// WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day.
  2766  	WindowSize *string `json:"windowSize,omitempty"`
  2767  }
  2768  
  2769  // ManagementEventRuleCondition a management event rule condition.
  2770  type ManagementEventRuleCondition struct {
  2771  	// Aggregation - How the data that is collected should be combined over time and when the alert is activated. Note that for management event alerts aggregation is optional – if it is not provided then any event will cause the alert to activate.
  2772  	Aggregation *ManagementEventAggregationCondition `json:"aggregation,omitempty"`
  2773  	// DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource.
  2774  	DataSource BasicRuleDataSource `json:"dataSource,omitempty"`
  2775  	// OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition'
  2776  	OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"`
  2777  }
  2778  
  2779  // MarshalJSON is the custom marshaler for ManagementEventRuleCondition.
  2780  func (merc ManagementEventRuleCondition) MarshalJSON() ([]byte, error) {
  2781  	merc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition
  2782  	objectMap := make(map[string]interface{})
  2783  	if merc.Aggregation != nil {
  2784  		objectMap["aggregation"] = merc.Aggregation
  2785  	}
  2786  	objectMap["dataSource"] = merc.DataSource
  2787  	if merc.OdataType != "" {
  2788  		objectMap["odata.type"] = merc.OdataType
  2789  	}
  2790  	return json.Marshal(objectMap)
  2791  }
  2792  
  2793  // AsThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition.
  2794  func (merc ManagementEventRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) {
  2795  	return nil, false
  2796  }
  2797  
  2798  // AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition.
  2799  func (merc ManagementEventRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) {
  2800  	return nil, false
  2801  }
  2802  
  2803  // AsManagementEventRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition.
  2804  func (merc ManagementEventRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) {
  2805  	return &merc, true
  2806  }
  2807  
  2808  // AsRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition.
  2809  func (merc ManagementEventRuleCondition) AsRuleCondition() (*RuleCondition, bool) {
  2810  	return nil, false
  2811  }
  2812  
  2813  // AsBasicRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition.
  2814  func (merc ManagementEventRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) {
  2815  	return &merc, true
  2816  }
  2817  
  2818  // UnmarshalJSON is the custom unmarshaler for ManagementEventRuleCondition struct.
  2819  func (merc *ManagementEventRuleCondition) UnmarshalJSON(body []byte) error {
  2820  	var m map[string]*json.RawMessage
  2821  	err := json.Unmarshal(body, &m)
  2822  	if err != nil {
  2823  		return err
  2824  	}
  2825  	for k, v := range m {
  2826  		switch k {
  2827  		case "aggregation":
  2828  			if v != nil {
  2829  				var aggregation ManagementEventAggregationCondition
  2830  				err = json.Unmarshal(*v, &aggregation)
  2831  				if err != nil {
  2832  					return err
  2833  				}
  2834  				merc.Aggregation = &aggregation
  2835  			}
  2836  		case "dataSource":
  2837  			if v != nil {
  2838  				dataSource, err := unmarshalBasicRuleDataSource(*v)
  2839  				if err != nil {
  2840  					return err
  2841  				}
  2842  				merc.DataSource = dataSource
  2843  			}
  2844  		case "odata.type":
  2845  			if v != nil {
  2846  				var odataType OdataTypeBasicRuleCondition
  2847  				err = json.Unmarshal(*v, &odataType)
  2848  				if err != nil {
  2849  					return err
  2850  				}
  2851  				merc.OdataType = odataType
  2852  			}
  2853  		}
  2854  	}
  2855  
  2856  	return nil
  2857  }
  2858  
  2859  // MetadataValue represents a metric metadata value.
  2860  type MetadataValue struct {
  2861  	// Name - the name of the metadata.
  2862  	Name *LocalizableString `json:"name,omitempty"`
  2863  	// Value - the value of the metadata.
  2864  	Value *string `json:"value,omitempty"`
  2865  }
  2866  
  2867  // Metric the result data of a query.
  2868  type Metric struct {
  2869  	// ID - the metric Id.
  2870  	ID *string `json:"id,omitempty"`
  2871  	// Type - the resource type of the metric resource.
  2872  	Type *string `json:"type,omitempty"`
  2873  	// Name - the name and the display name of the metric, i.e. it is localizable string.
  2874  	Name *LocalizableString `json:"name,omitempty"`
  2875  	// Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond'
  2876  	Unit Unit `json:"unit,omitempty"`
  2877  	// Timeseries - the time series returned when a data query is performed.
  2878  	Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"`
  2879  }
  2880  
  2881  // MetricAlertAction an alert action.
  2882  type MetricAlertAction struct {
  2883  	// ActionGroupID - the id of the action group to use.
  2884  	ActionGroupID *string `json:"actionGroupId,omitempty"`
  2885  	// WebHookProperties - The properties of a webhook object.
  2886  	WebHookProperties map[string]*string `json:"webHookProperties"`
  2887  }
  2888  
  2889  // MarshalJSON is the custom marshaler for MetricAlertAction.
  2890  func (maa MetricAlertAction) MarshalJSON() ([]byte, error) {
  2891  	objectMap := make(map[string]interface{})
  2892  	if maa.ActionGroupID != nil {
  2893  		objectMap["actionGroupId"] = maa.ActionGroupID
  2894  	}
  2895  	if maa.WebHookProperties != nil {
  2896  		objectMap["webHookProperties"] = maa.WebHookProperties
  2897  	}
  2898  	return json.Marshal(objectMap)
  2899  }
  2900  
  2901  // BasicMetricAlertCriteria the rule criteria that defines the conditions of the alert rule.
  2902  type BasicMetricAlertCriteria interface {
  2903  	AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool)
  2904  	AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool)
  2905  	AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool)
  2906  	AsMetricAlertCriteria() (*MetricAlertCriteria, bool)
  2907  }
  2908  
  2909  // MetricAlertCriteria the rule criteria that defines the conditions of the alert rule.
  2910  type MetricAlertCriteria struct {
  2911  	// AdditionalProperties - Unmatched properties from the message are deserialized this collection
  2912  	AdditionalProperties map[string]interface{} `json:""`
  2913  	// OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria'
  2914  	OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"`
  2915  }
  2916  
  2917  func unmarshalBasicMetricAlertCriteria(body []byte) (BasicMetricAlertCriteria, error) {
  2918  	var m map[string]interface{}
  2919  	err := json.Unmarshal(body, &m)
  2920  	if err != nil {
  2921  		return nil, err
  2922  	}
  2923  
  2924  	switch m["odata.type"] {
  2925  	case string(OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria):
  2926  		var masrmmc MetricAlertSingleResourceMultipleMetricCriteria
  2927  		err := json.Unmarshal(body, &masrmmc)
  2928  		return masrmmc, err
  2929  	case string(OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria):
  2930  		var wlac WebtestLocationAvailabilityCriteria
  2931  		err := json.Unmarshal(body, &wlac)
  2932  		return wlac, err
  2933  	case string(OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria):
  2934  		var mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria
  2935  		err := json.Unmarshal(body, &mamrmmc)
  2936  		return mamrmmc, err
  2937  	default:
  2938  		var mac MetricAlertCriteria
  2939  		err := json.Unmarshal(body, &mac)
  2940  		return mac, err
  2941  	}
  2942  }
  2943  func unmarshalBasicMetricAlertCriteriaArray(body []byte) ([]BasicMetricAlertCriteria, error) {
  2944  	var rawMessages []*json.RawMessage
  2945  	err := json.Unmarshal(body, &rawMessages)
  2946  	if err != nil {
  2947  		return nil, err
  2948  	}
  2949  
  2950  	macArray := make([]BasicMetricAlertCriteria, len(rawMessages))
  2951  
  2952  	for index, rawMessage := range rawMessages {
  2953  		mac, err := unmarshalBasicMetricAlertCriteria(*rawMessage)
  2954  		if err != nil {
  2955  			return nil, err
  2956  		}
  2957  		macArray[index] = mac
  2958  	}
  2959  	return macArray, nil
  2960  }
  2961  
  2962  // MarshalJSON is the custom marshaler for MetricAlertCriteria.
  2963  func (mac MetricAlertCriteria) MarshalJSON() ([]byte, error) {
  2964  	mac.OdataType = OdataTypeMetricAlertCriteria
  2965  	objectMap := make(map[string]interface{})
  2966  	if mac.OdataType != "" {
  2967  		objectMap["odata.type"] = mac.OdataType
  2968  	}
  2969  	for k, v := range mac.AdditionalProperties {
  2970  		objectMap[k] = v
  2971  	}
  2972  	return json.Marshal(objectMap)
  2973  }
  2974  
  2975  // AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria.
  2976  func (mac MetricAlertCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) {
  2977  	return nil, false
  2978  }
  2979  
  2980  // AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria.
  2981  func (mac MetricAlertCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) {
  2982  	return nil, false
  2983  }
  2984  
  2985  // AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria.
  2986  func (mac MetricAlertCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) {
  2987  	return nil, false
  2988  }
  2989  
  2990  // AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria.
  2991  func (mac MetricAlertCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) {
  2992  	return &mac, true
  2993  }
  2994  
  2995  // AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria.
  2996  func (mac MetricAlertCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) {
  2997  	return &mac, true
  2998  }
  2999  
  3000  // UnmarshalJSON is the custom unmarshaler for MetricAlertCriteria struct.
  3001  func (mac *MetricAlertCriteria) UnmarshalJSON(body []byte) error {
  3002  	var m map[string]*json.RawMessage
  3003  	err := json.Unmarshal(body, &m)
  3004  	if err != nil {
  3005  		return err
  3006  	}
  3007  	for k, v := range m {
  3008  		switch k {
  3009  		default:
  3010  			if v != nil {
  3011  				var additionalProperties interface{}
  3012  				err = json.Unmarshal(*v, &additionalProperties)
  3013  				if err != nil {
  3014  					return err
  3015  				}
  3016  				if mac.AdditionalProperties == nil {
  3017  					mac.AdditionalProperties = make(map[string]interface{})
  3018  				}
  3019  				mac.AdditionalProperties[k] = additionalProperties
  3020  			}
  3021  		case "odata.type":
  3022  			if v != nil {
  3023  				var odataType OdataTypeBasicMetricAlertCriteria
  3024  				err = json.Unmarshal(*v, &odataType)
  3025  				if err != nil {
  3026  					return err
  3027  				}
  3028  				mac.OdataType = odataType
  3029  			}
  3030  		}
  3031  	}
  3032  
  3033  	return nil
  3034  }
  3035  
  3036  // MetricAlertMultipleResourceMultipleMetricCriteria specifies the metric alert criteria for multiple
  3037  // resource that has multiple metric criteria.
  3038  type MetricAlertMultipleResourceMultipleMetricCriteria struct {
  3039  	// AllOf - the list of multiple metric criteria for this 'all of' operation.
  3040  	AllOf *[]BasicMultiMetricCriteria `json:"allOf,omitempty"`
  3041  	// AdditionalProperties - Unmatched properties from the message are deserialized this collection
  3042  	AdditionalProperties map[string]interface{} `json:""`
  3043  	// OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria'
  3044  	OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"`
  3045  }
  3046  
  3047  // MarshalJSON is the custom marshaler for MetricAlertMultipleResourceMultipleMetricCriteria.
  3048  func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) {
  3049  	mamrmmc.OdataType = OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria
  3050  	objectMap := make(map[string]interface{})
  3051  	if mamrmmc.AllOf != nil {
  3052  		objectMap["allOf"] = mamrmmc.AllOf
  3053  	}
  3054  	if mamrmmc.OdataType != "" {
  3055  		objectMap["odata.type"] = mamrmmc.OdataType
  3056  	}
  3057  	for k, v := range mamrmmc.AdditionalProperties {
  3058  		objectMap[k] = v
  3059  	}
  3060  	return json.Marshal(objectMap)
  3061  }
  3062  
  3063  // AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria.
  3064  func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) {
  3065  	return nil, false
  3066  }
  3067  
  3068  // AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria.
  3069  func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) {
  3070  	return nil, false
  3071  }
  3072  
  3073  // AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria.
  3074  func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) {
  3075  	return &mamrmmc, true
  3076  }
  3077  
  3078  // AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria.
  3079  func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) {
  3080  	return nil, false
  3081  }
  3082  
  3083  // AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria.
  3084  func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) {
  3085  	return &mamrmmc, true
  3086  }
  3087  
  3088  // UnmarshalJSON is the custom unmarshaler for MetricAlertMultipleResourceMultipleMetricCriteria struct.
  3089  func (mamrmmc *MetricAlertMultipleResourceMultipleMetricCriteria) UnmarshalJSON(body []byte) error {
  3090  	var m map[string]*json.RawMessage
  3091  	err := json.Unmarshal(body, &m)
  3092  	if err != nil {
  3093  		return err
  3094  	}
  3095  	for k, v := range m {
  3096  		switch k {
  3097  		case "allOf":
  3098  			if v != nil {
  3099  				allOf, err := unmarshalBasicMultiMetricCriteriaArray(*v)
  3100  				if err != nil {
  3101  					return err
  3102  				}
  3103  				mamrmmc.AllOf = &allOf
  3104  			}
  3105  		default:
  3106  			if v != nil {
  3107  				var additionalProperties interface{}
  3108  				err = json.Unmarshal(*v, &additionalProperties)
  3109  				if err != nil {
  3110  					return err
  3111  				}
  3112  				if mamrmmc.AdditionalProperties == nil {
  3113  					mamrmmc.AdditionalProperties = make(map[string]interface{})
  3114  				}
  3115  				mamrmmc.AdditionalProperties[k] = additionalProperties
  3116  			}
  3117  		case "odata.type":
  3118  			if v != nil {
  3119  				var odataType OdataTypeBasicMetricAlertCriteria
  3120  				err = json.Unmarshal(*v, &odataType)
  3121  				if err != nil {
  3122  					return err
  3123  				}
  3124  				mamrmmc.OdataType = odataType
  3125  			}
  3126  		}
  3127  	}
  3128  
  3129  	return nil
  3130  }
  3131  
  3132  // MetricAlertProperties an alert rule.
  3133  type MetricAlertProperties struct {
  3134  	// Description - the description of the metric alert that will be included in the alert email.
  3135  	Description *string `json:"description,omitempty"`
  3136  	// Severity - Alert severity {0, 1, 2, 3, 4}
  3137  	Severity *int32 `json:"severity,omitempty"`
  3138  	// Enabled - the flag that indicates whether the metric alert is enabled.
  3139  	Enabled *bool `json:"enabled,omitempty"`
  3140  	// Scopes - the list of resource id's that this metric alert is scoped to.
  3141  	Scopes *[]string `json:"scopes,omitempty"`
  3142  	// EvaluationFrequency - how often the metric alert is evaluated represented in ISO 8601 duration format.
  3143  	EvaluationFrequency *string `json:"evaluationFrequency,omitempty"`
  3144  	// WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold.
  3145  	WindowSize *string `json:"windowSize,omitempty"`
  3146  	// TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria.
  3147  	TargetResourceType *string `json:"targetResourceType,omitempty"`
  3148  	// TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria.
  3149  	TargetResourceRegion *string `json:"targetResourceRegion,omitempty"`
  3150  	// Criteria - defines the specific alert criteria information.
  3151  	Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"`
  3152  	// AutoMitigate - the flag that indicates whether the alert should be auto resolved or not. The default is true.
  3153  	AutoMitigate *bool `json:"autoMitigate,omitempty"`
  3154  	// Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved.
  3155  	Actions *[]MetricAlertAction `json:"actions,omitempty"`
  3156  	// LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format.
  3157  	LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"`
  3158  }
  3159  
  3160  // MarshalJSON is the custom marshaler for MetricAlertProperties.
  3161  func (mapVar MetricAlertProperties) MarshalJSON() ([]byte, error) {
  3162  	objectMap := make(map[string]interface{})
  3163  	if mapVar.Description != nil {
  3164  		objectMap["description"] = mapVar.Description
  3165  	}
  3166  	if mapVar.Severity != nil {
  3167  		objectMap["severity"] = mapVar.Severity
  3168  	}
  3169  	if mapVar.Enabled != nil {
  3170  		objectMap["enabled"] = mapVar.Enabled
  3171  	}
  3172  	if mapVar.Scopes != nil {
  3173  		objectMap["scopes"] = mapVar.Scopes
  3174  	}
  3175  	if mapVar.EvaluationFrequency != nil {
  3176  		objectMap["evaluationFrequency"] = mapVar.EvaluationFrequency
  3177  	}
  3178  	if mapVar.WindowSize != nil {
  3179  		objectMap["windowSize"] = mapVar.WindowSize
  3180  	}
  3181  	if mapVar.TargetResourceType != nil {
  3182  		objectMap["targetResourceType"] = mapVar.TargetResourceType
  3183  	}
  3184  	if mapVar.TargetResourceRegion != nil {
  3185  		objectMap["targetResourceRegion"] = mapVar.TargetResourceRegion
  3186  	}
  3187  	objectMap["criteria"] = mapVar.Criteria
  3188  	if mapVar.AutoMitigate != nil {
  3189  		objectMap["autoMitigate"] = mapVar.AutoMitigate
  3190  	}
  3191  	if mapVar.Actions != nil {
  3192  		objectMap["actions"] = mapVar.Actions
  3193  	}
  3194  	return json.Marshal(objectMap)
  3195  }
  3196  
  3197  // UnmarshalJSON is the custom unmarshaler for MetricAlertProperties struct.
  3198  func (mapVar *MetricAlertProperties) UnmarshalJSON(body []byte) error {
  3199  	var m map[string]*json.RawMessage
  3200  	err := json.Unmarshal(body, &m)
  3201  	if err != nil {
  3202  		return err
  3203  	}
  3204  	for k, v := range m {
  3205  		switch k {
  3206  		case "description":
  3207  			if v != nil {
  3208  				var description string
  3209  				err = json.Unmarshal(*v, &description)
  3210  				if err != nil {
  3211  					return err
  3212  				}
  3213  				mapVar.Description = &description
  3214  			}
  3215  		case "severity":
  3216  			if v != nil {
  3217  				var severity int32
  3218  				err = json.Unmarshal(*v, &severity)
  3219  				if err != nil {
  3220  					return err
  3221  				}
  3222  				mapVar.Severity = &severity
  3223  			}
  3224  		case "enabled":
  3225  			if v != nil {
  3226  				var enabled bool
  3227  				err = json.Unmarshal(*v, &enabled)
  3228  				if err != nil {
  3229  					return err
  3230  				}
  3231  				mapVar.Enabled = &enabled
  3232  			}
  3233  		case "scopes":
  3234  			if v != nil {
  3235  				var scopes []string
  3236  				err = json.Unmarshal(*v, &scopes)
  3237  				if err != nil {
  3238  					return err
  3239  				}
  3240  				mapVar.Scopes = &scopes
  3241  			}
  3242  		case "evaluationFrequency":
  3243  			if v != nil {
  3244  				var evaluationFrequency string
  3245  				err = json.Unmarshal(*v, &evaluationFrequency)
  3246  				if err != nil {
  3247  					return err
  3248  				}
  3249  				mapVar.EvaluationFrequency = &evaluationFrequency
  3250  			}
  3251  		case "windowSize":
  3252  			if v != nil {
  3253  				var windowSize string
  3254  				err = json.Unmarshal(*v, &windowSize)
  3255  				if err != nil {
  3256  					return err
  3257  				}
  3258  				mapVar.WindowSize = &windowSize
  3259  			}
  3260  		case "targetResourceType":
  3261  			if v != nil {
  3262  				var targetResourceType string
  3263  				err = json.Unmarshal(*v, &targetResourceType)
  3264  				if err != nil {
  3265  					return err
  3266  				}
  3267  				mapVar.TargetResourceType = &targetResourceType
  3268  			}
  3269  		case "targetResourceRegion":
  3270  			if v != nil {
  3271  				var targetResourceRegion string
  3272  				err = json.Unmarshal(*v, &targetResourceRegion)
  3273  				if err != nil {
  3274  					return err
  3275  				}
  3276  				mapVar.TargetResourceRegion = &targetResourceRegion
  3277  			}
  3278  		case "criteria":
  3279  			if v != nil {
  3280  				criteria, err := unmarshalBasicMetricAlertCriteria(*v)
  3281  				if err != nil {
  3282  					return err
  3283  				}
  3284  				mapVar.Criteria = criteria
  3285  			}
  3286  		case "autoMitigate":
  3287  			if v != nil {
  3288  				var autoMitigate bool
  3289  				err = json.Unmarshal(*v, &autoMitigate)
  3290  				if err != nil {
  3291  					return err
  3292  				}
  3293  				mapVar.AutoMitigate = &autoMitigate
  3294  			}
  3295  		case "actions":
  3296  			if v != nil {
  3297  				var actions []MetricAlertAction
  3298  				err = json.Unmarshal(*v, &actions)
  3299  				if err != nil {
  3300  					return err
  3301  				}
  3302  				mapVar.Actions = &actions
  3303  			}
  3304  		case "lastUpdatedTime":
  3305  			if v != nil {
  3306  				var lastUpdatedTime date.Time
  3307  				err = json.Unmarshal(*v, &lastUpdatedTime)
  3308  				if err != nil {
  3309  					return err
  3310  				}
  3311  				mapVar.LastUpdatedTime = &lastUpdatedTime
  3312  			}
  3313  		}
  3314  	}
  3315  
  3316  	return nil
  3317  }
  3318  
  3319  // MetricAlertResource the metric alert resource.
  3320  type MetricAlertResource struct {
  3321  	autorest.Response `json:"-"`
  3322  	// MetricAlertProperties - The alert rule properties of the resource.
  3323  	*MetricAlertProperties `json:"properties,omitempty"`
  3324  	// ID - READ-ONLY; Azure resource Id
  3325  	ID *string `json:"id,omitempty"`
  3326  	// Name - READ-ONLY; Azure resource name
  3327  	Name *string `json:"name,omitempty"`
  3328  	// Type - READ-ONLY; Azure resource type
  3329  	Type *string `json:"type,omitempty"`
  3330  	// Location - Resource location
  3331  	Location *string `json:"location,omitempty"`
  3332  	// Tags - Resource tags
  3333  	Tags map[string]*string `json:"tags"`
  3334  }
  3335  
  3336  // MarshalJSON is the custom marshaler for MetricAlertResource.
  3337  func (mar MetricAlertResource) MarshalJSON() ([]byte, error) {
  3338  	objectMap := make(map[string]interface{})
  3339  	if mar.MetricAlertProperties != nil {
  3340  		objectMap["properties"] = mar.MetricAlertProperties
  3341  	}
  3342  	if mar.Location != nil {
  3343  		objectMap["location"] = mar.Location
  3344  	}
  3345  	if mar.Tags != nil {
  3346  		objectMap["tags"] = mar.Tags
  3347  	}
  3348  	return json.Marshal(objectMap)
  3349  }
  3350  
  3351  // UnmarshalJSON is the custom unmarshaler for MetricAlertResource struct.
  3352  func (mar *MetricAlertResource) UnmarshalJSON(body []byte) error {
  3353  	var m map[string]*json.RawMessage
  3354  	err := json.Unmarshal(body, &m)
  3355  	if err != nil {
  3356  		return err
  3357  	}
  3358  	for k, v := range m {
  3359  		switch k {
  3360  		case "properties":
  3361  			if v != nil {
  3362  				var metricAlertProperties MetricAlertProperties
  3363  				err = json.Unmarshal(*v, &metricAlertProperties)
  3364  				if err != nil {
  3365  					return err
  3366  				}
  3367  				mar.MetricAlertProperties = &metricAlertProperties
  3368  			}
  3369  		case "id":
  3370  			if v != nil {
  3371  				var ID string
  3372  				err = json.Unmarshal(*v, &ID)
  3373  				if err != nil {
  3374  					return err
  3375  				}
  3376  				mar.ID = &ID
  3377  			}
  3378  		case "name":
  3379  			if v != nil {
  3380  				var name string
  3381  				err = json.Unmarshal(*v, &name)
  3382  				if err != nil {
  3383  					return err
  3384  				}
  3385  				mar.Name = &name
  3386  			}
  3387  		case "type":
  3388  			if v != nil {
  3389  				var typeVar string
  3390  				err = json.Unmarshal(*v, &typeVar)
  3391  				if err != nil {
  3392  					return err
  3393  				}
  3394  				mar.Type = &typeVar
  3395  			}
  3396  		case "location":
  3397  			if v != nil {
  3398  				var location string
  3399  				err = json.Unmarshal(*v, &location)
  3400  				if err != nil {
  3401  					return err
  3402  				}
  3403  				mar.Location = &location
  3404  			}
  3405  		case "tags":
  3406  			if v != nil {
  3407  				var tags map[string]*string
  3408  				err = json.Unmarshal(*v, &tags)
  3409  				if err != nil {
  3410  					return err
  3411  				}
  3412  				mar.Tags = tags
  3413  			}
  3414  		}
  3415  	}
  3416  
  3417  	return nil
  3418  }
  3419  
  3420  // MetricAlertResourceCollection represents a collection of alert rule resources.
  3421  type MetricAlertResourceCollection struct {
  3422  	autorest.Response `json:"-"`
  3423  	// Value - the values for the alert rule resources.
  3424  	Value *[]MetricAlertResource `json:"value,omitempty"`
  3425  }
  3426  
  3427  // MetricAlertResourcePatch the metric alert resource for patch operations.
  3428  type MetricAlertResourcePatch struct {
  3429  	// Tags - Resource tags
  3430  	Tags map[string]*string `json:"tags"`
  3431  	// MetricAlertProperties - The alert rule properties of the resource.
  3432  	*MetricAlertProperties `json:"properties,omitempty"`
  3433  }
  3434  
  3435  // MarshalJSON is the custom marshaler for MetricAlertResourcePatch.
  3436  func (marp MetricAlertResourcePatch) MarshalJSON() ([]byte, error) {
  3437  	objectMap := make(map[string]interface{})
  3438  	if marp.Tags != nil {
  3439  		objectMap["tags"] = marp.Tags
  3440  	}
  3441  	if marp.MetricAlertProperties != nil {
  3442  		objectMap["properties"] = marp.MetricAlertProperties
  3443  	}
  3444  	return json.Marshal(objectMap)
  3445  }
  3446  
  3447  // UnmarshalJSON is the custom unmarshaler for MetricAlertResourcePatch struct.
  3448  func (marp *MetricAlertResourcePatch) UnmarshalJSON(body []byte) error {
  3449  	var m map[string]*json.RawMessage
  3450  	err := json.Unmarshal(body, &m)
  3451  	if err != nil {
  3452  		return err
  3453  	}
  3454  	for k, v := range m {
  3455  		switch k {
  3456  		case "tags":
  3457  			if v != nil {
  3458  				var tags map[string]*string
  3459  				err = json.Unmarshal(*v, &tags)
  3460  				if err != nil {
  3461  					return err
  3462  				}
  3463  				marp.Tags = tags
  3464  			}
  3465  		case "properties":
  3466  			if v != nil {
  3467  				var metricAlertProperties MetricAlertProperties
  3468  				err = json.Unmarshal(*v, &metricAlertProperties)
  3469  				if err != nil {
  3470  					return err
  3471  				}
  3472  				marp.MetricAlertProperties = &metricAlertProperties
  3473  			}
  3474  		}
  3475  	}
  3476  
  3477  	return nil
  3478  }
  3479  
  3480  // MetricAlertSingleResourceMultipleMetricCriteria specifies the metric alert criteria for a single
  3481  // resource that has multiple metric criteria.
  3482  type MetricAlertSingleResourceMultipleMetricCriteria struct {
  3483  	// AllOf - The list of metric criteria for this 'all of' operation.
  3484  	AllOf *[]MetricCriteria `json:"allOf,omitempty"`
  3485  	// AdditionalProperties - Unmatched properties from the message are deserialized this collection
  3486  	AdditionalProperties map[string]interface{} `json:""`
  3487  	// OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria'
  3488  	OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"`
  3489  }
  3490  
  3491  // MarshalJSON is the custom marshaler for MetricAlertSingleResourceMultipleMetricCriteria.
  3492  func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) {
  3493  	masrmmc.OdataType = OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria
  3494  	objectMap := make(map[string]interface{})
  3495  	if masrmmc.AllOf != nil {
  3496  		objectMap["allOf"] = masrmmc.AllOf
  3497  	}
  3498  	if masrmmc.OdataType != "" {
  3499  		objectMap["odata.type"] = masrmmc.OdataType
  3500  	}
  3501  	for k, v := range masrmmc.AdditionalProperties {
  3502  		objectMap[k] = v
  3503  	}
  3504  	return json.Marshal(objectMap)
  3505  }
  3506  
  3507  // AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria.
  3508  func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) {
  3509  	return &masrmmc, true
  3510  }
  3511  
  3512  // AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria.
  3513  func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) {
  3514  	return nil, false
  3515  }
  3516  
  3517  // AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria.
  3518  func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) {
  3519  	return nil, false
  3520  }
  3521  
  3522  // AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria.
  3523  func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) {
  3524  	return nil, false
  3525  }
  3526  
  3527  // AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria.
  3528  func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) {
  3529  	return &masrmmc, true
  3530  }
  3531  
  3532  // UnmarshalJSON is the custom unmarshaler for MetricAlertSingleResourceMultipleMetricCriteria struct.
  3533  func (masrmmc *MetricAlertSingleResourceMultipleMetricCriteria) UnmarshalJSON(body []byte) error {
  3534  	var m map[string]*json.RawMessage
  3535  	err := json.Unmarshal(body, &m)
  3536  	if err != nil {
  3537  		return err
  3538  	}
  3539  	for k, v := range m {
  3540  		switch k {
  3541  		case "allOf":
  3542  			if v != nil {
  3543  				var allOf []MetricCriteria
  3544  				err = json.Unmarshal(*v, &allOf)
  3545  				if err != nil {
  3546  					return err
  3547  				}
  3548  				masrmmc.AllOf = &allOf
  3549  			}
  3550  		default:
  3551  			if v != nil {
  3552  				var additionalProperties interface{}
  3553  				err = json.Unmarshal(*v, &additionalProperties)
  3554  				if err != nil {
  3555  					return err
  3556  				}
  3557  				if masrmmc.AdditionalProperties == nil {
  3558  					masrmmc.AdditionalProperties = make(map[string]interface{})
  3559  				}
  3560  				masrmmc.AdditionalProperties[k] = additionalProperties
  3561  			}
  3562  		case "odata.type":
  3563  			if v != nil {
  3564  				var odataType OdataTypeBasicMetricAlertCriteria
  3565  				err = json.Unmarshal(*v, &odataType)
  3566  				if err != nil {
  3567  					return err
  3568  				}
  3569  				masrmmc.OdataType = odataType
  3570  			}
  3571  		}
  3572  	}
  3573  
  3574  	return nil
  3575  }
  3576  
  3577  // MetricAlertStatus an alert status.
  3578  type MetricAlertStatus struct {
  3579  	// Name - The status name.
  3580  	Name *string `json:"name,omitempty"`
  3581  	// ID - The alert rule arm id.
  3582  	ID *string `json:"id,omitempty"`
  3583  	// Type - The extended resource type name.
  3584  	Type *string `json:"type,omitempty"`
  3585  	// Properties - The alert status properties of the metric alert status.
  3586  	Properties *MetricAlertStatusProperties `json:"properties,omitempty"`
  3587  }
  3588  
  3589  // MetricAlertStatusCollection represents a collection of alert rule resources.
  3590  type MetricAlertStatusCollection struct {
  3591  	autorest.Response `json:"-"`
  3592  	// Value - the values for the alert rule resources.
  3593  	Value *[]MetricAlertStatus `json:"value,omitempty"`
  3594  }
  3595  
  3596  // MetricAlertStatusProperties an alert status properties.
  3597  type MetricAlertStatusProperties struct {
  3598  	// Dimensions - An object describing the type of the dimensions.
  3599  	Dimensions map[string]*string `json:"dimensions"`
  3600  	// Status - status value
  3601  	Status *string `json:"status,omitempty"`
  3602  	// Timestamp - UTC time when the status was checked.
  3603  	Timestamp *date.Time `json:"timestamp,omitempty"`
  3604  }
  3605  
  3606  // MarshalJSON is the custom marshaler for MetricAlertStatusProperties.
  3607  func (masp MetricAlertStatusProperties) MarshalJSON() ([]byte, error) {
  3608  	objectMap := make(map[string]interface{})
  3609  	if masp.Dimensions != nil {
  3610  		objectMap["dimensions"] = masp.Dimensions
  3611  	}
  3612  	if masp.Status != nil {
  3613  		objectMap["status"] = masp.Status
  3614  	}
  3615  	if masp.Timestamp != nil {
  3616  		objectMap["timestamp"] = masp.Timestamp
  3617  	}
  3618  	return json.Marshal(objectMap)
  3619  }
  3620  
  3621  // MetricAvailability metric availability specifies the time grain (aggregation interval or frequency) and
  3622  // the retention period for that time grain.
  3623  type MetricAvailability struct {
  3624  	// TimeGrain - the time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc.
  3625  	TimeGrain *string `json:"timeGrain,omitempty"`
  3626  	// Retention - the retention period for the metric at the specified timegrain.  Expressed as a duration 'PT1M', 'P1D', etc.
  3627  	Retention *string `json:"retention,omitempty"`
  3628  }
  3629  
  3630  // MetricCriteria criterion to filter metrics.
  3631  type MetricCriteria struct {
  3632  	// Operator - the criteria operator. Possible values include: 'OperatorEquals', 'OperatorNotEquals', 'OperatorGreaterThan', 'OperatorGreaterThanOrEqual', 'OperatorLessThan', 'OperatorLessThanOrEqual'
  3633  	Operator Operator `json:"operator,omitempty"`
  3634  	// Threshold - the criteria threshold value that activates the alert.
  3635  	Threshold *float64 `json:"threshold,omitempty"`
  3636  	// AdditionalProperties - Unmatched properties from the message are deserialized this collection
  3637  	AdditionalProperties map[string]interface{} `json:""`
  3638  	// Name - Name of the criteria.
  3639  	Name *string `json:"name,omitempty"`
  3640  	// MetricName - Name of the metric.
  3641  	MetricName *string `json:"metricName,omitempty"`
  3642  	// MetricNamespace - Namespace of the metric.
  3643  	MetricNamespace *string `json:"metricNamespace,omitempty"`
  3644  	// TimeAggregation - the criteria time aggregation types.
  3645  	TimeAggregation interface{} `json:"timeAggregation,omitempty"`
  3646  	// Dimensions - List of dimension conditions.
  3647  	Dimensions *[]MetricDimension `json:"dimensions,omitempty"`
  3648  	// SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped.
  3649  	SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"`
  3650  	// CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion'
  3651  	CriterionType CriterionType `json:"criterionType,omitempty"`
  3652  }
  3653  
  3654  // MarshalJSON is the custom marshaler for MetricCriteria.
  3655  func (mc MetricCriteria) MarshalJSON() ([]byte, error) {
  3656  	mc.CriterionType = CriterionTypeStaticThresholdCriterion
  3657  	objectMap := make(map[string]interface{})
  3658  	if mc.Operator != "" {
  3659  		objectMap["operator"] = mc.Operator
  3660  	}
  3661  	if mc.Threshold != nil {
  3662  		objectMap["threshold"] = mc.Threshold
  3663  	}
  3664  	if mc.Name != nil {
  3665  		objectMap["name"] = mc.Name
  3666  	}
  3667  	if mc.MetricName != nil {
  3668  		objectMap["metricName"] = mc.MetricName
  3669  	}
  3670  	if mc.MetricNamespace != nil {
  3671  		objectMap["metricNamespace"] = mc.MetricNamespace
  3672  	}
  3673  	if mc.TimeAggregation != nil {
  3674  		objectMap["timeAggregation"] = mc.TimeAggregation
  3675  	}
  3676  	if mc.Dimensions != nil {
  3677  		objectMap["dimensions"] = mc.Dimensions
  3678  	}
  3679  	if mc.SkipMetricValidation != nil {
  3680  		objectMap["skipMetricValidation"] = mc.SkipMetricValidation
  3681  	}
  3682  	if mc.CriterionType != "" {
  3683  		objectMap["criterionType"] = mc.CriterionType
  3684  	}
  3685  	for k, v := range mc.AdditionalProperties {
  3686  		objectMap[k] = v
  3687  	}
  3688  	return json.Marshal(objectMap)
  3689  }
  3690  
  3691  // AsMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria.
  3692  func (mc MetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) {
  3693  	return &mc, true
  3694  }
  3695  
  3696  // AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria.
  3697  func (mc MetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) {
  3698  	return nil, false
  3699  }
  3700  
  3701  // AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria.
  3702  func (mc MetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) {
  3703  	return nil, false
  3704  }
  3705  
  3706  // AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria.
  3707  func (mc MetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) {
  3708  	return &mc, true
  3709  }
  3710  
  3711  // UnmarshalJSON is the custom unmarshaler for MetricCriteria struct.
  3712  func (mc *MetricCriteria) UnmarshalJSON(body []byte) error {
  3713  	var m map[string]*json.RawMessage
  3714  	err := json.Unmarshal(body, &m)
  3715  	if err != nil {
  3716  		return err
  3717  	}
  3718  	for k, v := range m {
  3719  		switch k {
  3720  		case "operator":
  3721  			if v != nil {
  3722  				var operator Operator
  3723  				err = json.Unmarshal(*v, &operator)
  3724  				if err != nil {
  3725  					return err
  3726  				}
  3727  				mc.Operator = operator
  3728  			}
  3729  		case "threshold":
  3730  			if v != nil {
  3731  				var threshold float64
  3732  				err = json.Unmarshal(*v, &threshold)
  3733  				if err != nil {
  3734  					return err
  3735  				}
  3736  				mc.Threshold = &threshold
  3737  			}
  3738  		default:
  3739  			if v != nil {
  3740  				var additionalProperties interface{}
  3741  				err = json.Unmarshal(*v, &additionalProperties)
  3742  				if err != nil {
  3743  					return err
  3744  				}
  3745  				if mc.AdditionalProperties == nil {
  3746  					mc.AdditionalProperties = make(map[string]interface{})
  3747  				}
  3748  				mc.AdditionalProperties[k] = additionalProperties
  3749  			}
  3750  		case "name":
  3751  			if v != nil {
  3752  				var name string
  3753  				err = json.Unmarshal(*v, &name)
  3754  				if err != nil {
  3755  					return err
  3756  				}
  3757  				mc.Name = &name
  3758  			}
  3759  		case "metricName":
  3760  			if v != nil {
  3761  				var metricName string
  3762  				err = json.Unmarshal(*v, &metricName)
  3763  				if err != nil {
  3764  					return err
  3765  				}
  3766  				mc.MetricName = &metricName
  3767  			}
  3768  		case "metricNamespace":
  3769  			if v != nil {
  3770  				var metricNamespace string
  3771  				err = json.Unmarshal(*v, &metricNamespace)
  3772  				if err != nil {
  3773  					return err
  3774  				}
  3775  				mc.MetricNamespace = &metricNamespace
  3776  			}
  3777  		case "timeAggregation":
  3778  			if v != nil {
  3779  				var timeAggregation interface{}
  3780  				err = json.Unmarshal(*v, &timeAggregation)
  3781  				if err != nil {
  3782  					return err
  3783  				}
  3784  				mc.TimeAggregation = timeAggregation
  3785  			}
  3786  		case "dimensions":
  3787  			if v != nil {
  3788  				var dimensions []MetricDimension
  3789  				err = json.Unmarshal(*v, &dimensions)
  3790  				if err != nil {
  3791  					return err
  3792  				}
  3793  				mc.Dimensions = &dimensions
  3794  			}
  3795  		case "skipMetricValidation":
  3796  			if v != nil {
  3797  				var skipMetricValidation bool
  3798  				err = json.Unmarshal(*v, &skipMetricValidation)
  3799  				if err != nil {
  3800  					return err
  3801  				}
  3802  				mc.SkipMetricValidation = &skipMetricValidation
  3803  			}
  3804  		case "criterionType":
  3805  			if v != nil {
  3806  				var criterionType CriterionType
  3807  				err = json.Unmarshal(*v, &criterionType)
  3808  				if err != nil {
  3809  					return err
  3810  				}
  3811  				mc.CriterionType = criterionType
  3812  			}
  3813  		}
  3814  	}
  3815  
  3816  	return nil
  3817  }
  3818  
  3819  // MetricDefinition metric definition class specifies the metadata for a metric.
  3820  type MetricDefinition struct {
  3821  	// IsDimensionRequired - Flag to indicate whether the dimension is required.
  3822  	IsDimensionRequired *bool `json:"isDimensionRequired,omitempty"`
  3823  	// ResourceID - the resource identifier of the resource that emitted the metric.
  3824  	ResourceID *string `json:"resourceId,omitempty"`
  3825  	// Namespace - the namespace the metric belongs to.
  3826  	Namespace *string `json:"namespace,omitempty"`
  3827  	// Name - the name and the display name of the metric, i.e. it is a localizable string.
  3828  	Name *LocalizableString `json:"name,omitempty"`
  3829  	// Unit - the unit of the metric. Possible values include: 'UnitCount', 'UnitBytes', 'UnitSeconds', 'UnitCountPerSecond', 'UnitBytesPerSecond', 'UnitPercent', 'UnitMilliSeconds', 'UnitByteSeconds', 'UnitUnspecified', 'UnitCores', 'UnitMilliCores', 'UnitNanoCores', 'UnitBitsPerSecond'
  3830  	Unit Unit `json:"unit,omitempty"`
  3831  	// PrimaryAggregationType - the primary aggregation type value defining how to use the values for display. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total'
  3832  	PrimaryAggregationType AggregationType `json:"primaryAggregationType,omitempty"`
  3833  	// SupportedAggregationTypes - the collection of what aggregation types are supported.
  3834  	SupportedAggregationTypes *[]AggregationType `json:"supportedAggregationTypes,omitempty"`
  3835  	// MetricAvailabilities - the collection of what aggregation intervals are available to be queried.
  3836  	MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"`
  3837  	// ID - the resource identifier of the metric definition.
  3838  	ID *string `json:"id,omitempty"`
  3839  	// Dimensions - the name and the display name of the dimension, i.e. it is a localizable string.
  3840  	Dimensions *[]LocalizableString `json:"dimensions,omitempty"`
  3841  }
  3842  
  3843  // MetricDefinitionCollection represents collection of metric definitions.
  3844  type MetricDefinitionCollection struct {
  3845  	autorest.Response `json:"-"`
  3846  	// Value - the values for the metric definitions.
  3847  	Value *[]MetricDefinition `json:"value,omitempty"`
  3848  }
  3849  
  3850  // MetricDimension specifies a metric dimension.
  3851  type MetricDimension struct {
  3852  	// Name - Name of the dimension.
  3853  	Name *string `json:"name,omitempty"`
  3854  	// Operator - the dimension operator. Only 'Include' and 'Exclude' are supported
  3855  	Operator *string `json:"operator,omitempty"`
  3856  	// Values - list of dimension values.
  3857  	Values *[]string `json:"values,omitempty"`
  3858  }
  3859  
  3860  // MetricSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric.
  3861  type MetricSettings struct {
  3862  	// TimeGrain - the timegrain of the metric in ISO8601 format.
  3863  	TimeGrain *string `json:"timeGrain,omitempty"`
  3864  	// Category - Name of a Diagnostic Metric category for a resource type this setting is applied to. To obtain the list of Diagnostic metric categories for a resource, first perform a GET diagnostic settings operation.
  3865  	Category *string `json:"category,omitempty"`
  3866  	// Enabled - a value indicating whether this category is enabled.
  3867  	Enabled *bool `json:"enabled,omitempty"`
  3868  	// RetentionPolicy - the retention policy for this category.
  3869  	RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"`
  3870  }
  3871  
  3872  // MetricTrigger the trigger that results in a scaling action.
  3873  type MetricTrigger struct {
  3874  	// MetricName - the name of the metric that defines what the rule monitors.
  3875  	MetricName *string `json:"metricName,omitempty"`
  3876  	// MetricNamespace - the namespace of the metric that defines what the rule monitors.
  3877  	MetricNamespace *string `json:"metricNamespace,omitempty"`
  3878  	// MetricResourceURI - the resource identifier of the resource the rule monitors.
  3879  	MetricResourceURI *string `json:"metricResourceUri,omitempty"`
  3880  	// TimeGrain - the granularity of metrics the rule monitors. Must be one of the predefined values returned from metric definitions for the metric. Must be between 12 hours and 1 minute.
  3881  	TimeGrain *string `json:"timeGrain,omitempty"`
  3882  	// Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum'
  3883  	Statistic MetricStatisticType `json:"statistic,omitempty"`
  3884  	// TimeWindow - the range of time in which instance data is collected. This value must be greater than the delay in metric collection, which can vary from resource-to-resource. Must be between 12 hours and 5 minutes.
  3885  	TimeWindow *string `json:"timeWindow,omitempty"`
  3886  	// TimeAggregation - time aggregation type. How the data that is collected should be combined over time. The default value is Average. Possible values include: 'TimeAggregationTypeAverage', 'TimeAggregationTypeMinimum', 'TimeAggregationTypeMaximum', 'TimeAggregationTypeTotal', 'TimeAggregationTypeCount', 'TimeAggregationTypeLast'
  3887  	TimeAggregation TimeAggregationType `json:"timeAggregation,omitempty"`
  3888  	// Operator - the operator that is used to compare the metric data and the threshold. Possible values include: 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual'
  3889  	Operator ComparisonOperationType `json:"operator,omitempty"`
  3890  	// Threshold - the threshold of the metric that triggers the scale action.
  3891  	Threshold *float64 `json:"threshold,omitempty"`
  3892  	// Dimensions - List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}].
  3893  	Dimensions *[]ScaleRuleMetricDimension `json:"dimensions,omitempty"`
  3894  }
  3895  
  3896  // MetricValue represents a metric value.
  3897  type MetricValue struct {
  3898  	// TimeStamp - the timestamp for the metric value in ISO 8601 format.
  3899  	TimeStamp *date.Time `json:"timeStamp,omitempty"`
  3900  	// Average - the average value in the time range.
  3901  	Average *float64 `json:"average,omitempty"`
  3902  	// Minimum - the least value in the time range.
  3903  	Minimum *float64 `json:"minimum,omitempty"`
  3904  	// Maximum - the greatest value in the time range.
  3905  	Maximum *float64 `json:"maximum,omitempty"`
  3906  	// Total - the sum of all of the values in the time range.
  3907  	Total *float64 `json:"total,omitempty"`
  3908  	// Count - the number of samples in the time range. Can be used to determine the number of values that contributed to the average value.
  3909  	Count *float64 `json:"count,omitempty"`
  3910  }
  3911  
  3912  // BasicMultiMetricCriteria the types of conditions for a multi resource alert.
  3913  type BasicMultiMetricCriteria interface {
  3914  	AsMetricCriteria() (*MetricCriteria, bool)
  3915  	AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool)
  3916  	AsMultiMetricCriteria() (*MultiMetricCriteria, bool)
  3917  }
  3918  
  3919  // MultiMetricCriteria the types of conditions for a multi resource alert.
  3920  type MultiMetricCriteria struct {
  3921  	// AdditionalProperties - Unmatched properties from the message are deserialized this collection
  3922  	AdditionalProperties map[string]interface{} `json:""`
  3923  	// Name - Name of the criteria.
  3924  	Name *string `json:"name,omitempty"`
  3925  	// MetricName - Name of the metric.
  3926  	MetricName *string `json:"metricName,omitempty"`
  3927  	// MetricNamespace - Namespace of the metric.
  3928  	MetricNamespace *string `json:"metricNamespace,omitempty"`
  3929  	// TimeAggregation - the criteria time aggregation types.
  3930  	TimeAggregation interface{} `json:"timeAggregation,omitempty"`
  3931  	// Dimensions - List of dimension conditions.
  3932  	Dimensions *[]MetricDimension `json:"dimensions,omitempty"`
  3933  	// SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped.
  3934  	SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"`
  3935  	// CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion'
  3936  	CriterionType CriterionType `json:"criterionType,omitempty"`
  3937  }
  3938  
  3939  func unmarshalBasicMultiMetricCriteria(body []byte) (BasicMultiMetricCriteria, error) {
  3940  	var m map[string]interface{}
  3941  	err := json.Unmarshal(body, &m)
  3942  	if err != nil {
  3943  		return nil, err
  3944  	}
  3945  
  3946  	switch m["criterionType"] {
  3947  	case string(CriterionTypeStaticThresholdCriterion):
  3948  		var mc MetricCriteria
  3949  		err := json.Unmarshal(body, &mc)
  3950  		return mc, err
  3951  	case string(CriterionTypeDynamicThresholdCriterion):
  3952  		var dmc DynamicMetricCriteria
  3953  		err := json.Unmarshal(body, &dmc)
  3954  		return dmc, err
  3955  	default:
  3956  		var mmc MultiMetricCriteria
  3957  		err := json.Unmarshal(body, &mmc)
  3958  		return mmc, err
  3959  	}
  3960  }
  3961  func unmarshalBasicMultiMetricCriteriaArray(body []byte) ([]BasicMultiMetricCriteria, error) {
  3962  	var rawMessages []*json.RawMessage
  3963  	err := json.Unmarshal(body, &rawMessages)
  3964  	if err != nil {
  3965  		return nil, err
  3966  	}
  3967  
  3968  	mmcArray := make([]BasicMultiMetricCriteria, len(rawMessages))
  3969  
  3970  	for index, rawMessage := range rawMessages {
  3971  		mmc, err := unmarshalBasicMultiMetricCriteria(*rawMessage)
  3972  		if err != nil {
  3973  			return nil, err
  3974  		}
  3975  		mmcArray[index] = mmc
  3976  	}
  3977  	return mmcArray, nil
  3978  }
  3979  
  3980  // MarshalJSON is the custom marshaler for MultiMetricCriteria.
  3981  func (mmc MultiMetricCriteria) MarshalJSON() ([]byte, error) {
  3982  	mmc.CriterionType = CriterionTypeMultiMetricCriteria
  3983  	objectMap := make(map[string]interface{})
  3984  	if mmc.Name != nil {
  3985  		objectMap["name"] = mmc.Name
  3986  	}
  3987  	if mmc.MetricName != nil {
  3988  		objectMap["metricName"] = mmc.MetricName
  3989  	}
  3990  	if mmc.MetricNamespace != nil {
  3991  		objectMap["metricNamespace"] = mmc.MetricNamespace
  3992  	}
  3993  	if mmc.TimeAggregation != nil {
  3994  		objectMap["timeAggregation"] = mmc.TimeAggregation
  3995  	}
  3996  	if mmc.Dimensions != nil {
  3997  		objectMap["dimensions"] = mmc.Dimensions
  3998  	}
  3999  	if mmc.SkipMetricValidation != nil {
  4000  		objectMap["skipMetricValidation"] = mmc.SkipMetricValidation
  4001  	}
  4002  	if mmc.CriterionType != "" {
  4003  		objectMap["criterionType"] = mmc.CriterionType
  4004  	}
  4005  	for k, v := range mmc.AdditionalProperties {
  4006  		objectMap[k] = v
  4007  	}
  4008  	return json.Marshal(objectMap)
  4009  }
  4010  
  4011  // AsMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria.
  4012  func (mmc MultiMetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) {
  4013  	return nil, false
  4014  }
  4015  
  4016  // AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria.
  4017  func (mmc MultiMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) {
  4018  	return nil, false
  4019  }
  4020  
  4021  // AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria.
  4022  func (mmc MultiMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) {
  4023  	return &mmc, true
  4024  }
  4025  
  4026  // AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria.
  4027  func (mmc MultiMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) {
  4028  	return &mmc, true
  4029  }
  4030  
  4031  // UnmarshalJSON is the custom unmarshaler for MultiMetricCriteria struct.
  4032  func (mmc *MultiMetricCriteria) UnmarshalJSON(body []byte) error {
  4033  	var m map[string]*json.RawMessage
  4034  	err := json.Unmarshal(body, &m)
  4035  	if err != nil {
  4036  		return err
  4037  	}
  4038  	for k, v := range m {
  4039  		switch k {
  4040  		default:
  4041  			if v != nil {
  4042  				var additionalProperties interface{}
  4043  				err = json.Unmarshal(*v, &additionalProperties)
  4044  				if err != nil {
  4045  					return err
  4046  				}
  4047  				if mmc.AdditionalProperties == nil {
  4048  					mmc.AdditionalProperties = make(map[string]interface{})
  4049  				}
  4050  				mmc.AdditionalProperties[k] = additionalProperties
  4051  			}
  4052  		case "name":
  4053  			if v != nil {
  4054  				var name string
  4055  				err = json.Unmarshal(*v, &name)
  4056  				if err != nil {
  4057  					return err
  4058  				}
  4059  				mmc.Name = &name
  4060  			}
  4061  		case "metricName":
  4062  			if v != nil {
  4063  				var metricName string
  4064  				err = json.Unmarshal(*v, &metricName)
  4065  				if err != nil {
  4066  					return err
  4067  				}
  4068  				mmc.MetricName = &metricName
  4069  			}
  4070  		case "metricNamespace":
  4071  			if v != nil {
  4072  				var metricNamespace string
  4073  				err = json.Unmarshal(*v, &metricNamespace)
  4074  				if err != nil {
  4075  					return err
  4076  				}
  4077  				mmc.MetricNamespace = &metricNamespace
  4078  			}
  4079  		case "timeAggregation":
  4080  			if v != nil {
  4081  				var timeAggregation interface{}
  4082  				err = json.Unmarshal(*v, &timeAggregation)
  4083  				if err != nil {
  4084  					return err
  4085  				}
  4086  				mmc.TimeAggregation = timeAggregation
  4087  			}
  4088  		case "dimensions":
  4089  			if v != nil {
  4090  				var dimensions []MetricDimension
  4091  				err = json.Unmarshal(*v, &dimensions)
  4092  				if err != nil {
  4093  					return err
  4094  				}
  4095  				mmc.Dimensions = &dimensions
  4096  			}
  4097  		case "skipMetricValidation":
  4098  			if v != nil {
  4099  				var skipMetricValidation bool
  4100  				err = json.Unmarshal(*v, &skipMetricValidation)
  4101  				if err != nil {
  4102  					return err
  4103  				}
  4104  				mmc.SkipMetricValidation = &skipMetricValidation
  4105  			}
  4106  		case "criterionType":
  4107  			if v != nil {
  4108  				var criterionType CriterionType
  4109  				err = json.Unmarshal(*v, &criterionType)
  4110  				if err != nil {
  4111  					return err
  4112  				}
  4113  				mmc.CriterionType = criterionType
  4114  			}
  4115  		}
  4116  	}
  4117  
  4118  	return nil
  4119  }
  4120  
  4121  // Operation microsoft Insights API operation definition.
  4122  type Operation struct {
  4123  	// Name - Operation name: {provider}/{resource}/{operation}
  4124  	Name *string `json:"name,omitempty"`
  4125  	// Display - Display metadata associated with the operation.
  4126  	Display *OperationDisplay `json:"display,omitempty"`
  4127  }
  4128  
  4129  // OperationDisplay display metadata associated with the operation.
  4130  type OperationDisplay struct {
  4131  	// Provider - Service provider: Microsoft.Insights
  4132  	Provider *string `json:"provider,omitempty"`
  4133  	// Resource - Resource on which the operation is performed: AlertRules, Autoscale, etc.
  4134  	Resource *string `json:"resource,omitempty"`
  4135  	// Operation - Operation type: Read, write, delete, etc.
  4136  	Operation *string `json:"operation,omitempty"`
  4137  }
  4138  
  4139  // OperationListResult result of the request to list Microsoft.Insights operations. It contains a list of
  4140  // operations and a URL link to get the next set of results.
  4141  type OperationListResult struct {
  4142  	autorest.Response `json:"-"`
  4143  	// Value - List of operations supported by the Microsoft.Insights provider.
  4144  	Value *[]Operation `json:"value,omitempty"`
  4145  	// NextLink - URL to get the next set of operation list results if there are any.
  4146  	NextLink *string `json:"nextLink,omitempty"`
  4147  }
  4148  
  4149  // ProxyOnlyResource a proxy only azure resource object
  4150  type ProxyOnlyResource struct {
  4151  	// ID - READ-ONLY; Azure resource Id
  4152  	ID *string `json:"id,omitempty"`
  4153  	// Name - READ-ONLY; Azure resource name
  4154  	Name *string `json:"name,omitempty"`
  4155  	// Type - READ-ONLY; Azure resource type
  4156  	Type *string `json:"type,omitempty"`
  4157  }
  4158  
  4159  // MarshalJSON is the custom marshaler for ProxyOnlyResource.
  4160  func (por ProxyOnlyResource) MarshalJSON() ([]byte, error) {
  4161  	objectMap := make(map[string]interface{})
  4162  	return json.Marshal(objectMap)
  4163  }
  4164  
  4165  // Recurrence the repeating times at which this profile begins. This element is not used if the FixedDate
  4166  // element is used.
  4167  type Recurrence struct {
  4168  	// Frequency - the recurrence frequency. How often the schedule profile should take effect. This value must be Week, meaning each week will have the same set of profiles. For example, to set a daily schedule, set **schedule** to every day of the week. The frequency property specifies that the schedule is repeated weekly. Possible values include: 'RecurrenceFrequencyNone', 'RecurrenceFrequencySecond', 'RecurrenceFrequencyMinute', 'RecurrenceFrequencyHour', 'RecurrenceFrequencyDay', 'RecurrenceFrequencyWeek', 'RecurrenceFrequencyMonth', 'RecurrenceFrequencyYear'
  4169  	Frequency RecurrenceFrequency `json:"frequency,omitempty"`
  4170  	// Schedule - the scheduling constraints for when the profile begins.
  4171  	Schedule *RecurrentSchedule `json:"schedule,omitempty"`
  4172  }
  4173  
  4174  // RecurrentSchedule the scheduling constraints for when the profile begins.
  4175  type RecurrentSchedule struct {
  4176  	// TimeZone - the timezone for the hours of the profile. Some examples of valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time
  4177  	TimeZone *string `json:"timeZone,omitempty"`
  4178  	// Days - the collection of days that the profile takes effect on. Possible values are Sunday through Saturday.
  4179  	Days *[]string `json:"days,omitempty"`
  4180  	// Hours - A collection of hours that the profile takes effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM times are not supported).
  4181  	Hours *[]int32 `json:"hours,omitempty"`
  4182  	// Minutes - A collection of minutes at which the profile takes effect at.
  4183  	Minutes *[]int32 `json:"minutes,omitempty"`
  4184  }
  4185  
  4186  // Resource an azure resource object
  4187  type Resource struct {
  4188  	// ID - READ-ONLY; Azure resource Id
  4189  	ID *string `json:"id,omitempty"`
  4190  	// Name - READ-ONLY; Azure resource name
  4191  	Name *string `json:"name,omitempty"`
  4192  	// Type - READ-ONLY; Azure resource type
  4193  	Type *string `json:"type,omitempty"`
  4194  	// Location - Resource location
  4195  	Location *string `json:"location,omitempty"`
  4196  	// Tags - Resource tags
  4197  	Tags map[string]*string `json:"tags"`
  4198  }
  4199  
  4200  // MarshalJSON is the custom marshaler for Resource.
  4201  func (r Resource) MarshalJSON() ([]byte, error) {
  4202  	objectMap := make(map[string]interface{})
  4203  	if r.Location != nil {
  4204  		objectMap["location"] = r.Location
  4205  	}
  4206  	if r.Tags != nil {
  4207  		objectMap["tags"] = r.Tags
  4208  	}
  4209  	return json.Marshal(objectMap)
  4210  }
  4211  
  4212  // Response the response to a metrics query.
  4213  type Response struct {
  4214  	autorest.Response `json:"-"`
  4215  	// Cost - The integer value representing the cost of the query, for data case.
  4216  	Cost *float64 `json:"cost,omitempty"`
  4217  	// Timespan - 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.
  4218  	Timespan *string `json:"timespan,omitempty"`
  4219  	// Interval - 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.
  4220  	Interval *string `json:"interval,omitempty"`
  4221  	// Namespace - The namespace of the metrics been queried
  4222  	Namespace *string `json:"namespace,omitempty"`
  4223  	// Resourceregion - The region of the resource been queried for metrics.
  4224  	Resourceregion *string `json:"resourceregion,omitempty"`
  4225  	// Value - the value of the collection.
  4226  	Value *[]Metric `json:"value,omitempty"`
  4227  }
  4228  
  4229  // RetentionPolicy specifies the retention policy for the log.
  4230  type RetentionPolicy struct {
  4231  	// Enabled - a value indicating whether the retention policy is enabled.
  4232  	Enabled *bool `json:"enabled,omitempty"`
  4233  	// Days - the number of days for the retention in days. A value of 0 will retain the events indefinitely.
  4234  	Days *int32 `json:"days,omitempty"`
  4235  }
  4236  
  4237  // BasicRuleAction the action that is performed when the alert rule becomes active, and when an alert condition is
  4238  // resolved.
  4239  type BasicRuleAction interface {
  4240  	AsRuleEmailAction() (*RuleEmailAction, bool)
  4241  	AsRuleWebhookAction() (*RuleWebhookAction, bool)
  4242  	AsRuleAction() (*RuleAction, bool)
  4243  }
  4244  
  4245  // RuleAction the action that is performed when the alert rule becomes active, and when an alert condition is
  4246  // resolved.
  4247  type RuleAction struct {
  4248  	// OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction'
  4249  	OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"`
  4250  }
  4251  
  4252  func unmarshalBasicRuleAction(body []byte) (BasicRuleAction, error) {
  4253  	var m map[string]interface{}
  4254  	err := json.Unmarshal(body, &m)
  4255  	if err != nil {
  4256  		return nil, err
  4257  	}
  4258  
  4259  	switch m["odata.type"] {
  4260  	case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction):
  4261  		var rea RuleEmailAction
  4262  		err := json.Unmarshal(body, &rea)
  4263  		return rea, err
  4264  	case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction):
  4265  		var rwa RuleWebhookAction
  4266  		err := json.Unmarshal(body, &rwa)
  4267  		return rwa, err
  4268  	default:
  4269  		var ra RuleAction
  4270  		err := json.Unmarshal(body, &ra)
  4271  		return ra, err
  4272  	}
  4273  }
  4274  func unmarshalBasicRuleActionArray(body []byte) ([]BasicRuleAction, error) {
  4275  	var rawMessages []*json.RawMessage
  4276  	err := json.Unmarshal(body, &rawMessages)
  4277  	if err != nil {
  4278  		return nil, err
  4279  	}
  4280  
  4281  	raArray := make([]BasicRuleAction, len(rawMessages))
  4282  
  4283  	for index, rawMessage := range rawMessages {
  4284  		ra, err := unmarshalBasicRuleAction(*rawMessage)
  4285  		if err != nil {
  4286  			return nil, err
  4287  		}
  4288  		raArray[index] = ra
  4289  	}
  4290  	return raArray, nil
  4291  }
  4292  
  4293  // MarshalJSON is the custom marshaler for RuleAction.
  4294  func (ra RuleAction) MarshalJSON() ([]byte, error) {
  4295  	ra.OdataType = OdataTypeRuleAction
  4296  	objectMap := make(map[string]interface{})
  4297  	if ra.OdataType != "" {
  4298  		objectMap["odata.type"] = ra.OdataType
  4299  	}
  4300  	return json.Marshal(objectMap)
  4301  }
  4302  
  4303  // AsRuleEmailAction is the BasicRuleAction implementation for RuleAction.
  4304  func (ra RuleAction) AsRuleEmailAction() (*RuleEmailAction, bool) {
  4305  	return nil, false
  4306  }
  4307  
  4308  // AsRuleWebhookAction is the BasicRuleAction implementation for RuleAction.
  4309  func (ra RuleAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) {
  4310  	return nil, false
  4311  }
  4312  
  4313  // AsRuleAction is the BasicRuleAction implementation for RuleAction.
  4314  func (ra RuleAction) AsRuleAction() (*RuleAction, bool) {
  4315  	return &ra, true
  4316  }
  4317  
  4318  // AsBasicRuleAction is the BasicRuleAction implementation for RuleAction.
  4319  func (ra RuleAction) AsBasicRuleAction() (BasicRuleAction, bool) {
  4320  	return &ra, true
  4321  }
  4322  
  4323  // BasicRuleCondition the condition that results in the alert rule being activated.
  4324  type BasicRuleCondition interface {
  4325  	AsThresholdRuleCondition() (*ThresholdRuleCondition, bool)
  4326  	AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool)
  4327  	AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool)
  4328  	AsRuleCondition() (*RuleCondition, bool)
  4329  }
  4330  
  4331  // RuleCondition the condition that results in the alert rule being activated.
  4332  type RuleCondition struct {
  4333  	// DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource.
  4334  	DataSource BasicRuleDataSource `json:"dataSource,omitempty"`
  4335  	// OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition'
  4336  	OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"`
  4337  }
  4338  
  4339  func unmarshalBasicRuleCondition(body []byte) (BasicRuleCondition, error) {
  4340  	var m map[string]interface{}
  4341  	err := json.Unmarshal(body, &m)
  4342  	if err != nil {
  4343  		return nil, err
  4344  	}
  4345  
  4346  	switch m["odata.type"] {
  4347  	case string(OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition):
  4348  		var trc ThresholdRuleCondition
  4349  		err := json.Unmarshal(body, &trc)
  4350  		return trc, err
  4351  	case string(OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition):
  4352  		var ltrc LocationThresholdRuleCondition
  4353  		err := json.Unmarshal(body, &ltrc)
  4354  		return ltrc, err
  4355  	case string(OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition):
  4356  		var merc ManagementEventRuleCondition
  4357  		err := json.Unmarshal(body, &merc)
  4358  		return merc, err
  4359  	default:
  4360  		var rc RuleCondition
  4361  		err := json.Unmarshal(body, &rc)
  4362  		return rc, err
  4363  	}
  4364  }
  4365  func unmarshalBasicRuleConditionArray(body []byte) ([]BasicRuleCondition, error) {
  4366  	var rawMessages []*json.RawMessage
  4367  	err := json.Unmarshal(body, &rawMessages)
  4368  	if err != nil {
  4369  		return nil, err
  4370  	}
  4371  
  4372  	rcArray := make([]BasicRuleCondition, len(rawMessages))
  4373  
  4374  	for index, rawMessage := range rawMessages {
  4375  		rc, err := unmarshalBasicRuleCondition(*rawMessage)
  4376  		if err != nil {
  4377  			return nil, err
  4378  		}
  4379  		rcArray[index] = rc
  4380  	}
  4381  	return rcArray, nil
  4382  }
  4383  
  4384  // MarshalJSON is the custom marshaler for RuleCondition.
  4385  func (rc RuleCondition) MarshalJSON() ([]byte, error) {
  4386  	rc.OdataType = OdataTypeRuleCondition
  4387  	objectMap := make(map[string]interface{})
  4388  	objectMap["dataSource"] = rc.DataSource
  4389  	if rc.OdataType != "" {
  4390  		objectMap["odata.type"] = rc.OdataType
  4391  	}
  4392  	return json.Marshal(objectMap)
  4393  }
  4394  
  4395  // AsThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition.
  4396  func (rc RuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) {
  4397  	return nil, false
  4398  }
  4399  
  4400  // AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition.
  4401  func (rc RuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) {
  4402  	return nil, false
  4403  }
  4404  
  4405  // AsManagementEventRuleCondition is the BasicRuleCondition implementation for RuleCondition.
  4406  func (rc RuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) {
  4407  	return nil, false
  4408  }
  4409  
  4410  // AsRuleCondition is the BasicRuleCondition implementation for RuleCondition.
  4411  func (rc RuleCondition) AsRuleCondition() (*RuleCondition, bool) {
  4412  	return &rc, true
  4413  }
  4414  
  4415  // AsBasicRuleCondition is the BasicRuleCondition implementation for RuleCondition.
  4416  func (rc RuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) {
  4417  	return &rc, true
  4418  }
  4419  
  4420  // UnmarshalJSON is the custom unmarshaler for RuleCondition struct.
  4421  func (rc *RuleCondition) UnmarshalJSON(body []byte) error {
  4422  	var m map[string]*json.RawMessage
  4423  	err := json.Unmarshal(body, &m)
  4424  	if err != nil {
  4425  		return err
  4426  	}
  4427  	for k, v := range m {
  4428  		switch k {
  4429  		case "dataSource":
  4430  			if v != nil {
  4431  				dataSource, err := unmarshalBasicRuleDataSource(*v)
  4432  				if err != nil {
  4433  					return err
  4434  				}
  4435  				rc.DataSource = dataSource
  4436  			}
  4437  		case "odata.type":
  4438  			if v != nil {
  4439  				var odataType OdataTypeBasicRuleCondition
  4440  				err = json.Unmarshal(*v, &odataType)
  4441  				if err != nil {
  4442  					return err
  4443  				}
  4444  				rc.OdataType = odataType
  4445  			}
  4446  		}
  4447  	}
  4448  
  4449  	return nil
  4450  }
  4451  
  4452  // BasicRuleDataSource the resource from which the rule collects its data.
  4453  type BasicRuleDataSource interface {
  4454  	AsRuleMetricDataSource() (*RuleMetricDataSource, bool)
  4455  	AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool)
  4456  	AsRuleDataSource() (*RuleDataSource, bool)
  4457  }
  4458  
  4459  // RuleDataSource the resource from which the rule collects its data.
  4460  type RuleDataSource struct {
  4461  	// ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule.
  4462  	ResourceURI *string `json:"resourceUri,omitempty"`
  4463  	// OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource'
  4464  	OdataType OdataType `json:"odata.type,omitempty"`
  4465  }
  4466  
  4467  func unmarshalBasicRuleDataSource(body []byte) (BasicRuleDataSource, error) {
  4468  	var m map[string]interface{}
  4469  	err := json.Unmarshal(body, &m)
  4470  	if err != nil {
  4471  		return nil, err
  4472  	}
  4473  
  4474  	switch m["odata.type"] {
  4475  	case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource):
  4476  		var rmds RuleMetricDataSource
  4477  		err := json.Unmarshal(body, &rmds)
  4478  		return rmds, err
  4479  	case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource):
  4480  		var rmeds RuleManagementEventDataSource
  4481  		err := json.Unmarshal(body, &rmeds)
  4482  		return rmeds, err
  4483  	default:
  4484  		var rds RuleDataSource
  4485  		err := json.Unmarshal(body, &rds)
  4486  		return rds, err
  4487  	}
  4488  }
  4489  func unmarshalBasicRuleDataSourceArray(body []byte) ([]BasicRuleDataSource, error) {
  4490  	var rawMessages []*json.RawMessage
  4491  	err := json.Unmarshal(body, &rawMessages)
  4492  	if err != nil {
  4493  		return nil, err
  4494  	}
  4495  
  4496  	rdsArray := make([]BasicRuleDataSource, len(rawMessages))
  4497  
  4498  	for index, rawMessage := range rawMessages {
  4499  		rds, err := unmarshalBasicRuleDataSource(*rawMessage)
  4500  		if err != nil {
  4501  			return nil, err
  4502  		}
  4503  		rdsArray[index] = rds
  4504  	}
  4505  	return rdsArray, nil
  4506  }
  4507  
  4508  // MarshalJSON is the custom marshaler for RuleDataSource.
  4509  func (rds RuleDataSource) MarshalJSON() ([]byte, error) {
  4510  	rds.OdataType = OdataTypeRuleDataSource
  4511  	objectMap := make(map[string]interface{})
  4512  	if rds.ResourceURI != nil {
  4513  		objectMap["resourceUri"] = rds.ResourceURI
  4514  	}
  4515  	if rds.OdataType != "" {
  4516  		objectMap["odata.type"] = rds.OdataType
  4517  	}
  4518  	return json.Marshal(objectMap)
  4519  }
  4520  
  4521  // AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleDataSource.
  4522  func (rds RuleDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) {
  4523  	return nil, false
  4524  }
  4525  
  4526  // AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleDataSource.
  4527  func (rds RuleDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) {
  4528  	return nil, false
  4529  }
  4530  
  4531  // AsRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource.
  4532  func (rds RuleDataSource) AsRuleDataSource() (*RuleDataSource, bool) {
  4533  	return &rds, true
  4534  }
  4535  
  4536  // AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource.
  4537  func (rds RuleDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) {
  4538  	return &rds, true
  4539  }
  4540  
  4541  // RuleEmailAction specifies the action to send email when the rule condition is evaluated. The
  4542  // discriminator is always RuleEmailAction in this case.
  4543  type RuleEmailAction struct {
  4544  	// SendToServiceOwners - Whether the administrators (service and co-administrators) of the service should be notified when the alert is activated.
  4545  	SendToServiceOwners *bool `json:"sendToServiceOwners,omitempty"`
  4546  	// CustomEmails - the list of administrator's custom email addresses to notify of the activation of the alert.
  4547  	CustomEmails *[]string `json:"customEmails,omitempty"`
  4548  	// OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction'
  4549  	OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"`
  4550  }
  4551  
  4552  // MarshalJSON is the custom marshaler for RuleEmailAction.
  4553  func (rea RuleEmailAction) MarshalJSON() ([]byte, error) {
  4554  	rea.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction
  4555  	objectMap := make(map[string]interface{})
  4556  	if rea.SendToServiceOwners != nil {
  4557  		objectMap["sendToServiceOwners"] = rea.SendToServiceOwners
  4558  	}
  4559  	if rea.CustomEmails != nil {
  4560  		objectMap["customEmails"] = rea.CustomEmails
  4561  	}
  4562  	if rea.OdataType != "" {
  4563  		objectMap["odata.type"] = rea.OdataType
  4564  	}
  4565  	return json.Marshal(objectMap)
  4566  }
  4567  
  4568  // AsRuleEmailAction is the BasicRuleAction implementation for RuleEmailAction.
  4569  func (rea RuleEmailAction) AsRuleEmailAction() (*RuleEmailAction, bool) {
  4570  	return &rea, true
  4571  }
  4572  
  4573  // AsRuleWebhookAction is the BasicRuleAction implementation for RuleEmailAction.
  4574  func (rea RuleEmailAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) {
  4575  	return nil, false
  4576  }
  4577  
  4578  // AsRuleAction is the BasicRuleAction implementation for RuleEmailAction.
  4579  func (rea RuleEmailAction) AsRuleAction() (*RuleAction, bool) {
  4580  	return nil, false
  4581  }
  4582  
  4583  // AsBasicRuleAction is the BasicRuleAction implementation for RuleEmailAction.
  4584  func (rea RuleEmailAction) AsBasicRuleAction() (BasicRuleAction, bool) {
  4585  	return &rea, true
  4586  }
  4587  
  4588  // RuleManagementEventClaimsDataSource the claims for a rule management event data source.
  4589  type RuleManagementEventClaimsDataSource struct {
  4590  	// EmailAddress - the email address.
  4591  	EmailAddress *string `json:"emailAddress,omitempty"`
  4592  }
  4593  
  4594  // RuleManagementEventDataSource a rule management event data source. The discriminator fields is always
  4595  // RuleManagementEventDataSource in this case.
  4596  type RuleManagementEventDataSource struct {
  4597  	// EventName - the event name.
  4598  	EventName *string `json:"eventName,omitempty"`
  4599  	// EventSource - the event source.
  4600  	EventSource *string `json:"eventSource,omitempty"`
  4601  	// Level - the level.
  4602  	Level *string `json:"level,omitempty"`
  4603  	// OperationName - The name of the operation that should be checked for. If no name is provided, any operation will match.
  4604  	OperationName *string `json:"operationName,omitempty"`
  4605  	// ResourceGroupName - the resource group name.
  4606  	ResourceGroupName *string `json:"resourceGroupName,omitempty"`
  4607  	// ResourceProviderName - the resource provider name.
  4608  	ResourceProviderName *string `json:"resourceProviderName,omitempty"`
  4609  	// Status - The status of the operation that should be checked for. If no status is provided, any status will match.
  4610  	Status *string `json:"status,omitempty"`
  4611  	// SubStatus - the substatus.
  4612  	SubStatus *string `json:"subStatus,omitempty"`
  4613  	// Claims - the claims.
  4614  	Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"`
  4615  	// ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule.
  4616  	ResourceURI *string `json:"resourceUri,omitempty"`
  4617  	// OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource'
  4618  	OdataType OdataType `json:"odata.type,omitempty"`
  4619  }
  4620  
  4621  // MarshalJSON is the custom marshaler for RuleManagementEventDataSource.
  4622  func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) {
  4623  	rmeds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource
  4624  	objectMap := make(map[string]interface{})
  4625  	if rmeds.EventName != nil {
  4626  		objectMap["eventName"] = rmeds.EventName
  4627  	}
  4628  	if rmeds.EventSource != nil {
  4629  		objectMap["eventSource"] = rmeds.EventSource
  4630  	}
  4631  	if rmeds.Level != nil {
  4632  		objectMap["level"] = rmeds.Level
  4633  	}
  4634  	if rmeds.OperationName != nil {
  4635  		objectMap["operationName"] = rmeds.OperationName
  4636  	}
  4637  	if rmeds.ResourceGroupName != nil {
  4638  		objectMap["resourceGroupName"] = rmeds.ResourceGroupName
  4639  	}
  4640  	if rmeds.ResourceProviderName != nil {
  4641  		objectMap["resourceProviderName"] = rmeds.ResourceProviderName
  4642  	}
  4643  	if rmeds.Status != nil {
  4644  		objectMap["status"] = rmeds.Status
  4645  	}
  4646  	if rmeds.SubStatus != nil {
  4647  		objectMap["subStatus"] = rmeds.SubStatus
  4648  	}
  4649  	if rmeds.Claims != nil {
  4650  		objectMap["claims"] = rmeds.Claims
  4651  	}
  4652  	if rmeds.ResourceURI != nil {
  4653  		objectMap["resourceUri"] = rmeds.ResourceURI
  4654  	}
  4655  	if rmeds.OdataType != "" {
  4656  		objectMap["odata.type"] = rmeds.OdataType
  4657  	}
  4658  	return json.Marshal(objectMap)
  4659  }
  4660  
  4661  // AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource.
  4662  func (rmeds RuleManagementEventDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) {
  4663  	return nil, false
  4664  }
  4665  
  4666  // AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource.
  4667  func (rmeds RuleManagementEventDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) {
  4668  	return &rmeds, true
  4669  }
  4670  
  4671  // AsRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource.
  4672  func (rmeds RuleManagementEventDataSource) AsRuleDataSource() (*RuleDataSource, bool) {
  4673  	return nil, false
  4674  }
  4675  
  4676  // AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource.
  4677  func (rmeds RuleManagementEventDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) {
  4678  	return &rmeds, true
  4679  }
  4680  
  4681  // RuleMetricDataSource a rule metric data source. The discriminator value is always RuleMetricDataSource
  4682  // in this case.
  4683  type RuleMetricDataSource struct {
  4684  	// MetricName - the name of the metric that defines what the rule monitors.
  4685  	MetricName *string `json:"metricName,omitempty"`
  4686  	// ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule.
  4687  	ResourceURI *string `json:"resourceUri,omitempty"`
  4688  	// OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource'
  4689  	OdataType OdataType `json:"odata.type,omitempty"`
  4690  }
  4691  
  4692  // MarshalJSON is the custom marshaler for RuleMetricDataSource.
  4693  func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) {
  4694  	rmds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource
  4695  	objectMap := make(map[string]interface{})
  4696  	if rmds.MetricName != nil {
  4697  		objectMap["metricName"] = rmds.MetricName
  4698  	}
  4699  	if rmds.ResourceURI != nil {
  4700  		objectMap["resourceUri"] = rmds.ResourceURI
  4701  	}
  4702  	if rmds.OdataType != "" {
  4703  		objectMap["odata.type"] = rmds.OdataType
  4704  	}
  4705  	return json.Marshal(objectMap)
  4706  }
  4707  
  4708  // AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource.
  4709  func (rmds RuleMetricDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) {
  4710  	return &rmds, true
  4711  }
  4712  
  4713  // AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource.
  4714  func (rmds RuleMetricDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) {
  4715  	return nil, false
  4716  }
  4717  
  4718  // AsRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource.
  4719  func (rmds RuleMetricDataSource) AsRuleDataSource() (*RuleDataSource, bool) {
  4720  	return nil, false
  4721  }
  4722  
  4723  // AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource.
  4724  func (rmds RuleMetricDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) {
  4725  	return &rmds, true
  4726  }
  4727  
  4728  // RuleWebhookAction specifies the action to post to service when the rule condition is evaluated. The
  4729  // discriminator is always RuleWebhookAction in this case.
  4730  type RuleWebhookAction struct {
  4731  	// ServiceURI - the service uri to Post the notification when the alert activates or resolves.
  4732  	ServiceURI *string `json:"serviceUri,omitempty"`
  4733  	// Properties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload.
  4734  	Properties map[string]*string `json:"properties"`
  4735  	// OdataType - Possible values include: 'OdataTypeRuleAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction'
  4736  	OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"`
  4737  }
  4738  
  4739  // MarshalJSON is the custom marshaler for RuleWebhookAction.
  4740  func (rwa RuleWebhookAction) MarshalJSON() ([]byte, error) {
  4741  	rwa.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction
  4742  	objectMap := make(map[string]interface{})
  4743  	if rwa.ServiceURI != nil {
  4744  		objectMap["serviceUri"] = rwa.ServiceURI
  4745  	}
  4746  	if rwa.Properties != nil {
  4747  		objectMap["properties"] = rwa.Properties
  4748  	}
  4749  	if rwa.OdataType != "" {
  4750  		objectMap["odata.type"] = rwa.OdataType
  4751  	}
  4752  	return json.Marshal(objectMap)
  4753  }
  4754  
  4755  // AsRuleEmailAction is the BasicRuleAction implementation for RuleWebhookAction.
  4756  func (rwa RuleWebhookAction) AsRuleEmailAction() (*RuleEmailAction, bool) {
  4757  	return nil, false
  4758  }
  4759  
  4760  // AsRuleWebhookAction is the BasicRuleAction implementation for RuleWebhookAction.
  4761  func (rwa RuleWebhookAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) {
  4762  	return &rwa, true
  4763  }
  4764  
  4765  // AsRuleAction is the BasicRuleAction implementation for RuleWebhookAction.
  4766  func (rwa RuleWebhookAction) AsRuleAction() (*RuleAction, bool) {
  4767  	return nil, false
  4768  }
  4769  
  4770  // AsBasicRuleAction is the BasicRuleAction implementation for RuleWebhookAction.
  4771  func (rwa RuleWebhookAction) AsBasicRuleAction() (BasicRuleAction, bool) {
  4772  	return &rwa, true
  4773  }
  4774  
  4775  // ScaleAction the parameters for the scaling action.
  4776  type ScaleAction struct {
  4777  	// Direction - the scale direction. Whether the scaling action increases or decreases the number of instances. Possible values include: 'ScaleDirectionNone', 'ScaleDirectionIncrease', 'ScaleDirectionDecrease'
  4778  	Direction ScaleDirection `json:"direction,omitempty"`
  4779  	// Type - the type of action that should occur when the scale rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount'
  4780  	Type ScaleType `json:"type,omitempty"`
  4781  	// Value - the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is 1.
  4782  	Value *string `json:"value,omitempty"`
  4783  	// Cooldown - the amount of time to wait since the last scaling action before this action occurs. It must be between 1 week and 1 minute in ISO 8601 format.
  4784  	Cooldown *string `json:"cooldown,omitempty"`
  4785  }
  4786  
  4787  // ScaleCapacity the number of instances that can be used during this profile.
  4788  type ScaleCapacity struct {
  4789  	// Minimum - the minimum number of instances for the resource.
  4790  	Minimum *string `json:"minimum,omitempty"`
  4791  	// Maximum - the maximum number of instances for the resource. The actual maximum number of instances is limited by the cores that are available in the subscription.
  4792  	Maximum *string `json:"maximum,omitempty"`
  4793  	// Default - the number of instances that will be set if metrics are not available for evaluation. The default is only used if the current instance count is lower than the default.
  4794  	Default *string `json:"default,omitempty"`
  4795  }
  4796  
  4797  // ScaleRule a rule that provide the triggers and parameters for the scaling action.
  4798  type ScaleRule struct {
  4799  	// MetricTrigger - the trigger that results in a scaling action.
  4800  	MetricTrigger *MetricTrigger `json:"metricTrigger,omitempty"`
  4801  	// ScaleAction - the parameters for the scaling action.
  4802  	ScaleAction *ScaleAction `json:"scaleAction,omitempty"`
  4803  }
  4804  
  4805  // ScaleRuleMetricDimension specifies an auto scale rule metric dimension.
  4806  type ScaleRuleMetricDimension struct {
  4807  	// DimensionName - Name of the dimension.
  4808  	DimensionName *string `json:"DimensionName,omitempty"`
  4809  	// Operator - the dimension operator. Only 'Equals' and 'NotEquals' are supported. 'Equals' being equal to any of the values. 'NotEquals' being not equal to all of the values. Possible values include: 'ScaleRuleMetricDimensionOperationTypeEquals', 'ScaleRuleMetricDimensionOperationTypeNotEquals'
  4810  	Operator ScaleRuleMetricDimensionOperationType `json:"Operator,omitempty"`
  4811  	// Values - list of dimension values. For example: ["App1","App2"].
  4812  	Values *[]string `json:"Values,omitempty"`
  4813  }
  4814  
  4815  // Schedule defines how often to run the search and the time interval.
  4816  type Schedule struct {
  4817  	// FrequencyInMinutes - frequency (in minutes) at which rule condition should be evaluated.
  4818  	FrequencyInMinutes *int32 `json:"frequencyInMinutes,omitempty"`
  4819  	// TimeWindowInMinutes - Time window for which data needs to be fetched for query (should be greater than or equal to frequencyInMinutes).
  4820  	TimeWindowInMinutes *int32 `json:"timeWindowInMinutes,omitempty"`
  4821  }
  4822  
  4823  // SenderAuthorization the authorization used by the user who has performed the operation that led to this
  4824  // event. This captures the RBAC properties of the event. These usually include the 'action', 'role' and
  4825  // the 'scope'
  4826  type SenderAuthorization struct {
  4827  	// Action - the permissible actions. For instance: microsoft.support/supporttickets/write
  4828  	Action *string `json:"action,omitempty"`
  4829  	// Role - the role of the user. For instance: Subscription Admin
  4830  	Role *string `json:"role,omitempty"`
  4831  	// Scope - the scope.
  4832  	Scope *string `json:"scope,omitempty"`
  4833  }
  4834  
  4835  // SmsReceiver an SMS receiver.
  4836  type SmsReceiver struct {
  4837  	// Name - The name of the SMS receiver. Names must be unique across all receivers within an action group.
  4838  	Name *string `json:"name,omitempty"`
  4839  	// CountryCode - The country code of the SMS receiver.
  4840  	CountryCode *string `json:"countryCode,omitempty"`
  4841  	// PhoneNumber - The phone number of the SMS receiver.
  4842  	PhoneNumber *string `json:"phoneNumber,omitempty"`
  4843  	// Status - READ-ONLY; The status of the receiver. Possible values include: 'ReceiverStatusNotSpecified', 'ReceiverStatusEnabled', 'ReceiverStatusDisabled'
  4844  	Status ReceiverStatus `json:"status,omitempty"`
  4845  }
  4846  
  4847  // MarshalJSON is the custom marshaler for SmsReceiver.
  4848  func (sr SmsReceiver) MarshalJSON() ([]byte, error) {
  4849  	objectMap := make(map[string]interface{})
  4850  	if sr.Name != nil {
  4851  		objectMap["name"] = sr.Name
  4852  	}
  4853  	if sr.CountryCode != nil {
  4854  		objectMap["countryCode"] = sr.CountryCode
  4855  	}
  4856  	if sr.PhoneNumber != nil {
  4857  		objectMap["phoneNumber"] = sr.PhoneNumber
  4858  	}
  4859  	return json.Marshal(objectMap)
  4860  }
  4861  
  4862  // Source specifies the log search query.
  4863  type Source struct {
  4864  	// Query - Log search query. Required for action type - AlertingAction
  4865  	Query *string `json:"query,omitempty"`
  4866  	// AuthorizedResources - List of  Resource referred into query
  4867  	AuthorizedResources *[]string `json:"authorizedResources,omitempty"`
  4868  	// DataSourceID - The resource uri over which log search query is to be run.
  4869  	DataSourceID *string `json:"dataSourceId,omitempty"`
  4870  	// QueryType - Set value to 'ResultCount'. Possible values include: 'ResultCount'
  4871  	QueryType QueryType `json:"queryType,omitempty"`
  4872  }
  4873  
  4874  // ThresholdRuleCondition a rule condition based on a metric crossing a threshold.
  4875  type ThresholdRuleCondition struct {
  4876  	// Operator - the operator used to compare the data and the threshold. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual'
  4877  	Operator ConditionOperator `json:"operator,omitempty"`
  4878  	// Threshold - the threshold value that activates the alert.
  4879  	Threshold *float64 `json:"threshold,omitempty"`
  4880  	// WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day.
  4881  	WindowSize *string `json:"windowSize,omitempty"`
  4882  	// TimeAggregation - the time aggregation operator. How the data that are collected should be combined over time. The default value is the PrimaryAggregationType of the Metric. Possible values include: 'TimeAggregationOperatorAverage', 'TimeAggregationOperatorMinimum', 'TimeAggregationOperatorMaximum', 'TimeAggregationOperatorTotal', 'TimeAggregationOperatorLast'
  4883  	TimeAggregation TimeAggregationOperator `json:"timeAggregation,omitempty"`
  4884  	// DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource.
  4885  	DataSource BasicRuleDataSource `json:"dataSource,omitempty"`
  4886  	// OdataType - Possible values include: 'OdataTypeRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition'
  4887  	OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"`
  4888  }
  4889  
  4890  // MarshalJSON is the custom marshaler for ThresholdRuleCondition.
  4891  func (trc ThresholdRuleCondition) MarshalJSON() ([]byte, error) {
  4892  	trc.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition
  4893  	objectMap := make(map[string]interface{})
  4894  	if trc.Operator != "" {
  4895  		objectMap["operator"] = trc.Operator
  4896  	}
  4897  	if trc.Threshold != nil {
  4898  		objectMap["threshold"] = trc.Threshold
  4899  	}
  4900  	if trc.WindowSize != nil {
  4901  		objectMap["windowSize"] = trc.WindowSize
  4902  	}
  4903  	if trc.TimeAggregation != "" {
  4904  		objectMap["timeAggregation"] = trc.TimeAggregation
  4905  	}
  4906  	objectMap["dataSource"] = trc.DataSource
  4907  	if trc.OdataType != "" {
  4908  		objectMap["odata.type"] = trc.OdataType
  4909  	}
  4910  	return json.Marshal(objectMap)
  4911  }
  4912  
  4913  // AsThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition.
  4914  func (trc ThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) {
  4915  	return &trc, true
  4916  }
  4917  
  4918  // AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition.
  4919  func (trc ThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) {
  4920  	return nil, false
  4921  }
  4922  
  4923  // AsManagementEventRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition.
  4924  func (trc ThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) {
  4925  	return nil, false
  4926  }
  4927  
  4928  // AsRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition.
  4929  func (trc ThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) {
  4930  	return nil, false
  4931  }
  4932  
  4933  // AsBasicRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition.
  4934  func (trc ThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) {
  4935  	return &trc, true
  4936  }
  4937  
  4938  // UnmarshalJSON is the custom unmarshaler for ThresholdRuleCondition struct.
  4939  func (trc *ThresholdRuleCondition) UnmarshalJSON(body []byte) error {
  4940  	var m map[string]*json.RawMessage
  4941  	err := json.Unmarshal(body, &m)
  4942  	if err != nil {
  4943  		return err
  4944  	}
  4945  	for k, v := range m {
  4946  		switch k {
  4947  		case "operator":
  4948  			if v != nil {
  4949  				var operator ConditionOperator
  4950  				err = json.Unmarshal(*v, &operator)
  4951  				if err != nil {
  4952  					return err
  4953  				}
  4954  				trc.Operator = operator
  4955  			}
  4956  		case "threshold":
  4957  			if v != nil {
  4958  				var threshold float64
  4959  				err = json.Unmarshal(*v, &threshold)
  4960  				if err != nil {
  4961  					return err
  4962  				}
  4963  				trc.Threshold = &threshold
  4964  			}
  4965  		case "windowSize":
  4966  			if v != nil {
  4967  				var windowSize string
  4968  				err = json.Unmarshal(*v, &windowSize)
  4969  				if err != nil {
  4970  					return err
  4971  				}
  4972  				trc.WindowSize = &windowSize
  4973  			}
  4974  		case "timeAggregation":
  4975  			if v != nil {
  4976  				var timeAggregation TimeAggregationOperator
  4977  				err = json.Unmarshal(*v, &timeAggregation)
  4978  				if err != nil {
  4979  					return err
  4980  				}
  4981  				trc.TimeAggregation = timeAggregation
  4982  			}
  4983  		case "dataSource":
  4984  			if v != nil {
  4985  				dataSource, err := unmarshalBasicRuleDataSource(*v)
  4986  				if err != nil {
  4987  					return err
  4988  				}
  4989  				trc.DataSource = dataSource
  4990  			}
  4991  		case "odata.type":
  4992  			if v != nil {
  4993  				var odataType OdataTypeBasicRuleCondition
  4994  				err = json.Unmarshal(*v, &odataType)
  4995  				if err != nil {
  4996  					return err
  4997  				}
  4998  				trc.OdataType = odataType
  4999  			}
  5000  		}
  5001  	}
  5002  
  5003  	return nil
  5004  }
  5005  
  5006  // TimeSeriesElement a time series result type. The discriminator value is always TimeSeries in this case.
  5007  type TimeSeriesElement struct {
  5008  	// Metadatavalues - the metadata values returned if $filter was specified in the call.
  5009  	Metadatavalues *[]MetadataValue `json:"metadatavalues,omitempty"`
  5010  	// Data - An array of data points representing the metric values.  This is only returned if a result type of data is specified.
  5011  	Data *[]MetricValue `json:"data,omitempty"`
  5012  }
  5013  
  5014  // TimeSeriesInformation the time series info needed for calculating the baseline.
  5015  type TimeSeriesInformation struct {
  5016  	// Sensitivities - the list of sensitivities for calculating the baseline.
  5017  	Sensitivities *[]string `json:"sensitivities,omitempty"`
  5018  	// Values - The metric values to calculate the baseline.
  5019  	Values *[]float64 `json:"values,omitempty"`
  5020  	// Timestamps - the array of timestamps of the baselines.
  5021  	Timestamps *[]date.Time `json:"timestamps,omitempty"`
  5022  }
  5023  
  5024  // TimeWindow a specific date-time for the profile.
  5025  type TimeWindow struct {
  5026  	// TimeZone - the timezone of the start and end times for the profile. Some examples of valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time
  5027  	TimeZone *string `json:"timeZone,omitempty"`
  5028  	// Start - the start time for the profile in ISO 8601 format.
  5029  	Start *date.Time `json:"start,omitempty"`
  5030  	// End - the end time for the profile in ISO 8601 format.
  5031  	End *date.Time `json:"end,omitempty"`
  5032  }
  5033  
  5034  // TriggerCondition the condition that results in the Log Search rule.
  5035  type TriggerCondition struct {
  5036  	// ThresholdOperator - Evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual'
  5037  	ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"`
  5038  	// Threshold - Result or count threshold based on which rule should be triggered.
  5039  	Threshold *float64 `json:"threshold,omitempty"`
  5040  	// MetricTrigger - Trigger condition for metric query rule
  5041  	MetricTrigger *LogMetricTrigger `json:"metricTrigger,omitempty"`
  5042  }
  5043  
  5044  // VoiceReceiver a voice receiver.
  5045  type VoiceReceiver struct {
  5046  	// Name - The name of the voice receiver. Names must be unique across all receivers within an action group.
  5047  	Name *string `json:"name,omitempty"`
  5048  	// CountryCode - The country code of the voice receiver.
  5049  	CountryCode *string `json:"countryCode,omitempty"`
  5050  	// PhoneNumber - The phone number of the voice receiver.
  5051  	PhoneNumber *string `json:"phoneNumber,omitempty"`
  5052  }
  5053  
  5054  // WebhookNotification webhook notification of an autoscale event.
  5055  type WebhookNotification struct {
  5056  	// ServiceURI - the service address to receive the notification.
  5057  	ServiceURI *string `json:"serviceUri,omitempty"`
  5058  	// Properties - a property bag of settings. This value can be empty.
  5059  	Properties map[string]*string `json:"properties"`
  5060  }
  5061  
  5062  // MarshalJSON is the custom marshaler for WebhookNotification.
  5063  func (wn WebhookNotification) MarshalJSON() ([]byte, error) {
  5064  	objectMap := make(map[string]interface{})
  5065  	if wn.ServiceURI != nil {
  5066  		objectMap["serviceUri"] = wn.ServiceURI
  5067  	}
  5068  	if wn.Properties != nil {
  5069  		objectMap["properties"] = wn.Properties
  5070  	}
  5071  	return json.Marshal(objectMap)
  5072  }
  5073  
  5074  // WebhookReceiver a webhook receiver.
  5075  type WebhookReceiver struct {
  5076  	// Name - The name of the webhook receiver. Names must be unique across all receivers within an action group.
  5077  	Name *string `json:"name,omitempty"`
  5078  	// ServiceURI - The URI where webhooks should be sent.
  5079  	ServiceURI *string `json:"serviceUri,omitempty"`
  5080  }
  5081  
  5082  // WebtestLocationAvailabilityCriteria specifies the metric alert rule criteria for a web test resource.
  5083  type WebtestLocationAvailabilityCriteria struct {
  5084  	// WebTestID - The Application Insights web test Id.
  5085  	WebTestID *string `json:"webTestId,omitempty"`
  5086  	// ComponentID - The Application Insights resource Id.
  5087  	ComponentID *string `json:"componentId,omitempty"`
  5088  	// FailedLocationCount - The number of failed locations.
  5089  	FailedLocationCount *float64 `json:"failedLocationCount,omitempty"`
  5090  	// AdditionalProperties - Unmatched properties from the message are deserialized this collection
  5091  	AdditionalProperties map[string]interface{} `json:""`
  5092  	// OdataType - Possible values include: 'OdataTypeMetricAlertCriteria', 'OdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria'
  5093  	OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"`
  5094  }
  5095  
  5096  // MarshalJSON is the custom marshaler for WebtestLocationAvailabilityCriteria.
  5097  func (wlac WebtestLocationAvailabilityCriteria) MarshalJSON() ([]byte, error) {
  5098  	wlac.OdataType = OdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria
  5099  	objectMap := make(map[string]interface{})
  5100  	if wlac.WebTestID != nil {
  5101  		objectMap["webTestId"] = wlac.WebTestID
  5102  	}
  5103  	if wlac.ComponentID != nil {
  5104  		objectMap["componentId"] = wlac.ComponentID
  5105  	}
  5106  	if wlac.FailedLocationCount != nil {
  5107  		objectMap["failedLocationCount"] = wlac.FailedLocationCount
  5108  	}
  5109  	if wlac.OdataType != "" {
  5110  		objectMap["odata.type"] = wlac.OdataType
  5111  	}
  5112  	for k, v := range wlac.AdditionalProperties {
  5113  		objectMap[k] = v
  5114  	}
  5115  	return json.Marshal(objectMap)
  5116  }
  5117  
  5118  // AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria.
  5119  func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) {
  5120  	return nil, false
  5121  }
  5122  
  5123  // AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria.
  5124  func (wlac WebtestLocationAvailabilityCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) {
  5125  	return &wlac, true
  5126  }
  5127  
  5128  // AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria.
  5129  func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) {
  5130  	return nil, false
  5131  }
  5132  
  5133  // AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria.
  5134  func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) {
  5135  	return nil, false
  5136  }
  5137  
  5138  // AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria.
  5139  func (wlac WebtestLocationAvailabilityCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) {
  5140  	return &wlac, true
  5141  }
  5142  
  5143  // UnmarshalJSON is the custom unmarshaler for WebtestLocationAvailabilityCriteria struct.
  5144  func (wlac *WebtestLocationAvailabilityCriteria) UnmarshalJSON(body []byte) error {
  5145  	var m map[string]*json.RawMessage
  5146  	err := json.Unmarshal(body, &m)
  5147  	if err != nil {
  5148  		return err
  5149  	}
  5150  	for k, v := range m {
  5151  		switch k {
  5152  		case "webTestId":
  5153  			if v != nil {
  5154  				var webTestID string
  5155  				err = json.Unmarshal(*v, &webTestID)
  5156  				if err != nil {
  5157  					return err
  5158  				}
  5159  				wlac.WebTestID = &webTestID
  5160  			}
  5161  		case "componentId":
  5162  			if v != nil {
  5163  				var componentID string
  5164  				err = json.Unmarshal(*v, &componentID)
  5165  				if err != nil {
  5166  					return err
  5167  				}
  5168  				wlac.ComponentID = &componentID
  5169  			}
  5170  		case "failedLocationCount":
  5171  			if v != nil {
  5172  				var failedLocationCount float64
  5173  				err = json.Unmarshal(*v, &failedLocationCount)
  5174  				if err != nil {
  5175  					return err
  5176  				}
  5177  				wlac.FailedLocationCount = &failedLocationCount
  5178  			}
  5179  		default:
  5180  			if v != nil {
  5181  				var additionalProperties interface{}
  5182  				err = json.Unmarshal(*v, &additionalProperties)
  5183  				if err != nil {
  5184  					return err
  5185  				}
  5186  				if wlac.AdditionalProperties == nil {
  5187  					wlac.AdditionalProperties = make(map[string]interface{})
  5188  				}
  5189  				wlac.AdditionalProperties[k] = additionalProperties
  5190  			}
  5191  		case "odata.type":
  5192  			if v != nil {
  5193  				var odataType OdataTypeBasicMetricAlertCriteria
  5194  				err = json.Unmarshal(*v, &odataType)
  5195  				if err != nil {
  5196  					return err
  5197  				}
  5198  				wlac.OdataType = odataType
  5199  			}
  5200  		}
  5201  	}
  5202  
  5203  	return nil
  5204  }
  5205  

View as plain text