armpreviewalertrule

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2026 License: MIT Imports: 14 Imported by: 0

README

Azure Preview Alert Rule Module for Go

The armpreviewalertrule module provides operations for working with Azure Preview Alert Rule.

Source code

Getting started

Prerequisites

  • An Azure subscription
  • Supported version of Go (You could download and install the latest version of Go from here. It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this doc.)

Install the package

This project uses Go modules for versioning and dependency management.

Install the Azure Preview Alert Rule module:

go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/previewalertrule/armpreviewalertrule

Authorization

When creating a client, you will need to provide a credential for authenticating with Azure Preview Alert Rule. The azidentity module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more.

cred, err := azidentity.NewDefaultAzureCredential(nil)

For more information on authentication, please see the documentation for azidentity at pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity.

Client Factory

Azure Preview Alert Rule module consists of one or more clients. We provide a client factory which could be used to create any client in this module.

clientFactory, err := armpreviewalertrule.NewClientFactory(cred, nil)

You can use ClientOptions in package github.com/Azure/azure-sdk-for-go/sdk/azcore/arm to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for azcore at pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore.

options := arm.ClientOptions {
    ClientOptions: azcore.ClientOptions {
        Cloud: cloud.AzureChina,
    },
}
clientFactory, err := armpreviewalertrule.NewClientFactory(cred, &options)

Clients

A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory.

client := clientFactory.()

Fakes

The fake package contains types used for constructing in-memory fake servers used in unit tests. This allows writing tests to cover various success/error conditions without the need for connecting to a live service.

Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes.

Provide Feedback

If you encounter bugs or have suggestions, please open an issue and assign the Preview Alert Rule label.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertSeverity

type AlertSeverity int64

AlertSeverity - Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. Relevant and required only for rules of the kind LogAlert.

const (
	// AlertSeverityFour - 4
	AlertSeverityFour AlertSeverity = 4
	// AlertSeverityOne - 1
	AlertSeverityOne AlertSeverity = 1
	// AlertSeverityThree - 3
	AlertSeverityThree AlertSeverity = 3
	// AlertSeverityTwo - 2
	AlertSeverityTwo AlertSeverity = 2
	// AlertSeverityZero - 0
	AlertSeverityZero AlertSeverity = 0
)

func PossibleAlertSeverityValues

func PossibleAlertSeverityValues() []AlertSeverity

PossibleAlertSeverityValues returns the possible values for the AlertSeverity const type.

type AlertState

type AlertState string

AlertState - The state of the alert after the evaluation.

const (
	// AlertStateFired - Fired
	AlertStateFired AlertState = "Fired"
	// AlertStateFiring - Firing
	AlertStateFiring AlertState = "Firing"
	// AlertStateNoAlert - NoAlert
	AlertStateNoAlert AlertState = "NoAlert"
	// AlertStateResolved - Resolved
	AlertStateResolved AlertState = "Resolved"
	// AlertStateResolving - Resolving
	AlertStateResolving AlertState = "Resolving"
)

func PossibleAlertStateValues

func PossibleAlertStateValues() []AlertState

PossibleAlertStateValues returns the possible values for the AlertState const type.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client - The Preview Alert Rule API provides the ability to retrieve the results of a simulated historical execution of an alert rule Don't use this type directly, use NewClient() instead.

func NewClient

func NewClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error)

NewClient creates a new instance of Client with the specified values.

  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*Client) PreviewAlertRule

func (client *Client) PreviewAlertRule(ctx context.Context, resourceID string, parameters Request, options *ClientPreviewAlertRuleOptions) (ClientPreviewAlertRuleResponse, error)

PreviewAlertRule - Retrieves the results of a simulated historical execution of an alert rule If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2025-07-01-preview

  • options - ClientPreviewAlertRuleOptions contains the optional parameters for the Client.PreviewAlertRule method.
Example

Generated from example definition: 2025-07-01-preview/previewDynamicThresholdLogSearchAlertRule.json

package main

