armalertprocessingrules

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 Alert Processing Rules Module for Go

The armalertprocessingrules module provides operations for working with Azure Alert Processing Rules.

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 Alert Processing Rules module:

go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertprocessingrules/armalertprocessingrules

Authorization

When creating a client, you will need to provide a credential for authenticating with Azure Alert Processing Rules. 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 Alert Processing Rules 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 := armalertprocessingrules.NewClientFactory(<subscription ID>, 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 := armalertprocessingrules.NewClientFactory(<subscription ID>, 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.NewClient()

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 Alertprocessingrules 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 Action

type Action struct {
	// REQUIRED; Action that should be applied.
	ActionType *ActionType
}

Action to be applied.

func (*Action) GetAction

func (a *Action) GetAction() *Action

GetAction implements the ActionClassification interface for type Action.

func (Action) MarshalJSON

func (a Action) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Action.

func (*Action) UnmarshalJSON

func (a *Action) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Action.

type ActionClassification

type ActionClassification interface {
	// GetAction returns the Action content of the underlying type.
	GetAction() *Action
}

ActionClassification provides polymorphic access to related types. Call the interface's GetAction() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *Action, *AddActionGroups, *RemoveAllActionGroups

type ActionType

type ActionType string

ActionType - Action that should be applied.

const (
	// ActionTypeAddActionGroups - AddActionGroups
	ActionTypeAddActionGroups ActionType = "AddActionGroups"
	// ActionTypeRemoveAllActionGroups - RemoveAllActionGroups
	ActionTypeRemoveAllActionGroups ActionType = "RemoveAllActionGroups"
)

func PossibleActionTypeValues

func PossibleActionTypeValues() []ActionType

PossibleActionTypeValues returns the possible values for the ActionType const type.

type AddActionGroups

type AddActionGroups struct {
	// REQUIRED; List of action group Ids to add to alert processing rule.
	ActionGroupIDs []*string

	// CONSTANT; Action that should be applied.
	// Field has constant value ActionTypeAddActionGroups, any specified value is ignored.
	ActionType *ActionType
}

AddActionGroups - Add action groups to alert processing rule.

func (*AddActionGroups) GetAction

func (a *AddActionGroups) GetAction() *Action

GetAction implements the ActionClassification interface for type AddActionGroups.

func (AddActionGroups) MarshalJSON

func (a AddActionGroups) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AddActionGroups.

func (*AddActionGroups) UnmarshalJSON

func (a *AddActionGroups) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AddActionGroups.

type AlertProcessingRule

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

	// Alert processing rule properties.
	Properties *AlertProcessingRuleProperties

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

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
	ID *string

	// READ-ONLY; The name of the resource
	Name *string

	// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
	SystemData *SystemData

	// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string
}

AlertProcessingRule - Alert processing rule object containing target scopes, conditions and scheduling logic.

func (AlertProcessingRule) MarshalJSON

func (a AlertProcessingRule) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AlertProcessingRule.

func (*AlertProcessingRule) UnmarshalJSON

func (a *AlertProcessingRule) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AlertProcessingRule.

type AlertProcessingRuleProperties

type AlertProcessingRuleProperties struct {
	// REQUIRED; Actions to be applied.
	Actions []ActionClassification

	// REQUIRED; Scopes on which alert processing rule will apply.
	Scopes []*string

	// Conditions on which alerts will be filtered.
	Conditions []*Condition

	// Actions to be applied.Description of alert processing rule.
	Description *string

	// Indicates if the given alert processing rule is enabled or disabled.
	Enabled *bool

	// Scheduling for alert processing rule.
	Schedule *Schedule
}

AlertProcessingRuleProperties - Alert processing rule properties defining scopes, conditions and scheduling logic for alert processing rule.

func (AlertProcessingRuleProperties) MarshalJSON

func (a AlertProcessingRuleProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type AlertProcessingRuleProperties.

func (*AlertProcessingRuleProperties) UnmarshalJSON

func (a *AlertProcessingRuleProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type AlertProcessingRuleProperties.

type Client

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

Client contains the methods for the service. Don't use this type directly, use NewClient() instead.

func NewClient

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

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

  • subscriptionID - The ID of the target subscription. The value must be an UUID.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - Contains optional client configuration. Pass nil to accept the default values.

func (*Client) CreateOrUpdate

func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, alertProcessingRuleName string, alertProcessingRule AlertProcessingRule, options *ClientCreateOrUpdateOptions) (ClientCreateOrUpdateResponse, error)

CreateOrUpdate - Create or update an alert processing rule. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2021-08-08

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • alertProcessingRuleName - The name of the alert processing rule that needs to be fetched.
  • alertProcessingRule - Alert processing rule to be created/updated.
  • options - ClientCreateOrUpdateOptions contains the optional parameters for the Client.CreateOrUpdate method.
Example (CreateOrUpdateARuleThatAddsAnActionGroupToAllAlertsInASubscription)

Generated from example definition: 2021-08-08/AlertProcessingRules_Create_or_update_add_action_group_all_alerts_in_subscription.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/alertprocessingrules/armalertprocessingrules"
	"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 := armalertprocessingrules.NewClientFactory("subId1", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().CreateOrUpdate(ctx, "alertscorrelationrg", "AddActionGroupToSubscription", armalertprocessingrules.AlertProcessingRule{
		Location: to.Ptr("Global"),
		Properties: &armalertprocessingrules.AlertProcessingRuleProperties{
			Description: to.Ptr("Add ActionGroup1 to all alerts in the subscription"),
			Actions: []armalertprocessingrules.ActionClassification{
				&armalertprocessingrules.AddActionGroups{
					ActionGroupIDs: []*string{
						to.Ptr("/subscriptions/subId1/resourcegroups/RGId1/providers/microsoft.insights/actiongroups/ActionGroup1"),
					},
					ActionType: to.Ptr(armalertprocessingrules.ActionTypeAddActionGroups),
				},
			},
			Enabled: to.Ptr(true),
			Scopes: []*string{
				to.Ptr("/subscriptions/subId1"),
			},
		},
		Tags: map[string]*string{},
	}, 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 = armalertprocessingrules.ClientCreateOrUpdateResponse{
	// 	AlertProcessingRule: &armalertprocessingrules.AlertProcessingRule{
	// 		Name: to.Ptr("AddActionGroupToSubscription"),
	// 		Type: to.Ptr("Microsoft.AlertsManagement/actionRules"),
	// 		ID: to.Ptr("/subscriptions/subId1/resourceGroups/alertscorrelationrg/providers/Microsoft.AlertsManagement/actionRules/AddActionGroupToSubscription"),
	// 		Location: to.Ptr("Global"),
	// 		Properties: &armalertprocessingrules.AlertProcessingRuleProperties{
	// 			Description: to.Ptr("Add ActionGroup1 to all alerts in the subscription"),
	// 			Actions: []armalertprocessingrules.ActionClassification{
	// 				&armalertprocessingrules.AddActionGroups{
	// 					ActionGroupIDs: []*string{
	// 						to.Ptr("/subscriptions/subId1/resourcegroups/RGId1/providers/microsoft.insights/actiongroups/ActionGroup1"),
	// 					},
	// 					ActionType: to.Ptr(armalertprocessingrules.ActionTypeAddActionGroups),
	// 				},
	// 			},
	// 			Enabled: to.Ptr(true),
	// 			Scopes: []*string{
	// 				to.Ptr("/subscriptions/subId1"),
	// 			},
	// 		},
	// 		SystemData: &armalertprocessingrules.SystemData{
	// 			CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-02-12T22:05:09Z"); return t}()),
	// 			CreatedBy: to.Ptr("abc@microsoft.com"),
	// 			CreatedByType: to.Ptr(armalertprocessingrules.CreatedByTypeUser),
	// 			LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-02-13T16:15:34Z"); return t}()),
	// 			LastModifiedBy: to.Ptr("xyz@microsoft.com"),
	// 			LastModifiedByType: to.Ptr(armalertprocessingrules.CreatedByTypeUser),
	// 		},
	// 		Tags: map[string]*string{
	// 		},
	// 	},
	// }
}
Example (CreateOrUpdateARuleThatAddsTwoActionGroupsToAllSev0AndSev1AlertsInTwoResourceGroups)

Generated from example definition: 2021-08-08/AlertProcessingRules_Create_or_update_add_two_action_groups_all_Sev0_Sev1_two_resource_groups.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/alertprocessingrules/armalertprocessingrules"
	"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 := armalertprocessingrules.NewClientFactory("subId1", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().CreateOrUpdate(ctx, "alertscorrelationrg", "AddActionGroupsBySeverity", armalertprocessingrules.AlertProcessingRule{
		Location: to.Ptr("Global"),
		Properties: &armalertprocessingrules.AlertProcessingRuleProperties{
			Description: to.Ptr("Add AGId1 and AGId2 to all Sev0 and Sev1 alerts in these resourceGroups"),
			Actions: []armalertprocessingrules.ActionClassification{
				&armalertprocessingrules.AddActionGroups{
					ActionGroupIDs: []*string{
						to.Ptr("/subscriptions/subId1/resourcegroups/RGId1/providers/microsoft.insights/actiongroups/AGId1"),
						to.Ptr("/subscriptions/subId1/resourcegroups/RGId1/providers/microsoft.insights/actiongroups/AGId2"),
					},
					ActionType: to.Ptr(armalertprocessingrules.ActionTypeAddActionGroups),
				},
			},
			Conditions: []*armalertprocessingrules.Condition{
				{
					Field:    to.Ptr(armalertprocessingrules.FieldSeverity),
					Operator: to.Ptr(armalertprocessingrules.OperatorEquals),
					Values: []*string{
						to.Ptr("sev0"),
						to.Ptr("sev1"),
					},
				},
			},
			Enabled: to.Ptr(true),
			Scopes: []*string{
				to.Ptr("/subscriptions/subId1/resourceGroups/RGId1"),
				to.Ptr("/subscriptions/subId1/resourceGroups/RGId2"),
			},
		},
		Tags: map[string]*string{},
	}, 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 = armalertprocessingrules.ClientCreateOrUpdateResponse{
	// 	AlertProcessingRule: &armalertprocessingrules.AlertProcessingRule{
	// 		Name: to.Ptr("AddActionGroupsBySeverity"),
	// 		Type: to.Ptr("Microsoft.AlertsManagement/actionRules"),
	// 		ID: to.Ptr("/subscriptions/subId1/resourceGroups/alertscorrelationrg/providers/Microsoft.AlertsManagement/actionRules/AddActionGroupsBySeverity"),
	// 		Location: to.Ptr("Global"),
	// 		Properties: &armalertprocessingrules.AlertProcessingRuleProperties{
	// 			Description: to.Ptr("Add AGId1 and AGId2 to all Sev0 and Sev1 alerts in these resourceGroups"),
	// 			Actions: []armalertprocessingrules.ActionClassification{
	// 				&armalertprocessingrules.AddActionGroups{
	// 					ActionGroupIDs: []*string{
	// 						to.Ptr("/subscriptions/subId1/resourcegroups/RGId1/providers/microsoft.insights/actiongroups/AGId1"),
	// 						to.Ptr("/subscriptions/subId1/resourcegroups/RGId1/providers/microsoft.insights/actiongroups/AGId2"),
	// 					},
	// 					ActionType: to.Ptr(armalertprocessingrules.ActionTypeAddActionGroups),
	// 				},
	// 			},
	// 			Conditions: []*armalertprocessingrules.Condition{
	// 				{
	// 					Field: to.Ptr(armalertprocessingrules.FieldSeverity),
	// 					Operator: to.Ptr(armalertprocessingrules.OperatorEquals),
	// 					Values: []*string{
	// 						to.Ptr("sev0"),
	// 						to.Ptr("sev1"),
	// 					},
	// 				},
	// 			},
	// 			Enabled: to.Ptr(true),
	// 			Scopes: []*string{
	// 				to.Ptr("/subscriptions/subId1/resourceGroups/RGId1"),
	// 				to.Ptr("/subscriptions/subId1/resourceGroups/RGId2"),
	// 			},
	// 		},
	// 		SystemData: &armalertprocessingrules.SystemData{
	// 			CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09Z"); return t}()),
	// 			CreatedBy: to.Ptr("abc@microsoft.com"),
	// 			CreatedByType: to.Ptr(armalertprocessingrules.CreatedByTypeUser),
	// 			LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-13T22:05:09Z"); return t}()),
	// 			LastModifiedBy: to.Ptr("xyz@microsoft.com"),
	// 			LastModifiedByType: to.Ptr(armalertprocessingrules.CreatedByTypeUser),
	// 		},
	// 		Tags: map[string]*string{
	// 		},
	// 	},
	// }
}
Example (CreateOrUpdateARuleThatRemovesAllActionGroupsFromAlertsOnASpecificVMDuringAOneOffMaintenanceWindow18002000AtASpecificDatePacificStandardTime)

Generated from example definition: 2021-08-08/AlertProcessingRules_Create_or_update_remove_all_action_groups_specific_VM_one-off_maintenance_window.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/alertprocessingrules/armalertprocessingrules"
	"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 := armalertprocessingrules.NewClientFactory("subId1", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().CreateOrUpdate(ctx, "alertscorrelationrg", "RemoveActionGroupsMaintenanceWindow", armalertprocessingrules.AlertProcessingRule{
		Location: to.Ptr("Global"),
		Properties: &armalertprocessingrules.AlertProcessingRuleProperties{
			Description: to.Ptr("Removes all ActionGroups from all Alerts on VMName during the maintenance window"),
			Actions: []armalertprocessingrules.ActionClassification{
				&armalertprocessingrules.RemoveAllActionGroups{
					ActionType: to.Ptr(armalertprocessingrules.ActionTypeRemoveAllActionGroups),
				},
			},
			Enabled: to.Ptr(true),
			Schedule: &armalertprocessingrules.Schedule{
				EffectiveFrom:  to.Ptr("2021-04-15T18:00:00"),
				EffectiveUntil: to.Ptr("2021-04-15T20:00:00"),
				TimeZone:       to.Ptr("Pacific Standard Time"),
			},
			Scopes: []*string{
				to.Ptr("/subscriptions/subId1/resourceGroups/RGId1/providers/Microsoft.Compute/virtualMachines/VMName"),
			},
		},
		Tags: map[string]*string{},
	}, 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 = armalertprocessingrules.ClientCreateOrUpdateResponse{
	// 	AlertProcessingRule: &armalertprocessingrules.AlertProcessingRule{
	// 		Name: to.Ptr("RemoveActionGroupsMaintenanceWindow"),
	// 		Type: to.Ptr("Microsoft.AlertsManagement/actionRules"),
	// 		ID: to.Ptr("/subscriptions/subId1/resourceGroups/alertscorrelationrg/providers/Microsoft.AlertsManagement/actionRules/RemoveActionGroupsMaintenanceWindow"),
	// 		Location: to.Ptr("Global"),
	// 		Properties: &armalertprocessingrules.AlertProcessingRuleProperties{
	// 			Description: to.Ptr("Removes all ActionGroups from all Alerts on VMName during the maintenance window"),
	// 			Actions: []armalertprocessingrules.ActionClassification{
	// 				&armalertprocessingrules.RemoveAllActionGroups{
	// 					ActionType: to.Ptr(armalertprocessingrules.ActionTypeRemoveAllActionGroups),
	// 				},
	// 			},
	// 			Enabled: to.Ptr(true),
	// 			Schedule: &armalertprocessingrules.Schedule{
	// 				EffectiveFrom: to.Ptr("2021-04-15T18:00:00"),
	// 				EffectiveUntil: to.Ptr("2021-04-15T20:00:00"),
	// 				TimeZone: to.Ptr("Pacific Standard Time"),
	// 			},
	// 			Scopes: []*string{
	// 				to.Ptr("/subscriptions/subId1/resourceGroups/RGId1/providers/Microsoft.Compute/virtualMachines/VMName"),
	// 			},
	// 		},
	// 		SystemData: &armalertprocessingrules.SystemData{
	// 			CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T20:13:29Z"); return t}()),
	// 			CreatedBy: to.Ptr("abc@microsoft.com"),
	// 			CreatedByType: to.Ptr(armalertprocessingrules.CreatedByTypeUser),
	// 			LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09Z"); return t}()),
	// 			LastModifiedBy: to.Ptr("xyz@microsoft.com"),
	// 			LastModifiedByType: to.Ptr(armalertprocessingrules.CreatedByTypeUser),
	// 		},
	// 		Tags: map[string]*string{
	// 		},
	// 	},
	// }
}
Example (CreateOrUpdateARuleThatRemovesAllActionGroupsFromAllAlertsInASubscriptionComingFromASpecificAlertRule)

Generated from example definition: 2021-08-08/AlertProcessingRules_Create_or_update_remove_all_action_groups_from_specific_alert_rule.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/alertprocessingrules/armalertprocessingrules"
	"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 := armalertprocessingrules.NewClientFactory("subId1", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().CreateOrUpdate(ctx, "alertscorrelationrg", "RemoveActionGroupsSpecificAlertRule", armalertprocessingrules.AlertProcessingRule{
		Location: to.Ptr("Global"),
		Properties: &armalertprocessingrules.AlertProcessingRuleProperties{
			Description: to.Ptr("Removes all ActionGroups from all Alerts that fire on above AlertRule"),
			Actions: []armalertprocessingrules.ActionClassification{
				&armalertprocessingrules.RemoveAllActionGroups{
					ActionType: to.Ptr(armalertprocessingrules.ActionTypeRemoveAllActionGroups),
				},
			},
			Conditions: []*armalertprocessingrules.Condition{
				{
					Field:    to.Ptr(armalertprocessingrules.FieldAlertRuleID),
					Operator: to.Ptr(armalertprocessingrules.OperatorEquals),
					Values: []*string{
						to.Ptr("/subscriptions/suubId1/resourceGroups/Rgid2/providers/microsoft.insights/activityLogAlerts/RuleName"),
					},
				},
			},
			Enabled: to.Ptr(true),
			Scopes: []*string{
				to.Ptr("/subscriptions/subId1"),
			},
		},
		Tags: map[string]*string{},
	}, 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 = armalertprocessingrules.ClientCreateOrUpdateResponse{
	// 	AlertProcessingRule: &armalertprocessingrules.AlertProcessingRule{
	// 		Name: to.Ptr("RemoveActionGroupsSpecificAlertRule"),
	// 		Type: to.Ptr("Microsoft.AlertsManagement/actionRules"),
	// 		ID: to.Ptr("/subscriptions/subId1/resourceGroups/alertscorrelationrg/providers/Microsoft.AlertsManagement/actionRules/RemoveActionGroupsSpecificAlertRule"),
	// 		Location: to.Ptr("Global"),
	// 		Properties: &armalertprocessingrules.AlertProcessingRuleProperties{
	// 			Description: to.Ptr("Removes all ActionGroups from all Alerts that fire on above AlertRule"),
	// 			Actions: []armalertprocessingrules.ActionClassification{
	// 				&armalertprocessingrules.RemoveAllActionGroups{
	// 					ActionType: to.Ptr(armalertprocessingrules.ActionTypeRemoveAllActionGroups),
	// 				},
	// 			},
	// 			Conditions: []*armalertprocessingrules.Condition{
	// 				{
	// 					Field: to.Ptr(armalertprocessingrules.FieldAlertRuleID),
	// 					Operator: to.Ptr(armalertprocessingrules.OperatorEquals),
	// 					Values: []*string{
	// 						to.Ptr("/subscriptions/suubId1/resourceGroups/Rgid2/providers/microsoft.insights/activityLogAlerts/RuleName"),
	// 					},
	// 				},
	// 			},
	// 			Enabled: to.Ptr(true),
	// 			Scopes: []*string{
	// 				to.Ptr("/subscriptions/subId1"),
	// 			},
	// 		},
	// 		SystemData: &armalertprocessingrules.SystemData{
	// 			CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T22:05:09Z"); return t}()),
	// 			CreatedBy: to.Ptr("abc@microsoft.com"),
	// 			CreatedByType: to.Ptr(armalertprocessingrules.CreatedByTypeUser),
	// 			LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09Z"); return t}()),
	// 			LastModifiedBy: to.Ptr("xyz@microsoft.com"),
	// 			LastModifiedByType: to.Ptr(armalertprocessingrules.CreatedByTypeUser),
	// 		},
	// 		Tags: map[string]*string{
	// 		},
	// 	},
	// }
}
Example (CreateOrUpdateARuleThatRemovesAllActionGroupsFromAllAlertsOnAnyVMInTwoResourceGroupsDuringARecurringMaintenanceWindow22000400EverySatAndSunIndiaStandardTime)

Generated from example definition: 2021-08-08/AlertProcessingRules_Create_or_update_remove_all_action_groups_recurring_maintenance_window.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/alertprocessingrules/armalertprocessingrules"
	"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 := armalertprocessingrules.NewClientFactory("subId1", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().CreateOrUpdate(ctx, "alertscorrelationrg", "RemoveActionGroupsRecurringMaintenance", armalertprocessingrules.AlertProcessingRule{
		Location: to.Ptr("Global"),
		Properties: &armalertprocessingrules.AlertProcessingRuleProperties{
			Description: to.Ptr("Remove all ActionGroups from all Vitual machine Alerts during the recurring maintenance"),
			Actions: []armalertprocessingrules.ActionClassification{
				&armalertprocessingrules.RemoveAllActionGroups{
					ActionType: to.Ptr(armalertprocessingrules.ActionTypeRemoveAllActionGroups),
				},
			},
			Conditions: []*armalertprocessingrules.Condition{
				{
					Field:    to.Ptr(armalertprocessingrules.FieldTargetResourceType),
					Operator: to.Ptr(armalertprocessingrules.OperatorEquals),
					Values: []*string{
						to.Ptr("microsoft.compute/virtualmachines"),
					},
				},
			},
			Enabled: to.Ptr(true),
			Schedule: &armalertprocessingrules.Schedule{
				Recurrences: []armalertprocessingrules.RecurrenceClassification{
					&armalertprocessingrules.WeeklyRecurrence{
						DaysOfWeek: []*armalertprocessingrules.DaysOfWeek{
							to.Ptr(armalertprocessingrules.DaysOfWeekSaturday),
							to.Ptr(armalertprocessingrules.DaysOfWeekSunday),
						},
						EndTime:        to.Ptr("04:00:00"),
						RecurrenceType: to.Ptr(armalertprocessingrules.RecurrenceTypeWeekly),
						StartTime:      to.Ptr("22:00:00"),
					},
				},
				TimeZone: to.Ptr("India Standard Time"),
			},
			Scopes: []*string{
				to.Ptr("/subscriptions/subId1/resourceGroups/RGId1"),
				to.Ptr("/subscriptions/subId1/resourceGroups/RGId2"),
			},
		},
		Tags: map[string]*string{},
	}, 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 = armalertprocessingrules.ClientCreateOrUpdateResponse{
	// 	AlertProcessingRule: &armalertprocessingrules.AlertProcessingRule{
	// 		Name: to.Ptr("RemoveActionGroupsRecurringMaintenance"),
	// 		Type: to.Ptr("Microsoft.AlertsManagement/actionRules"),
	// 		ID: to.Ptr("/subscriptions/subId1/resourceGroups/alertscorrelationrg/providers/Microsoft.AlertsManagement/actionRules/RemoveActionGroupsRecurringMaintenance"),
	// 		Location: to.Ptr("Global"),
	// 		Properties: &armalertprocessingrules.AlertProcessingRuleProperties{
	// 			Description: to.Ptr("Remove all ActionGroups from all Vitual machine Alerts during the recurring maintenance"),
	// 			Actions: []armalertprocessingrules.ActionClassification{
	// 				&armalertprocessingrules.RemoveAllActionGroups{
	// 					ActionType: to.Ptr(armalertprocessingrules.ActionTypeRemoveAllActionGroups),
	// 				},
	// 			},
	// 			Conditions: []*armalertprocessingrules.Condition{
	// 				{
	// 					Field: to.Ptr(armalertprocessingrules.FieldTargetResourceType),
	// 					Operator: to.Ptr(armalertprocessingrules.OperatorEquals),
	// 					Values: []*string{
	// 						to.Ptr("microsoft.compute/virtualmachines"),
	// 					},
	// 				},
	// 			},
	// 			Enabled: to.Ptr(true),
	// 			Schedule: &armalertprocessingrules.Schedule{
	// 				Recurrences: []armalertprocessingrules.RecurrenceClassification{
	// 					&armalertprocessingrules.WeeklyRecurrence{
	// 						DaysOfWeek: []*armalertprocessingrules.DaysOfWeek{
	// 							to.Ptr(armalertprocessingrules.DaysOfWeekSaturday),
	// 							to.Ptr(armalertprocessingrules.DaysOfWeekSunday),
	// 						},
	// 						EndTime: to.Ptr("04:00:00"),
	// 						RecurrenceType: to.Ptr(armalertprocessingrules.RecurrenceTypeWeekly),
	// 						StartTime: to.Ptr("22:00:00"),
	// 					},
	// 				},
	// 				TimeZone: to.Ptr("India Standard Time"),
	// 			},
	// 			Scopes: []*string{
	// 				to.Ptr("/subscriptions/subId1/resourceGroups/RGId1"),
	// 				to.Ptr("/subscriptions/subId1/resourceGroups/RGId2"),
	// 			},
	// 		},
	// 		SystemData: &armalertprocessingrules.SystemData{
	// 			CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T22:05:09Z"); return t}()),
	// 			CreatedBy: to.Ptr("abc@microsoft.com"),
	// 			CreatedByType: to.Ptr(armalertprocessingrules.CreatedByTypeUser),
	// 			LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09Z"); return t}()),
	// 			LastModifiedBy: to.Ptr("xyz@microsoft.com"),
	// 			LastModifiedByType: to.Ptr(armalertprocessingrules.CreatedByTypeUser),
	// 		},
	// 		Tags: map[string]*string{
	// 		},
	// 	},
	// }
}
Example (CreateOrUpdateARuleThatRemovesAllActionGroupsOutsideBusinessHoursMonFri09001700EasternStandardTime)

Generated from example definition: 2021-08-08/AlertProcessingRules_Create_or_update_remove_all_action_groups_outside_business_hours.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/alertprocessingrules/armalertprocessingrules"
	"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 := armalertprocessingrules.NewClientFactory("subId1", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().CreateOrUpdate(ctx, "alertscorrelationrg", "RemoveActionGroupsOutsideBusinessHours", armalertprocessingrules.AlertProcessingRule{
		Location: to.Ptr("Global"),
		Properties: &armalertprocessingrules.AlertProcessingRuleProperties{
			Description: to.Ptr("Remove all ActionGroups outside business hours"),
			Actions: []armalertprocessingrules.ActionClassification{
				&armalertprocessingrules.RemoveAllActionGroups{
					ActionType: to.Ptr(armalertprocessingrules.ActionTypeRemoveAllActionGroups),
				},
			},
			Enabled: to.Ptr(true),
			Schedule: &armalertprocessingrules.Schedule{
				Recurrences: []armalertprocessingrules.RecurrenceClassification{
					&armalertprocessingrules.DailyRecurrence{
						EndTime:        to.Ptr("09:00:00"),
						RecurrenceType: to.Ptr(armalertprocessingrules.RecurrenceTypeDaily),
						StartTime:      to.Ptr("17:00:00"),
					},
					&armalertprocessingrules.WeeklyRecurrence{
						DaysOfWeek: []*armalertprocessingrules.DaysOfWeek{
							to.Ptr(armalertprocessingrules.DaysOfWeekSaturday),
							to.Ptr(armalertprocessingrules.DaysOfWeekSunday),
						},
						RecurrenceType: to.Ptr(armalertprocessingrules.RecurrenceTypeWeekly),
					},
				},
				TimeZone: to.Ptr("Eastern Standard Time"),
			},
			Scopes: []*string{
				to.Ptr("/subscriptions/subId1"),
			},
		},
		Tags: map[string]*string{},
	}, 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 = armalertprocessingrules.ClientCreateOrUpdateResponse{
	// 	AlertProcessingRule: &armalertprocessingrules.AlertProcessingRule{
	// 		Name: to.Ptr("RemoveActionGroupsOutsideBusinessHours"),
	// 		Type: to.Ptr("Microsoft.AlertsManagement/actionRules"),
	// 		ID: to.Ptr("/subscriptions/subId1/resourceGroups/alertscorrelationrg/providers/Microsoft.AlertsManagement/actionRules/RemoveActionGroupsOutsideBusinessHours"),
	// 		Location: to.Ptr("Global"),
	// 		Properties: &armalertprocessingrules.AlertProcessingRuleProperties{
	// 			Description: to.Ptr("Remove all ActionGroups outside business hours"),
	// 			Actions: []armalertprocessingrules.ActionClassification{
	// 				&armalertprocessingrules.RemoveAllActionGroups{
	// 					ActionType: to.Ptr(armalertprocessingrules.ActionTypeRemoveAllActionGroups),
	// 				},
	// 			},
	// 			Enabled: to.Ptr(true),
	// 			Schedule: &armalertprocessingrules.Schedule{
	// 				Recurrences: []armalertprocessingrules.RecurrenceClassification{
	// 					&armalertprocessingrules.DailyRecurrence{
	// 						EndTime: to.Ptr("09:00:00"),
	// 						RecurrenceType: to.Ptr(armalertprocessingrules.RecurrenceTypeDaily),
	// 						StartTime: to.Ptr("17:00:00"),
	// 					},
	// 					&armalertprocessingrules.WeeklyRecurrence{
	// 						DaysOfWeek: []*armalertprocessingrules.DaysOfWeek{
	// 							to.Ptr(armalertprocessingrules.DaysOfWeekSaturday),
	// 							to.Ptr(armalertprocessingrules.DaysOfWeekSunday),
	// 						},
	// 						RecurrenceType: to.Ptr(armalertprocessingrules.RecurrenceTypeWeekly),
	// 					},
	// 				},
	// 				TimeZone: to.Ptr("Eastern Standard Time"),
	// 			},
	// 			Scopes: []*string{
	// 				to.Ptr("/subscriptions/subId1"),
	// 			},
	// 		},
	// 		SystemData: &armalertprocessingrules.SystemData{
	// 			CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T22:05:09Z"); return t}()),
	// 			CreatedBy: to.Ptr("abc@microsoft.com"),
	// 			CreatedByType: to.Ptr(armalertprocessingrules.CreatedByTypeUser),
	// 			LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09Z"); return t}()),
	// 			LastModifiedBy: to.Ptr("xyz@microsoft.com"),
	// 			LastModifiedByType: to.Ptr(armalertprocessingrules.CreatedByTypeUser),
	// 		},
	// 		Tags: map[string]*string{
	// 		},
	// 	},
	// }
}

func (*Client) Delete

func (client *Client) Delete(ctx context.Context, resourceGroupName string, alertProcessingRuleName string, options *ClientDeleteOptions) (ClientDeleteResponse, error)

Delete - Delete an alert processing rule. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2021-08-08

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • alertProcessingRuleName - The name of the alert processing rule that needs to be fetched.
  • options - ClientDeleteOptions contains the optional parameters for the Client.Delete method.
Example

Generated from example definition: 2021-08-08/AlertProcessingRules_Delete.json

package main

import (
	"context"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertprocessingrules/armalertprocessingrules"
	"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 := armalertprocessingrules.NewClientFactory("1e3ff1c0-771a-4119-a03b-be82a51e232d", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().Delete(ctx, "alertscorrelationrg", "DailySuppression", 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 = armalertprocessingrules.ClientDeleteResponse{
	// }
}

func (*Client) GetByName

func (client *Client) GetByName(ctx context.Context, resourceGroupName string, alertProcessingRuleName string, options *ClientGetByNameOptions) (ClientGetByNameResponse, error)

GetByName - Get an alert processing rule by name. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2021-08-08

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • alertProcessingRuleName - The name of the alert processing rule that needs to be fetched.
  • options - ClientGetByNameOptions contains the optional parameters for the Client.GetByName method.
Example

Generated from example definition: 2021-08-08/AlertProcessingRules_GetById.json

package main

import (
	"context"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertprocessingrules/armalertprocessingrules"
	"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 := armalertprocessingrules.NewClientFactory("1e3ff1c0-771a-4119-a03b-be82a51e232d", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().GetByName(ctx, "alertscorrelationrg", "DailySuppression", 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 = armalertprocessingrules.ClientGetByNameResponse{
	// 	AlertProcessingRule: &armalertprocessingrules.AlertProcessingRule{
	// 		Name: to.Ptr("DailySuppression"),
	// 		Type: to.Ptr("Microsoft.AlertsManagement/actionRules"),
	// 		ID: to.Ptr("/subscriptions/1e3ff1c0-771a-4119-a03b-be82a51e232d/resourceGroups/alertscorrelationrg/providers/Microsoft.AlertsManagement/actionRules/DailySuppression"),
	// 		Location: to.Ptr("Global"),
	// 		Properties: &armalertprocessingrules.AlertProcessingRuleProperties{
	// 			Description: to.Ptr("Alert processing rule on resource group for daily and weekly scheduling"),
	// 			Actions: []armalertprocessingrules.ActionClassification{
	// 				&armalertprocessingrules.AddActionGroups{
	// 					ActionGroupIDs: []*string{
	// 						to.Ptr("actiongGroup1"),
	// 						to.Ptr("actiongGroup2"),
	// 					},
	// 					ActionType: to.Ptr(armalertprocessingrules.ActionTypeAddActionGroups),
	// 				},
	// 			},
	// 			Conditions: []*armalertprocessingrules.Condition{
	// 				{
	// 					Field: to.Ptr(armalertprocessingrules.FieldSeverity),
	// 					Operator: to.Ptr(armalertprocessingrules.OperatorEquals),
	// 					Values: []*string{
	// 						to.Ptr("Sev0"),
	// 						to.Ptr("Sev2"),
	// 					},
	// 				},
	// 				{
	// 					Field: to.Ptr(armalertprocessingrules.FieldMonitorService),
	// 					Operator: to.Ptr(armalertprocessingrules.OperatorEquals),
	// 					Values: []*string{
	// 						to.Ptr("Platform"),
	// 						to.Ptr("Application Insights"),
	// 					},
	// 				},
	// 				{
	// 					Field: to.Ptr(armalertprocessingrules.FieldMonitorCondition),
	// 					Operator: to.Ptr(armalertprocessingrules.OperatorEquals),
	// 					Values: []*string{
	// 						to.Ptr("Fired"),
	// 					},
	// 				},
	// 				{
	// 					Field: to.Ptr(armalertprocessingrules.FieldTargetResourceType),
	// 					Operator: to.Ptr(armalertprocessingrules.OperatorNotEquals),
	// 					Values: []*string{
	// 						to.Ptr("Microsoft.Compute/VirtualMachines"),
	// 					},
	// 				},
	// 			},
	// 			Enabled: to.Ptr(true),
	// 			Schedule: &armalertprocessingrules.Schedule{
	// 				EffectiveFrom: to.Ptr("2018-01-10T22:05:09"),
	// 				EffectiveUntil: to.Ptr("2018-12-10T22:05:09"),
	// 				Recurrences: []armalertprocessingrules.RecurrenceClassification{
	// 					&armalertprocessingrules.DailyRecurrence{
	// 						EndTime: to.Ptr("14:00:00"),
	// 						RecurrenceType: to.Ptr(armalertprocessingrules.RecurrenceTypeDaily),
	// 						StartTime: to.Ptr("06:00:00"),
	// 					},
	// 					&armalertprocessingrules.WeeklyRecurrence{
	// 						DaysOfWeek: []*armalertprocessingrules.DaysOfWeek{
	// 							to.Ptr(armalertprocessingrules.DaysOfWeekSaturday),
	// 							to.Ptr(armalertprocessingrules.DaysOfWeekSunday),
	// 						},
	// 						EndTime: to.Ptr("20:00:00"),
	// 						RecurrenceType: to.Ptr(armalertprocessingrules.RecurrenceTypeWeekly),
	// 						StartTime: to.Ptr("10:00:00"),
	// 					},
	// 				},
	// 				TimeZone: to.Ptr("Pacific Standard Time"),
	// 			},
	// 			Scopes: []*string{
	// 				to.Ptr("/subscriptions/1e3ff1c0-771a-4119-a03b-be82a51e232d/resourceGroups/alertscorrelationrg"),
	// 			},
	// 		},
	// 		SystemData: &armalertprocessingrules.SystemData{
	// 			CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09Z"); return t}()),
	// 			CreatedBy: to.Ptr("abc@microsoft.com"),
	// 			CreatedByType: to.Ptr(armalertprocessingrules.CreatedByTypeUser),
	// 			LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09Z"); return t}()),
	// 			LastModifiedBy: to.Ptr("xyz@microsoft.com"),
	// 			LastModifiedByType: to.Ptr(armalertprocessingrules.CreatedByTypeUser),
	// 		},
	// 		Tags: map[string]*string{
	// 		},
	// 	},
	// }
}

func (*Client) NewListByResourceGroupPager

func (client *Client) NewListByResourceGroupPager(resourceGroupName string, options *ClientListByResourceGroupOptions) *runtime.Pager[ClientListByResourceGroupResponse]

NewListByResourceGroupPager - List all alert processing rules in a resource group.

Generated from API version 2021-08-08

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • options - ClientListByResourceGroupOptions contains the optional parameters for the Client.NewListByResourceGroupPager method.
Example

Generated from example definition: 2021-08-08/AlertProcessingRules_List_ResourceGroup.json

package main

import (
	"context"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertprocessingrules/armalertprocessingrules"
	"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 := armalertprocessingrules.NewClientFactory("1e3ff1c0-771a-4119-a03b-be82a51e232d", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewClient().NewListByResourceGroupPager("alertscorrelationrg", nil)
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page = armalertprocessingrules.ClientListByResourceGroupResponse{
		// 	List: armalertprocessingrules.List{
		// 		NextLink: to.Ptr("https://management.azure.com:443/subscriptions/1e3ff1c0-771a-4119-a03b-be82a51e232d/resourceGroups/alertscorrelationrg/providers/Microsoft.AlertsManagement/actionRules?api-version=2021-08-08&ctoken=%2bRID%3aPlwOAPHEGwB9UwEAAAAgCw%3d%3d%23RT%3a2%23TRC%3a500%23RTD%3aqtQyMDE4LTA2LTEyVDE1OjEyOjE1"),
		// 		Value: []*armalertprocessingrules.AlertProcessingRule{
		// 			{
		// 				Name: to.Ptr("DailySuppression"),
		// 				Type: to.Ptr("Microsoft.AlertsManagement/actionRules"),
		// 				ID: to.Ptr("/subscriptions/1e3ff1c0-771a-4119-a03b-be82a51e232d/resourceGroups/alertscorrelationrg/providers/Microsoft.AlertsManagement/actionRules/DailySuppression"),
		// 				Location: to.Ptr("Global"),
		// 				Properties: &armalertprocessingrules.AlertProcessingRuleProperties{
		// 					Description: to.Ptr("Alert processing rule on resource group for daily suppression"),
		// 					Actions: []armalertprocessingrules.ActionClassification{
		// 						&armalertprocessingrules.RemoveAllActionGroups{
		// 							ActionType: to.Ptr(armalertprocessingrules.ActionTypeRemoveAllActionGroups),
		// 						},
		// 					},
		// 					Conditions: []*armalertprocessingrules.Condition{
		// 						{
		// 							Field: to.Ptr(armalertprocessingrules.FieldSeverity),
		// 							Operator: to.Ptr(armalertprocessingrules.OperatorEquals),
		// 							Values: []*string{
		// 								to.Ptr("Sev0"),
		// 								to.Ptr("Sev2"),
		// 							},
		// 						},
		// 						{
		// 							Field: to.Ptr(armalertprocessingrules.FieldMonitorService),
		// 							Operator: to.Ptr(armalertprocessingrules.OperatorEquals),
		// 							Values: []*string{
		// 								to.Ptr("Platform"),
		// 								to.Ptr("Application Insights"),
		// 							},
		// 						},
		// 						{
		// 							Field: to.Ptr(armalertprocessingrules.FieldTargetResourceType),
		// 							Operator: to.Ptr(armalertprocessingrules.OperatorNotEquals),
		// 							Values: []*string{
		// 								to.Ptr("Microsoft.Compute/VirtualMachines"),
		// 							},
		// 						},
		// 					},
		// 					Enabled: to.Ptr(true),
		// 					Schedule: &armalertprocessingrules.Schedule{
		// 						EffectiveFrom: to.Ptr("2018-09-12T06:00:00"),
		// 						EffectiveUntil: to.Ptr("2018-09-20T14:00:00"),
		// 						Recurrences: []armalertprocessingrules.RecurrenceClassification{
		// 							&armalertprocessingrules.DailyRecurrence{
		// 								EndTime: to.Ptr("14:00:00"),
		// 								RecurrenceType: to.Ptr(armalertprocessingrules.RecurrenceTypeDaily),
		// 								StartTime: to.Ptr("06:00:00"),
		// 							},
		// 						},
		// 						TimeZone: to.Ptr("Pacific Standard Time"),
		// 					},
		// 					Scopes: []*string{
		// 						to.Ptr("/subscriptions/1e3ff1c0-771a-4119-a03b-be82a51e232d/resourceGroups/alertscorrelationrg"),
		// 					},
		// 				},
		// 				SystemData: &armalertprocessingrules.SystemData{
		// 					CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09Z"); return t}()),
		// 					CreatedBy: to.Ptr("abc@microsoft.com"),
		// 					CreatedByType: to.Ptr(armalertprocessingrules.CreatedByTypeUser),
		// 					LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09Z"); return t}()),
		// 					LastModifiedBy: to.Ptr("xyz@microsoft.com"),
		// 					LastModifiedByType: to.Ptr(armalertprocessingrules.CreatedByTypeUser),
		// 				},
		// 				Tags: map[string]*string{
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("WeeklySuppression"),
		// 				Type: to.Ptr("Microsoft.AlertsManagement/actionRules"),
		// 				ID: to.Ptr("/subscriptions/1e3ff1c0-771a-4119-a03b-be82a51e232d/resourceGroups/alertscorrelationrg/providers/Microsoft.AlertsManagement/actionRules/WeeklySuppression"),
		// 				Location: to.Ptr("Global"),
		// 				Properties: &armalertprocessingrules.AlertProcessingRuleProperties{
		// 					Description: to.Ptr("Alert processing rule on resource group for sending email"),
		// 					Actions: []armalertprocessingrules.ActionClassification{
		// 						&armalertprocessingrules.AddActionGroups{
		// 							ActionGroupIDs: []*string{
		// 								to.Ptr("/subscriptions/1e3ff1c0-771a-4119-a03b-be82a51e232d/resourceGroups/alertscorrelationrg/providers/Microsoft.insights/actiongroups/testAG"),
		// 							},
		// 							ActionType: to.Ptr(armalertprocessingrules.ActionTypeAddActionGroups),
		// 						},
		// 					},
		// 					Conditions: []*armalertprocessingrules.Condition{
		// 						{
		// 							Field: to.Ptr(armalertprocessingrules.FieldMonitorCondition),
		// 							Operator: to.Ptr(armalertprocessingrules.OperatorEquals),
		// 							Values: []*string{
		// 								to.Ptr("Fired"),
		// 							},
		// 						},
		// 						{
		// 							Field: to.Ptr(armalertprocessingrules.FieldDescription),
		// 							Operator: to.Ptr(armalertprocessingrules.OperatorContains),
		// 							Values: []*string{
		// 								to.Ptr("Percentage CPU greater than 80%"),
		// 								to.Ptr("Metric alert on resource foo"),
		// 							},
		// 						},
		// 						{
		// 							Field: to.Ptr(armalertprocessingrules.FieldAlertContext),
		// 							Operator: to.Ptr(armalertprocessingrules.OperatorDoesNotContain),
		// 							Values: []*string{
		// 								to.Ptr("testresource"),
		// 								to.Ptr("foo"),
		// 							},
		// 						},
		// 					},
		// 					Enabled: to.Ptr(true),
		// 					Scopes: []*string{
		// 						to.Ptr("/subscriptions/1e3ff1c0-771a-4119-a03b-be82a51e232d/resourceGroups/alertscorrelationrg/providers/Microsoft.Compute/VirtualMachines/testResource"),
		// 					},
		// 				},
		// 				SystemData: &armalertprocessingrules.SystemData{
		// 					CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09Z"); return t}()),
		// 					CreatedBy: to.Ptr("abc@microsoft.com"),
		// 					CreatedByType: to.Ptr(armalertprocessingrules.CreatedByTypeUser),
		// 					LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09Z"); return t}()),
		// 					LastModifiedBy: to.Ptr("xyz@microsoft.com"),
		// 					LastModifiedByType: to.Ptr(armalertprocessingrules.CreatedByTypeUser),
		// 				},
		// 				Tags: map[string]*string{
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}

func (*Client) NewListBySubscriptionPager

func (client *Client) NewListBySubscriptionPager(options *ClientListBySubscriptionOptions) *runtime.Pager[ClientListBySubscriptionResponse]

NewListBySubscriptionPager - List all alert processing rules in a subscription.

Generated from API version 2021-08-08

  • options - ClientListBySubscriptionOptions contains the optional parameters for the Client.NewListBySubscriptionPager method.
Example

Generated from example definition: 2021-08-08/AlertProcessingRules_List_Subscription.json

package main

import (
	"context"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertprocessingrules/armalertprocessingrules"
	"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 := armalertprocessingrules.NewClientFactory("1e3ff1c0-771a-4119-a03b-be82a51e232d", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewClient().NewListBySubscriptionPager(nil)
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page = armalertprocessingrules.ClientListBySubscriptionResponse{
		// 	List: armalertprocessingrules.List{
		// 		NextLink: to.Ptr("https://management.azure.com:443/subscriptions/1e3ff1c0-771a-4119-a03b-be82a51e232d/providers/Microsoft.AlertsManagement/actionRules?api-version=2021-08-08&ctoken=%2bRID%3aPlwOAPHEGwB9UwEAAAAgCw%3d%3d%23RT%3a2%23TRC%3a500%23RTD%3aqtQyMDE4LTA2LTEyVDE1OjEyOjE1"),
		// 		Value: []*armalertprocessingrules.AlertProcessingRule{
		// 			{
		// 				Name: to.Ptr("DailySuppression"),
		// 				Type: to.Ptr("Microsoft.AlertsManagement/actionRules"),
		// 				ID: to.Ptr("/subscriptions/1e3ff1c0-771a-4119-a03b-be82a51e232d/resourceGroups/alertscorrelationrg/providers/Microsoft.AlertsManagement/actionRules/DailySuppression"),
		// 				Location: to.Ptr("Global"),
		// 				Properties: &armalertprocessingrules.AlertProcessingRuleProperties{
		// 					Description: to.Ptr("Alert processing rule on resource group for daily suppression"),
		// 					Actions: []armalertprocessingrules.ActionClassification{
		// 						&armalertprocessingrules.RemoveAllActionGroups{
		// 							ActionType: to.Ptr(armalertprocessingrules.ActionTypeRemoveAllActionGroups),
		// 						},
		// 					},
		// 					Conditions: []*armalertprocessingrules.Condition{
		// 						{
		// 							Field: to.Ptr(armalertprocessingrules.FieldSeverity),
		// 							Operator: to.Ptr(armalertprocessingrules.OperatorEquals),
		// 							Values: []*string{
		// 								to.Ptr("Sev0"),
		// 								to.Ptr("Sev2"),
		// 							},
		// 						},
		// 						{
		// 							Field: to.Ptr(armalertprocessingrules.FieldMonitorService),
		// 							Operator: to.Ptr(armalertprocessingrules.OperatorEquals),
		// 							Values: []*string{
		// 								to.Ptr("Platform"),
		// 								to.Ptr("Application Insights"),
		// 							},
		// 						},
		// 						{
		// 							Field: to.Ptr(armalertprocessingrules.FieldTargetResourceType),
		// 							Operator: to.Ptr(armalertprocessingrules.OperatorNotEquals),
		// 							Values: []*string{
		// 								to.Ptr("Microsoft.Compute/VirtualMachines"),
		// 							},
		// 						},
		// 					},
		// 					Enabled: to.Ptr(true),
		// 					Schedule: &armalertprocessingrules.Schedule{
		// 						EffectiveFrom: to.Ptr("2018-01-10T22:05:09"),
		// 						EffectiveUntil: to.Ptr("2018-12-10T22:05:09"),
		// 						Recurrences: []armalertprocessingrules.RecurrenceClassification{
		// 							&armalertprocessingrules.DailyRecurrence{
		// 								EndTime: to.Ptr("14:00:00"),
		// 								RecurrenceType: to.Ptr(armalertprocessingrules.RecurrenceTypeDaily),
		// 								StartTime: to.Ptr("06:00:00"),
		// 							},
		// 						},
		// 						TimeZone: to.Ptr("Pacific Standard Time"),
		// 					},
		// 					Scopes: []*string{
		// 						to.Ptr("/subscriptions/1e3ff1c0-771a-4119-a03b-be82a51e232d/resourceGroups/alertscorrelationrg"),
		// 					},
		// 				},
		// 				SystemData: &armalertprocessingrules.SystemData{
		// 					CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09Z"); return t}()),
		// 					CreatedBy: to.Ptr("abc@microsoft.com"),
		// 					CreatedByType: to.Ptr(armalertprocessingrules.CreatedByTypeUser),
		// 					LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09Z"); return t}()),
		// 					LastModifiedBy: to.Ptr("xyz@microsoft.com"),
		// 					LastModifiedByType: to.Ptr(armalertprocessingrules.CreatedByTypeUser),
		// 				},
		// 				Tags: map[string]*string{
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("WeeklySuppression"),
		// 				Type: to.Ptr("Microsoft.AlertsManagement/actionRules"),
		// 				ID: to.Ptr("/subscriptions/1e3ff1c0-771a-4119-a03b-be82a51e232d/resourceGroups/alertscorrelationrg/providers/Microsoft.AlertsManagement/actionRules/WeeklySuppression"),
		// 				Location: to.Ptr("Global"),
		// 				Properties: &armalertprocessingrules.AlertProcessingRuleProperties{
		// 					Description: to.Ptr("Alert processing rule on resource group for adding action group"),
		// 					Actions: []armalertprocessingrules.ActionClassification{
		// 						&armalertprocessingrules.AddActionGroups{
		// 							ActionGroupIDs: []*string{
		// 								to.Ptr("actiongGroup1"),
		// 							},
		// 							ActionType: to.Ptr(armalertprocessingrules.ActionTypeAddActionGroups),
		// 						},
		// 					},
		// 					Conditions: []*armalertprocessingrules.Condition{
		// 						{
		// 							Field: to.Ptr(armalertprocessingrules.FieldMonitorCondition),
		// 							Operator: to.Ptr(armalertprocessingrules.OperatorEquals),
		// 							Values: []*string{
		// 								to.Ptr("Fired"),
		// 							},
		// 						},
		// 						{
		// 							Field: to.Ptr(armalertprocessingrules.FieldDescription),
		// 							Operator: to.Ptr(armalertprocessingrules.OperatorContains),
		// 							Values: []*string{
		// 								to.Ptr("Percentage CPU greater than 80%"),
		// 								to.Ptr("Metric alert on resource foo"),
		// 							},
		// 						},
		// 					},
		// 					Enabled: to.Ptr(true),
		// 					Scopes: []*string{
		// 						to.Ptr("/subscriptions/1e3ff1c0-771a-4119-a03b-be82a51e232d/resourceGroups/alertscorrelationrg/providers/Microsoft.Compute/VirtualMachines/testResource"),
		// 					},
		// 				},
		// 				SystemData: &armalertprocessingrules.SystemData{
		// 					CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09Z"); return t}()),
		// 					CreatedBy: to.Ptr("abc@microsoft.com"),
		// 					CreatedByType: to.Ptr(armalertprocessingrules.CreatedByTypeUser),
		// 					LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09Z"); return t}()),
		// 					LastModifiedBy: to.Ptr("xyz@microsoft.com"),
		// 					LastModifiedByType: to.Ptr(armalertprocessingrules.CreatedByTypeUser),
		// 				},
		// 				Tags: map[string]*string{
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}

func (*Client) Update

func (client *Client) Update(ctx context.Context, resourceGroupName string, alertProcessingRuleName string, alertProcessingRulePatch PatchObject, options *ClientUpdateOptions) (ClientUpdateResponse, error)

Update - Enable, disable, or update tags for an alert processing rule. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2021-08-08

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • alertProcessingRuleName - The name of the alert processing rule that needs to be fetched.
  • alertProcessingRulePatch - Parameters supplied to the operation.
  • options - ClientUpdateOptions contains the optional parameters for the Client.Update method.
Example

Generated from example definition: 2021-08-08/AlertProcessingRules_Patch.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/alertprocessingrules/armalertprocessingrules"
	"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 := armalertprocessingrules.NewClientFactory("1e3ff1c0-771a-4119-a03b-be82a51e232d", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().Update(ctx, "alertscorrelationrg", "WeeklySuppression", armalertprocessingrules.PatchObject{
		Properties: &armalertprocessingrules.PatchProperties{
			Enabled: to.Ptr(false),
		},
		Tags: map[string]*string{
			"key1": to.Ptr("value1"),
			"key2": to.Ptr("value2"),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// 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 = armalertprocessingrules.ClientUpdateResponse{
	// 	AlertProcessingRule: &armalertprocessingrules.AlertProcessingRule{
	// 		Name: to.Ptr("WeeklySuppression"),
	// 		Type: to.Ptr("Microsoft.AlertsManagement/actionRules"),
	// 		ID: to.Ptr("/subscriptions/1e3ff1c0-771a-4119-a03b-be82a51e232d/resourceGroups/alertscorrelationrg/providers/Microsoft.AlertsManagement/actionRules/WeeklySuppression"),
	// 		Location: to.Ptr("Global"),
	// 		Properties: &armalertprocessingrules.AlertProcessingRuleProperties{
	// 			Description: to.Ptr("Alert processing rule on resource group for weekly suppression"),
	// 			Actions: []armalertprocessingrules.ActionClassification{
	// 				&armalertprocessingrules.RemoveAllActionGroups{
	// 					ActionType: to.Ptr(armalertprocessingrules.ActionTypeRemoveAllActionGroups),
	// 				},
	// 			},
	// 			Conditions: []*armalertprocessingrules.Condition{
	// 				{
	// 					Field: to.Ptr(armalertprocessingrules.FieldSeverity),
	// 					Operator: to.Ptr(armalertprocessingrules.OperatorEquals),
	// 					Values: []*string{
	// 						to.Ptr("Sev0"),
	// 						to.Ptr("Sev2"),
	// 					},
	// 				},
	// 				{
	// 					Field: to.Ptr(armalertprocessingrules.FieldMonitorService),
	// 					Operator: to.Ptr(armalertprocessingrules.OperatorEquals),
	// 					Values: []*string{
	// 						to.Ptr("Platform"),
	// 						to.Ptr("Application Insights"),
	// 					},
	// 				},
	// 				{
	// 					Field: to.Ptr(armalertprocessingrules.FieldTargetResourceType),
	// 					Operator: to.Ptr(armalertprocessingrules.OperatorNotEquals),
	// 					Values: []*string{
	// 						to.Ptr("Microsoft.Compute/VirtualMachines"),
	// 					},
	// 				},
	// 			},
	// 			Enabled: to.Ptr(false),
	// 			Schedule: &armalertprocessingrules.Schedule{
	// 				EffectiveFrom: to.Ptr("2018-12-10T22:05:09"),
	// 				EffectiveUntil: to.Ptr("2018-12-05T22:05:09"),
	// 				Recurrences: []armalertprocessingrules.RecurrenceClassification{
	// 					&armalertprocessingrules.WeeklyRecurrence{
	// 						DaysOfWeek: []*armalertprocessingrules.DaysOfWeek{
	// 							to.Ptr(armalertprocessingrules.DaysOfWeekTuesday),
	// 							to.Ptr(armalertprocessingrules.DaysOfWeekFriday),
	// 						},
	// 						EndTime: to.Ptr("14:00:00"),
	// 						RecurrenceType: to.Ptr(armalertprocessingrules.RecurrenceTypeWeekly),
	// 						StartTime: to.Ptr("06:00:00"),
	// 					},
	// 				},
	// 				TimeZone: to.Ptr("Pacific Standard Time"),
	// 			},
	// 			Scopes: []*string{
	// 				to.Ptr("/subscriptions/1e3ff1c0-771a-4119-a03b-be82a51e232d/resourceGroups/alertscorrelationrg"),
	// 			},
	// 		},
	// 		SystemData: &armalertprocessingrules.SystemData{
	// 			CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09Z"); return t}()),
	// 			CreatedBy: to.Ptr("abc@microsoft.com"),
	// 			CreatedByType: to.Ptr(armalertprocessingrules.CreatedByTypeUser),
	// 			LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09Z"); return t}()),
	// 			LastModifiedBy: to.Ptr("xyz@microsoft.com"),
	// 			LastModifiedByType: to.Ptr(armalertprocessingrules.CreatedByTypeUser),
	// 		},
	// 		Tags: map[string]*string{
	// 			"key1": to.Ptr("value1"),
	// 			"key2": to.Ptr("value2"),
	// 		},
	// 	},
	// }
}

type ClientCreateOrUpdateOptions

type ClientCreateOrUpdateOptions struct {
}

ClientCreateOrUpdateOptions contains the optional parameters for the Client.CreateOrUpdate method.

type ClientCreateOrUpdateResponse

type ClientCreateOrUpdateResponse struct {
	// Alert processing rule object containing target scopes, conditions and scheduling logic.
	AlertProcessingRule

	// An opaque, globally-unique, server-generated string identifier for the request.
	RequestID *string
}

ClientCreateOrUpdateResponse contains the response from method Client.CreateOrUpdate.

type ClientDeleteOptions

type ClientDeleteOptions struct {
}

ClientDeleteOptions contains the optional parameters for the Client.Delete method.

type ClientDeleteResponse

type ClientDeleteResponse struct {
	// An opaque, globally-unique, server-generated string identifier for the request.
	RequestID *string
}

ClientDeleteResponse contains the response from method Client.Delete.

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(subscriptionID string, 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.

  • subscriptionID - The ID of the target subscription. The value must be an UUID.
  • 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 ClientGetByNameOptions

type ClientGetByNameOptions struct {
}

ClientGetByNameOptions contains the optional parameters for the Client.GetByName method.

type ClientGetByNameResponse

type ClientGetByNameResponse struct {
	// Alert processing rule object containing target scopes, conditions and scheduling logic.
	AlertProcessingRule

	// An opaque, globally-unique, server-generated string identifier for the request.
	RequestID *string
}

ClientGetByNameResponse contains the response from method Client.GetByName.

type ClientListByResourceGroupOptions

type ClientListByResourceGroupOptions struct {
}

ClientListByResourceGroupOptions contains the optional parameters for the Client.NewListByResourceGroupPager method.

type ClientListByResourceGroupResponse

type ClientListByResourceGroupResponse struct {
	// List of alert processing rules.
	List

	// An opaque, globally-unique, server-generated string identifier for the request.
	RequestID *string
}

ClientListByResourceGroupResponse contains the response from method Client.NewListByResourceGroupPager.

type ClientListBySubscriptionOptions

type ClientListBySubscriptionOptions struct {
}

ClientListBySubscriptionOptions contains the optional parameters for the Client.NewListBySubscriptionPager method.

type ClientListBySubscriptionResponse

type ClientListBySubscriptionResponse struct {
	// List of alert processing rules.
	List

	// An opaque, globally-unique, server-generated string identifier for the request.
	RequestID *string
}

ClientListBySubscriptionResponse contains the response from method Client.NewListBySubscriptionPager.

type ClientUpdateOptions

type ClientUpdateOptions struct {
}

ClientUpdateOptions contains the optional parameters for the Client.Update method.

type ClientUpdateResponse

type ClientUpdateResponse struct {
	// Alert processing rule object containing target scopes, conditions and scheduling logic.
	AlertProcessingRule

	// An opaque, globally-unique, server-generated string identifier for the request.
	RequestID *string
}

ClientUpdateResponse contains the response from method Client.Update.

type Condition

type Condition struct {
	// Field for a given condition.
	Field *Field

	// Operator for a given condition.
	Operator *Operator

	// List of values to match for a given condition.
	Values []*string
}

Condition to trigger an alert processing rule.

func (Condition) MarshalJSON

func (c Condition) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Condition.

func (*Condition) UnmarshalJSON

func (c *Condition) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Condition.

type CreatedByType

type CreatedByType string

CreatedByType - The kind of entity that created the resource.

const (
	// CreatedByTypeApplication - The entity was created by an application.
	CreatedByTypeApplication CreatedByType = "Application"
	// CreatedByTypeKey - The entity was created by a key.
	CreatedByTypeKey CreatedByType = "Key"
	// CreatedByTypeManagedIdentity - The entity was created by a managed identity.
	CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity"
	// CreatedByTypeUser - The entity was created by a user.
	CreatedByTypeUser CreatedByType = "User"
)

func PossibleCreatedByTypeValues

func PossibleCreatedByTypeValues() []CreatedByType

PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type.

type DailyRecurrence

type DailyRecurrence struct {
	// CONSTANT; Specifies when the recurrence should be applied.
	// Field has constant value RecurrenceTypeDaily, any specified value is ignored.
	RecurrenceType *RecurrenceType

	// End time for recurrence.
	EndTime *string

	// Start time for recurrence.
	StartTime *string
}

DailyRecurrence - Daily recurrence object.

func (*DailyRecurrence) GetRecurrence

func (d *DailyRecurrence) GetRecurrence() *Recurrence

GetRecurrence implements the RecurrenceClassification interface for type DailyRecurrence.

func (DailyRecurrence) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type DailyRecurrence.

func (*DailyRecurrence) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type DailyRecurrence.

type DaysOfWeek

type DaysOfWeek string

DaysOfWeek - Days of week.

const (
	// DaysOfWeekFriday - Friday
	DaysOfWeekFriday DaysOfWeek = "Friday"
	// DaysOfWeekMonday - Monday
	DaysOfWeekMonday DaysOfWeek = "Monday"
	// DaysOfWeekSaturday - Saturday
	DaysOfWeekSaturday DaysOfWeek = "Saturday"
	// DaysOfWeekSunday - Sunday
	DaysOfWeekSunday DaysOfWeek = "Sunday"
	// DaysOfWeekThursday - Thursday
	DaysOfWeekThursday DaysOfWeek = "Thursday"
	// DaysOfWeekTuesday - Tuesday
	DaysOfWeekTuesday DaysOfWeek = "Tuesday"
	// DaysOfWeekWednesday - Wednesday
	DaysOfWeekWednesday DaysOfWeek = "Wednesday"
)

func PossibleDaysOfWeekValues

func PossibleDaysOfWeekValues() []DaysOfWeek

PossibleDaysOfWeekValues returns the possible values for the DaysOfWeek const type.

type Field

type Field string

Field - Field for a given condition.

const (
	// FieldAlertContext - AlertContext
	FieldAlertContext Field = "AlertContext"
	// FieldAlertRuleID - AlertRuleId
	FieldAlertRuleID Field = "AlertRuleId"
	// FieldAlertRuleName - AlertRuleName
	FieldAlertRuleName Field = "AlertRuleName"
	// FieldDescription - Description
	FieldDescription Field = "Description"
	// FieldMonitorCondition - MonitorCondition
	FieldMonitorCondition Field = "MonitorCondition"
	// FieldMonitorService - MonitorService
	FieldMonitorService Field = "MonitorService"
	// FieldSeverity - Severity
	FieldSeverity Field = "Severity"
	// FieldSignalType - SignalType
	FieldSignalType Field = "SignalType"
	// FieldTargetResource - TargetResource
	FieldTargetResource Field = "TargetResource"
	// FieldTargetResourceGroup - TargetResourceGroup
	FieldTargetResourceGroup Field = "TargetResourceGroup"
	// FieldTargetResourceType - TargetResourceType
	FieldTargetResourceType Field = "TargetResourceType"
)

func PossibleFieldValues

func PossibleFieldValues() []Field

PossibleFieldValues returns the possible values for the Field const type.

type List

type List struct {
	// REQUIRED; The AlertProcessingRule items on this page
	Value []*AlertProcessingRule

	// The link to the next page of items
	NextLink *string
}

List of alert processing rules.

func (List) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type List.

func (*List) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type List.

type MonthlyRecurrence

type MonthlyRecurrence struct {
	// REQUIRED; Specifies the values for monthly recurrence pattern.
	DaysOfMonth []*int32

	// CONSTANT; Specifies when the recurrence should be applied.
	// Field has constant value RecurrenceTypeMonthly, any specified value is ignored.
	RecurrenceType *RecurrenceType

	// End time for recurrence.
	EndTime *string

	// Start time for recurrence.
	StartTime *string
}

MonthlyRecurrence - Monthly recurrence object.

func (*MonthlyRecurrence) GetRecurrence

func (m *MonthlyRecurrence) GetRecurrence() *Recurrence

GetRecurrence implements the RecurrenceClassification interface for type MonthlyRecurrence.

func (MonthlyRecurrence) MarshalJSON

func (m MonthlyRecurrence) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MonthlyRecurrence.

func (*MonthlyRecurrence) UnmarshalJSON

func (m *MonthlyRecurrence) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MonthlyRecurrence.

type Operator

type Operator string

Operator - Operator for a given condition.

const (
	// OperatorContains - Contains
	OperatorContains Operator = "Contains"
	// OperatorDoesNotContain - DoesNotContain
	OperatorDoesNotContain Operator = "DoesNotContain"
	// OperatorEquals - Equals
	OperatorEquals Operator = "Equals"
	// OperatorNotEquals - NotEquals
	OperatorNotEquals Operator = "NotEquals"
)

func PossibleOperatorValues

func PossibleOperatorValues() []Operator

PossibleOperatorValues returns the possible values for the Operator const type.

type PatchObject

type PatchObject struct {
	// Properties supported by patch operation.
	Properties *PatchProperties

	// Tags to be updated.
	Tags map[string]*string
}

PatchObject - Data contract for patch.

func (PatchObject) MarshalJSON

func (p PatchObject) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type PatchObject.

func (*PatchObject) UnmarshalJSON

func (p *PatchObject) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type PatchObject.

type PatchProperties

type PatchProperties struct {
	// Indicates if the given alert processing rule is enabled or disabled.
	Enabled *bool
}

PatchProperties - Alert processing rule properties supported by patch.

func (PatchProperties) MarshalJSON

func (p PatchProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type PatchProperties.

func (*PatchProperties) UnmarshalJSON

func (p *PatchProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type PatchProperties.

type Recurrence

type Recurrence struct {
	// REQUIRED; Specifies when the recurrence should be applied.
	RecurrenceType *RecurrenceType

	// End time for recurrence.
	EndTime *string

	// Start time for recurrence.
	StartTime *string
}

Recurrence object.

func (*Recurrence) GetRecurrence

func (r *Recurrence) GetRecurrence() *Recurrence

GetRecurrence implements the RecurrenceClassification interface for type Recurrence.

func (Recurrence) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type Recurrence.

func (*Recurrence) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type Recurrence.

type RecurrenceClassification

type RecurrenceClassification interface {
	// GetRecurrence returns the Recurrence content of the underlying type.
	GetRecurrence() *Recurrence
}

RecurrenceClassification provides polymorphic access to related types. Call the interface's GetRecurrence() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *DailyRecurrence, *MonthlyRecurrence, *Recurrence, *WeeklyRecurrence

type RecurrenceType

type RecurrenceType string

RecurrenceType - Specifies when the recurrence should be applied.

const (
	// RecurrenceTypeDaily - Daily
	RecurrenceTypeDaily RecurrenceType = "Daily"
	// RecurrenceTypeMonthly - Monthly
	RecurrenceTypeMonthly RecurrenceType = "Monthly"
	// RecurrenceTypeWeekly - Weekly
	RecurrenceTypeWeekly RecurrenceType = "Weekly"
)

func PossibleRecurrenceTypeValues

func PossibleRecurrenceTypeValues() []RecurrenceType

PossibleRecurrenceTypeValues returns the possible values for the RecurrenceType const type.

type RemoveAllActionGroups

type RemoveAllActionGroups struct {
	// CONSTANT; Action that should be applied.
	// Field has constant value ActionTypeRemoveAllActionGroups, any specified value is ignored.
	ActionType *ActionType
}

RemoveAllActionGroups - Indicates if all action groups should be removed.

func (*RemoveAllActionGroups) GetAction

func (r *RemoveAllActionGroups) GetAction() *Action

GetAction implements the ActionClassification interface for type RemoveAllActionGroups.

func (RemoveAllActionGroups) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type RemoveAllActionGroups.

func (*RemoveAllActionGroups) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type RemoveAllActionGroups.

type Schedule

type Schedule struct {
	// Scheduling effective from time. Date-Time in ISO-8601 format without timezone suffix.
	EffectiveFrom *string

	// Scheduling effective until time. Date-Time in ISO-8601 format without timezone suffix.
	EffectiveUntil *string

	// List of recurrences.
	Recurrences []RecurrenceClassification

	// Scheduling time zone.
	TimeZone *string
}

Schedule - Scheduling configuration for a given alert processing rule.

func (Schedule) MarshalJSON

func (s Schedule) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Schedule.

func (*Schedule) UnmarshalJSON

func (s *Schedule) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Schedule.

type SystemData

type SystemData struct {
	// The timestamp of resource creation (UTC).
	CreatedAt *time.Time

	// The identity that created the resource.
	CreatedBy *string

	// The type of identity that created the resource.
	CreatedByType *CreatedByType

	// The timestamp of resource last modification (UTC)
	LastModifiedAt *time.Time

	// The identity that last modified the resource.
	LastModifiedBy *string

	// The type of identity that last modified the resource.
	LastModifiedByType *CreatedByType
}

SystemData - Metadata pertaining to creation and last modification of the resource.

func (SystemData) MarshalJSON

func (s SystemData) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type SystemData.

func (*SystemData) UnmarshalJSON

func (s *SystemData) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type SystemData.

type WeeklyRecurrence

type WeeklyRecurrence struct {
	// REQUIRED; Specifies the values for weekly recurrence pattern.
	DaysOfWeek []*DaysOfWeek

	// CONSTANT; Specifies when the recurrence should be applied.
	// Field has constant value RecurrenceTypeWeekly, any specified value is ignored.
	RecurrenceType *RecurrenceType

	// End time for recurrence.
	EndTime *string

	// Start time for recurrence.
	StartTime *string
}

WeeklyRecurrence - Weekly recurrence object.

func (*WeeklyRecurrence) GetRecurrence

func (w *WeeklyRecurrence) GetRecurrence() *Recurrence

GetRecurrence implements the RecurrenceClassification interface for type WeeklyRecurrence.

func (WeeklyRecurrence) MarshalJSON

func (w WeeklyRecurrence) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type WeeklyRecurrence.

func (*WeeklyRecurrence) UnmarshalJSON

func (w *WeeklyRecurrence) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type WeeklyRecurrence.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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