import (
	"context"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/previewalertrule/armpreviewalertrule"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armpreviewalertrule.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().PreviewAlertRule(ctx, "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/myWorkspace", armpreviewalertrule.Request{
		Location: to.Ptr("eastus"),
		Properties: &armpreviewalertrule.RequestProperties{
			ScheduledQueryRuleProperties: &armpreviewalertrule.LogAlertRuleResource{
				Location: to.Ptr("eastus"),
				Properties: &armpreviewalertrule.LogAlertRuleProperties{
					Description: to.Ptr("Performance rule"),
					Criteria: &armpreviewalertrule.LogAlertRuleCriteria{
						AllOf: []*armpreviewalertrule.LogAlertRuleCondition{
							{
								AlertSensitivity: to.Ptr("Medium"),
								CriterionType:    to.Ptr(armpreviewalertrule.CriterionTypeDynamicThresholdCriterion),
								Dimensions: []*armpreviewalertrule.LogAlertRuleDimension{
									{
										Name:     to.Ptr("AlertName"),
										Operator: to.Ptr(armpreviewalertrule.DimensionOperatorInclude),
										Values: []*string{
											to.Ptr("alert"),
										},
									},
								},
								Operator:        to.Ptr(armpreviewalertrule.ConditionOperatorGreaterThan),
								Query:           to.Ptr("Alert"),
								TimeAggregation: to.Ptr(armpreviewalertrule.TimeAggregationCount),
							},
						},
					},
					Enabled:             to.Ptr(true),
					EvaluationFrequency: to.Ptr("PT1H"),
					Scopes: []*string{
						to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/myWorkspace"),
					},
					Severity:   to.Ptr(armpreviewalertrule.AlertSeverityFour),
					WindowSize: to.Ptr("PT1H"),
				},
			},
			Timespan: to.Ptr("PT24H"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res = armpreviewalertrule.ClientPreviewAlertRuleResponse{
	// 	Response: &armpreviewalertrule.Response{
	// 		RulePreviewResults: []*armpreviewalertrule.RulePreviewResult{
	// 			{
	// 				DimensionCombination: []*armpreviewalertrule.DimensionNameAndValue{
	// 					{
	// 						Name: to.Ptr("AlertName"),
	// 						Value: to.Ptr("Alert1"),
	// 					},
	// 				},
	// 				Evaluations: []*armpreviewalertrule.Evaluation{
	// 					{
	// 						AlertState: to.Ptr(armpreviewalertrule.AlertStateFired),
	// 						EvaluatedPeriods: []*armpreviewalertrule.EvaluatedPeriod{
	// 							{
	// 								HighThreshold: to.Ptr[float64](80),
	// 								LowThreshold: to.Ptr[float64](20),
	// 								MetricValue: to.Ptr[float64](85),
	// 								ThresholdMet: to.Ptr(true),
	// 								Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-15T09:00:00Z"); return t}()),
	// 							},
	// 							{
	// 								HighThreshold: to.Ptr[float64](80),
	// 								LowThreshold: to.Ptr[float64](20),
	// 								MetricValue: to.Ptr[float64](75),
	// 								ThresholdMet: to.Ptr(false),
	// 								Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-15T08:00:00Z"); return t}()),
	// 							},
	// 						},
	// 						EvaluationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-15T10:00:00Z"); return t}()),
	// 						ThresholdMet: to.Ptr(true),
	// 					},
	// 					{
	// 						AlertState: to.Ptr(armpreviewalertrule.AlertStateResolved),
	// 						EvaluatedPeriods: []*armpreviewalertrule.EvaluatedPeriod{
	// 							{
	// 								HighThreshold: to.Ptr[float64](80),
	// 								LowThreshold: to.Ptr[float64](20),
	// 								MetricValue: to.Ptr[float64](65),
	// 								ThresholdMet: to.Ptr(false),
	// 								Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-15T10:00:00Z"); return t}()),
	// 							},
	// 							{
	// 								HighThreshold: to.Ptr[float64](80),
	// 								LowThreshold: to.Ptr[float64](20),
	// 								MetricValue: to.Ptr[float64](85),
	// 								ThresholdMet: to.Ptr(true),
	// 								Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-15T09:00:00Z"); return t}()),
	// 							},
	// 						},
	// 						EvaluationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-15T11:00:00Z"); return t}()),
	// 						ThresholdMet: to.Ptr(false),
	// 					},
	// 				},
	// 			},
	// 		},
	// 	},
	// }
}

type ClientFactory

type ClientFactory struct {
	// contains filtered or unexported fields
}

ClientFactory is a client factory used to create any client in this module. Don't use this type directly, use NewClientFactory instead.

func NewClientFactory

func NewClientFactory(credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error)

NewClientFactory creates a new instance of ClientFactory with the specified values. The parameter values will be propagated to any client created from this factory.

  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*ClientFactory) NewClient

func (c *ClientFactory) NewClient() *Client

NewClient creates a new instance of Client.

type ClientPreviewAlertRuleOptions

type ClientPreviewAlertRuleOptions struct {
}

ClientPreviewAlertRuleOptions contains the optional parameters for the Client.PreviewAlertRule method.

type ClientPreviewAlertRuleResponse

type ClientPreviewAlertRuleResponse struct {
	Response
}

ClientPreviewAlertRuleResponse contains the response from method Client.PreviewAlertRule.

type ConditionOperator

type ConditionOperator string

ConditionOperator - The criteria operator. Relevant and required only for rules of the kind LogAlert.

const (
	// ConditionOperatorEquals - Equals
	ConditionOperatorEquals ConditionOperator = "Equals"
	// ConditionOperatorGreaterOrLessThan - GreaterOrLessThan
	ConditionOperatorGreaterOrLessThan ConditionOperator = "GreaterOrLessThan"
	// ConditionOperatorGreaterThan - GreaterThan
	ConditionOperatorGreaterThan ConditionOperator = "GreaterThan"
	// ConditionOperatorGreaterThanOrEqual - GreaterThanOrEqual
	ConditionOperatorGreaterThanOrEqual ConditionOperator = "GreaterThanOrEqual"
	// ConditionOperatorLessThan - LessThan
	ConditionOperatorLessThan ConditionOperator = "LessThan"
	// ConditionOperatorLessThanOrEqual - LessThanOrEqual
	ConditionOperatorLessThanOrEqual ConditionOperator = "LessThanOrEqual"
)

func PossibleConditionOperatorValues

func PossibleConditionOperatorValues() []ConditionOperator

PossibleConditionOperatorValues returns the possible values for the ConditionOperator const type.

type CriterionType

type CriterionType string

CriterionType - Specifies the type of threshold criteria

const (
	// CriterionTypeDynamicThresholdCriterion - DynamicThresholdCriterion
	CriterionTypeDynamicThresholdCriterion CriterionType = "DynamicThresholdCriterion"
	// CriterionTypeStaticThresholdCriterion - StaticThresholdCriterion
	CriterionTypeStaticThresholdCriterion CriterionType = "StaticThresholdCriterion"
)

func PossibleCriterionTypeValues

func PossibleCriterionTypeValues() []CriterionType

PossibleCriterionTypeValues returns the possible values for the CriterionType const type.

type DimensionNameAndValue

type DimensionNameAndValue struct {
	// REQUIRED; Name of the dimension
	Name *string

	// REQUIRED; Value of the dimension
	Value *string
}

DimensionNameAndValue - Dimension name and value

func (DimensionNameAndValue) MarshalJSON

func (d DimensionNameAndValue) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type DimensionNameAndValue.

func (*DimensionNameAndValue) UnmarshalJSON

func (d *DimensionNameAndValue) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type DimensionNameAndValue.

type DimensionOperator

type DimensionOperator string

DimensionOperator - Operator for dimension values

const (
	// DimensionOperatorExclude - Exclude
	DimensionOperatorExclude DimensionOperator = "Exclude"
	// DimensionOperatorInclude - Include
	DimensionOperatorInclude DimensionOperator = "Include"
)

func PossibleDimensionOperatorValues

func PossibleDimensionOperatorValues() []DimensionOperator

PossibleDimensionOperatorValues returns the possible values for the DimensionOperator const type.

type EvaluatedPeriod

type EvaluatedPeriod struct {
	// The high threshold value for the evaluation period.
	HighThreshold *float64

	// The low threshold value for the evaluation period.
	LowThreshold *float64

	// The metric value for the evaluation period.
	MetricValue *float64

	// Indicates whether the threshold was met during the evaluation period.
	ThresholdMet *bool

	// The timestamp of the evaluated period.
	Timestamp *time.Time
}

EvaluatedPeriod - Details of the evaluated period.

func (EvaluatedPeriod) MarshalJSON

func (e EvaluatedPeriod) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type EvaluatedPeriod.

func (*EvaluatedPeriod) UnmarshalJSON

func (e *EvaluatedPeriod) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type EvaluatedPeriod.

type Evaluation

type Evaluation struct {
	// The state of the alert after the evaluation.
	AlertState *AlertState

	// An array of evaluated periods.
	EvaluatedPeriods []*EvaluatedPeriod

	// The time when the evaluation was performed.
	EvaluationTime *time.Time

	// Indicates whether the threshold was met for this evaluation.
	ThresholdMet *bool
}

Evaluation - An evaluation of the alert rule.

func (Evaluation) MarshalJSON

func (e Evaluation) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Evaluation.

func (*Evaluation) UnmarshalJSON

func (e *Evaluation) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Evaluation.

type Kind

type Kind string

Kind - Indicates the type of scheduled query rule. The default is LogAlert.

const (
	// KindEventLogAlert - EventLogAlert
	KindEventLogAlert Kind = "EventLogAlert"
	// KindLogAlert - LogAlert
	KindLogAlert Kind = "LogAlert"
	// KindLogToMetric - LogToMetric
	KindLogToMetric Kind = "LogToMetric"
)

func PossibleKindValues

func PossibleKindValues() []Kind

PossibleKindValues returns the possible values for the Kind const type.

type LogAlertRuleCondition

type LogAlertRuleCondition struct {
	// The extent of deviation required to trigger an alert. Allowed values are 'Low', 'Medium' and 'High'. This will affect how
	// tight the threshold is to the metric series pattern. Relevant and required only for dynamic threshold rules of the kind
	// LogAlert.
	AlertSensitivity *string

	// Specifies the type of threshold criteria
	CriterionType *CriterionType

	// List of Dimensions conditions
	Dimensions []*LogAlertRuleDimension

	// The minimum number of violations required within the selected lookback time window required to raise an alert. Relevant
	// only for rules of the kind LogAlert.
	FailingPeriods *LogAlertRuleConditionFailingPeriods

	// Use this option to set the date from which to start learning the metric historical data and calculate the dynamic thresholds
	// (in ISO8601 format). Relevant only for dynamic threshold rules of the kind LogAlert.
	IgnoreDataBefore *time.Time

	// The column containing the metric measure number. Relevant only for rules of the kind LogAlert.
	MetricMeasureColumn *string

	// The name of the metric to be sent. Relevant and required only for rules of the kind LogToMetric.
	MetricName *string

	// The criteria operator. Relevant and required only for rules of the kind LogAlert.
	Operator *ConditionOperator

	// KQL log query alert
	Query *string

	// The column containing the resource id. The content of the column must be a uri formatted as resource id. Relevant only
	// for rules of the kind LogAlert.
	ResourceIDColumn *string

	// the criteria threshold value that activates the alert. Relevant and required only for static threshold rules of the kind
	// LogAlert.
	Threshold *float64

	// Aggregation type. Relevant and required only for rules of the kind LogAlert.
	TimeAggregation *TimeAggregation
}

LogAlertRuleCondition - A condition of the scheduled query rule.

func (LogAlertRuleCondition) MarshalJSON

func (l LogAlertRuleCondition) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type LogAlertRuleCondition.

func (*LogAlertRuleCondition) UnmarshalJSON

func (l *LogAlertRuleCondition) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type LogAlertRuleCondition.

type LogAlertRuleConditionFailingPeriods

type LogAlertRuleConditionFailingPeriods struct {
	// The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. Default value is
	// 1
	MinFailingPeriodsToAlert *int64

	// The number of aggregated lookback points. The lookback time window is calculated based on the aggregation granularity (windowSize)
	// and the selected number of aggregated points. Default value is 1
	NumberOfEvaluationPeriods *int64
}

LogAlertRuleConditionFailingPeriods - The minimum number of violations required within the selected lookback time window required to raise an alert. Relevant only for rules of the kind LogAlert.

func (LogAlertRuleConditionFailingPeriods) MarshalJSON

func (l LogAlertRuleConditionFailingPeriods) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type LogAlertRuleConditionFailingPeriods.

func (*LogAlertRuleConditionFailingPeriods) UnmarshalJSON

func (l *LogAlertRuleConditionFailingPeriods) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type LogAlertRuleConditionFailingPeriods.

type LogAlertRuleCriteria

type LogAlertRuleCriteria struct {
	// A list of conditions to evaluate against the specified scopes
	AllOf []*LogAlertRuleCondition
}

LogAlertRuleCriteria - The rule criteria that defines the conditions of the scheduled query rule.

func (LogAlertRuleCriteria) MarshalJSON

func (l LogAlertRuleCriteria) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type LogAlertRuleCriteria.

func (*LogAlertRuleCriteria) UnmarshalJSON

func (l *LogAlertRuleCriteria) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type LogAlertRuleCriteria.

type LogAlertRuleDimension

type LogAlertRuleDimension struct {
	// REQUIRED; Name of the dimension
	Name *string

	// REQUIRED; Operator for dimension values
	Operator *DimensionOperator

	// REQUIRED; List of dimension values
	Values []*string
}

LogAlertRuleDimension - Dimension splitting and filtering definition

func (LogAlertRuleDimension) MarshalJSON

func (l LogAlertRuleDimension) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type LogAlertRuleDimension.

func (*LogAlertRuleDimension) UnmarshalJSON

func (l *LogAlertRuleDimension) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type LogAlertRuleDimension.

type LogAlertRuleProperties

type LogAlertRuleProperties struct {
	// The rule criteria that defines the conditions of the scheduled query rule.
	Criteria *LogAlertRuleCriteria

	// The description of the scheduled query rule.
	Description *string

	// The display name of the alert rule
	DisplayName *string

	// The flag which indicates whether this scheduled query rule is enabled. Value should be true or false
	Enabled *bool

	// How often the scheduled query rule is evaluated represented in ISO 8601 duration format. Relevant and required only for
	// rules of the kind LogAlert.
	EvaluationFrequency *string

	// If specified then overrides the query time range (default is WindowSize*NumberOfEvaluationPeriods). Relevant only for rules
	// of the kind LogAlert.
	OverrideQueryTimeRange *string

	// The list of resource id's that this scheduled query rule is scoped to.
	Scopes []*string

	// Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. Relevant and required only for rules
	// of the kind LogAlert.
	Severity *AlertSeverity

	// List of resource type of the target resource(s) on which the alert is created/updated. For example if the scope is a resource
	// group and targetResourceTypes is Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual
	// machine in the resource group which meet the alert criteria. Relevant only for rules of the kind LogAlert
	TargetResourceTypes []*string

	// The period of time (in ISO 8601 duration format) on which the Alert query will be executed (bin size). Relevant and required
	// only for rules of the kind LogAlert.
	WindowSize *string
}

LogAlertRuleProperties - scheduled query rule Definition

func (LogAlertRuleProperties) MarshalJSON

func (l LogAlertRuleProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type LogAlertRuleProperties.

func (*LogAlertRuleProperties) UnmarshalJSON

func (l *LogAlertRuleProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type LogAlertRuleProperties.

type LogAlertRuleResource

type LogAlertRuleResource struct {
	// REQUIRED; The geo-location where the resource lives
	Location *string

	// REQUIRED; The rule properties of the resource.
	Properties *LogAlertRuleProperties

	// Indicates the type of scheduled query rule. The default is LogAlert.
	Kind *Kind

	// Resource tags.
	Tags map[string]*string
}

LogAlertRuleResource - The scheduled query rule resource.

func (LogAlertRuleResource) MarshalJSON

func (l LogAlertRuleResource) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type LogAlertRuleResource.

func (*LogAlertRuleResource) UnmarshalJSON

func (l *LogAlertRuleResource) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type LogAlertRuleResource.

type Request

type Request struct {
	// REQUIRED; The location of the rule resource.
	Location *string

	// REQUIRED
	Properties *RequestProperties
}

func (Request) MarshalJSON

func (r Request) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Request.

func (*Request) UnmarshalJSON

func (r *Request) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Request.

type RequestProperties

type RequestProperties struct {
	// REQUIRED; Specifies the timespan of the preview in ISO 8601 duration format.
	Timespan *string

	// The properties of the alert rule to preview.
	ScheduledQueryRuleProperties *LogAlertRuleResource
}

func (RequestProperties) MarshalJSON

func (r RequestProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RequestProperties.

func (*RequestProperties) UnmarshalJSON

func (r *RequestProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type RequestProperties.

type Response

type Response struct {
	// An array of rule preview results.
	RulePreviewResults []*RulePreviewResult
}

func (Response) MarshalJSON

func (r Response) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Response.

func (*Response) UnmarshalJSON

func (r *Response) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Response.

type RulePreviewResult

type RulePreviewResult struct {
	// The list of dimensions for the evaluation.
	DimensionCombination []*DimensionNameAndValue

	// An array of evaluations.
	Evaluations []*Evaluation
}

RulePreviewResult - A rule preview result containing a dimension combination and an array of evaluations.

func (RulePreviewResult) MarshalJSON

func (r RulePreviewResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type RulePreviewResult.

func (*RulePreviewResult) UnmarshalJSON

func (r *RulePreviewResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type RulePreviewResult.

type TimeAggregation

type TimeAggregation string

TimeAggregation - Aggregation type. Relevant and required only for rules of the kind LogAlert.

const (
	// TimeAggregationAverage - Average
	TimeAggregationAverage TimeAggregation = "Average"
	// TimeAggregationCount - Count
	TimeAggregationCount TimeAggregation = "Count"
	// TimeAggregationMaximum - Maximum
	TimeAggregationMaximum TimeAggregation = "Maximum"
	// TimeAggregationMinimum - Minimum
	TimeAggregationMinimum TimeAggregation = "Minimum"
	// TimeAggregationTotal - Total
	TimeAggregationTotal TimeAggregation = "Total"
)

func PossibleTimeAggregationValues

func PossibleTimeAggregationValues() []TimeAggregation

PossibleTimeAggregationValues returns the possible values for the TimeAggregation const type.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL