armtenantactivitylogalerts

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 Tenant Activity Log Alerts Module for Go

The armtenantactivitylogalerts module provides operations for working with Azure Tenant Activity Log Alerts.

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 Tenant Activity Log Alerts module:

go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/tenantactivitylogalerts/armtenantactivitylogalerts

Authorization

When creating a client, you will need to provide a credential for authenticating with Azure Tenant Activity Log Alerts. 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 Tenant Activity Log Alerts 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 := armtenantactivitylogalerts.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 := armtenantactivitylogalerts.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 Tenant Activity Log Alerts 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 ActionGroup

type ActionGroup struct {
	// REQUIRED; The resource ID of the Action Group. This cannot be null or empty.
	ActionGroupID *string

	// Predefined list of properties and configuration items for the action group.
	ActionProperties map[string]*string

	// the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload.
	WebhookProperties map[string]*string
}

ActionGroup - A pointer to an Azure Action Group.

func (ActionGroup) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ActionGroup.

func (*ActionGroup) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type ActionGroup.

type ActionList

type ActionList struct {
	// The list of the Action Groups.
	ActionGroups []*ActionGroup
}

ActionList - A list of Activity Log Alert rule actions.

func (ActionList) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ActionList.

func (*ActionList) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type ActionList.

type AlertRuleAllOfCondition

type AlertRuleAllOfCondition struct {
	// REQUIRED; The list of Activity Log Alert rule conditions.
	AllOf []*AlertRuleAnyOfOrLeafCondition
}

AlertRuleAllOfCondition - An Activity Log Alert rule condition that is met when all its member conditions are met.

func (AlertRuleAllOfCondition) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type AlertRuleAllOfCondition.

func (*AlertRuleAllOfCondition) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleAllOfCondition.

type AlertRuleAnyOfOrLeafCondition

type AlertRuleAnyOfOrLeafCondition struct {
	// An Activity Log Alert rule condition that is met when at least one of its member leaf conditions are met.
	AnyOf []*AlertRuleLeafCondition

	// The value of the event's field will be compared to the values in this array (case-insensitive) to determine if the condition
	// is met.
	ContainsAny []*string

	// The value of the event's field will be compared to this value (case-insensitive) to determine if the condition is met.
	Equals *string

	// The name of the Activity Log event's field that this condition will examine.
	// The possible values for this field are (case-insensitive): 'resourceId', 'category', 'caller', 'level', 'operationName',
	// 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties'.
	Field *string
}

AlertRuleAnyOfOrLeafCondition - An Activity Log Alert rule condition that is met when all its member conditions are met. Each condition can be of one of the following types: __Important__: Each type has its unique subset of properties. Properties from different types CANNOT exist in one condition. * __Leaf Condition -__ must contain 'field' and either 'equals' or 'containsAny'. _Please note, 'anyOf' should __not__ be set in a Leaf Condition._ * __AnyOf Condition -__ must contain __only__ 'anyOf' (which is an array of Leaf Conditions). _Please note, 'field', 'equals' and 'containsAny' should __not__ be set in an AnyOf Condition._

func (AlertRuleAnyOfOrLeafCondition) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type AlertRuleAnyOfOrLeafCondition.

func (*AlertRuleAnyOfOrLeafCondition) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleAnyOfOrLeafCondition.

type AlertRuleLeafCondition

type AlertRuleLeafCondition struct {
	// The value of the event's field will be compared to the values in this array (case-insensitive) to determine if the condition
	// is met.
	ContainsAny []*string

	// The value of the event's field will be compared to this value (case-insensitive) to determine if the condition is met.
	Equals *string

	// The name of the Activity Log event's field that this condition will examine.
	// The possible values for this field are (case-insensitive): 'resourceId', 'category', 'caller', 'level', 'operationName',
	// 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties'.
	Field *string
}

AlertRuleLeafCondition - An Activity Log Alert rule condition that is met by comparing the field and value of an Activity Log event. This condition must contain 'field' and either 'equals' or 'containsAny'.

func (AlertRuleLeafCondition) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type AlertRuleLeafCondition.

func (*AlertRuleLeafCondition) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleLeafCondition.

type AlertRuleProperties

type AlertRuleProperties struct {
	// REQUIRED; The actions that will activate when the condition is met.
	Actions *ActionList

	// REQUIRED; The condition that will cause this alert to activate.
	Condition *AlertRuleAllOfCondition

	// A description of this Activity Log Alert rule.
	Description *string

	// Indicates whether this Activity Log Alert rule is enabled. If an Activity Log Alert rule is not enabled, then none of its
	// actions will be activated.
	Enabled *bool

	// A list of resource IDs that will be used as prefixes. The alert will only apply to Activity Log events with resource IDs
	// that fall under one of these prefixes. This list must include at least one item.
	Scopes []*string

	// The tenant GUID. Must be provided for tenant-level and management group events rules.
	TenantScope *string
}

AlertRuleProperties - An Azure Activity Log Alert rule.

func (AlertRuleProperties) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type AlertRuleProperties.

func (*AlertRuleProperties) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleProperties.

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(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) CreateOrUpdate

func (client *Client) CreateOrUpdate(ctx context.Context, managementGroupName string, alertRuleName string, tenantActivityLogAlertRule TenantActivityLogAlertResource, options *ClientCreateOrUpdateOptions) (ClientCreateOrUpdateResponse, error)

CreateOrUpdate - Create a new Tenant Activity Log Alert rule or update an existing one. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2023-04-01-preview

  • managementGroupName - The management group ID.
  • alertRuleName - The name of the Tenant Activity Log Alert rule.
  • tenantActivityLogAlertRule - The Tenant Activity Log Alert rule to create or use for the update.
  • options - ClientCreateOrUpdateOptions contains the optional parameters for the Client.CreateOrUpdate method.
Example

Generated from example definition: 2023-04-01-preview/TenantActivityLogAlertRule_CreateOrUpdate.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/tenantactivitylogalerts/armtenantactivitylogalerts"
	"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 := armtenantactivitylogalerts.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().CreateOrUpdate(ctx, "72f988bf-86f1-41af-91ab-2d7cd011db47", "SampleActivityLogAlertSHRuleOnTenantLevel", armtenantactivitylogalerts.TenantActivityLogAlertResource{
		Location: to.Ptr("Global"),
		Properties: &armtenantactivitylogalerts.AlertRuleProperties{
			Description: to.Ptr("Description of sample Activity Log Alert service health rule on tenant level events."),
			Actions: &armtenantactivitylogalerts.ActionList{
				ActionGroups: []*armtenantactivitylogalerts.ActionGroup{
					{
						ActionGroupID: to.Ptr("/providers/Microsoft.Management/ManagementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.Insights/actionGroups/SampleActionGroup"),
						ActionProperties: map[string]*string{
							"Email.Title": to.Ptr("my email title"),
						},
						WebhookProperties: map[string]*string{
							"sampleWebhookProperty": to.Ptr("SamplePropertyValue"),
						},
					},
				},
			},
			Condition: &armtenantactivitylogalerts.AlertRuleAllOfCondition{
				AllOf: []*armtenantactivitylogalerts.AlertRuleAnyOfOrLeafCondition{
					{
						Equals: to.Ptr("ServiceHealth"),
						Field:  to.Ptr("category"),
					},
				},
			},
			Enabled:     to.Ptr(true),
			TenantScope: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"),
		},
		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 = armtenantactivitylogalerts.ClientCreateOrUpdateResponse{
	// 	TenantActivityLogAlertResource: &armtenantactivitylogalerts.TenantActivityLogAlertResource{
	// 		Name: to.Ptr("SampleActivityLogAlertSHRuleOnTenantLevel"),
	// 		Type: to.Ptr("Microsoft.AlertsManagement/TenantActivityLogAlerts"),
	// 		ID: to.Ptr("/providers/Microsoft.Management/ManagementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.AlertsManagement/TenantActivityLogAlerts/SampleActivityLogAlertSHRuleOnTenantLevel"),
	// 		Location: to.Ptr("Global"),
	// 		Properties: &armtenantactivitylogalerts.AlertRuleProperties{
	// 			Description: to.Ptr("Description of sample Activity Log Alert service health rule on tenant level events."),
	// 			Actions: &armtenantactivitylogalerts.ActionList{
	// 				ActionGroups: []*armtenantactivitylogalerts.ActionGroup{
	// 					{
	// 						ActionGroupID: to.Ptr("/providers/Microsoft.Management/ManagementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.Insights/actionGroups/SampleActionGroup"),
	// 						ActionProperties: map[string]*string{
	// 							"Email.Title": to.Ptr("my email title"),
	// 						},
	// 						WebhookProperties: map[string]*string{
	// 							"sampleWebhookProperty": to.Ptr("SamplePropertyValue"),
	// 						},
	// 					},
	// 				},
	// 			},
	// 			Condition: &armtenantactivitylogalerts.AlertRuleAllOfCondition{
	// 				AllOf: []*armtenantactivitylogalerts.AlertRuleAnyOfOrLeafCondition{
	// 					{
	// 						Equals: to.Ptr("ServiceHealth"),
	// 						Field: to.Ptr("category"),
	// 					},
	// 				},
	// 			},
	// 			Enabled: to.Ptr(true),
	// 			TenantScope: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"),
	// 		},
	// 		Tags: map[string]*string{
	// 		},
	// 	},
	// }
}

func (*Client) Delete

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

Delete - Delete a Tenant Activity Log Alert rule. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2023-04-01-preview

  • managementGroupName - The management group ID.
  • alertRuleName - The name of the Tenant Activity Log Alert rule.
  • options - ClientDeleteOptions contains the optional parameters for the Client.Delete method.
Example

Generated from example definition: 2023-04-01-preview/TenantActivityLogAlertRule_DeleteRule.json

package main

import (
	"context"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/tenantactivitylogalerts/armtenantactivitylogalerts"
	"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 := armtenantactivitylogalerts.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().Delete(ctx, "72f988bf-86f1-41af-91ab-2d7cd011db47", "SampleActivityLogAlertSHRuleOnTenantLevel", 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 = armtenantactivitylogalerts.ClientDeleteResponse{
	// }
}

func (*Client) Get

func (client *Client) Get(ctx context.Context, managementGroupName string, alertRuleName string, options *ClientGetOptions) (ClientGetResponse, error)

Get - Get Tenant Activity Log Alert rule. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2023-04-01-preview

  • managementGroupName - The management group ID.
  • alertRuleName - The name of the Tenant Activity Log Alert rule.
  • options - ClientGetOptions contains the optional parameters for the Client.Get method.
Example

Generated from example definition: 2023-04-01-preview/TenantActivityLogAlertRule_GetRule.json

package main

import (
	"context"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/tenantactivitylogalerts/armtenantactivitylogalerts"
	"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 := armtenantactivitylogalerts.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().Get(ctx, "72f988bf-86f1-41af-91ab-2d7cd011db47", "SampleActivityLogAlertSHRuleOnTenantLevel", 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 = armtenantactivitylogalerts.ClientGetResponse{
	// 	TenantActivityLogAlertResource: &armtenantactivitylogalerts.TenantActivityLogAlertResource{
	// 		Name: to.Ptr("SampleActivityLogAlertSHRuleOnTenantLevel"),
	// 		Type: to.Ptr("Microsoft.AlertsManagement/TenantActivityLogAlerts"),
	// 		ID: to.Ptr("/providers/Microsoft.Management/ManagementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.AlertsManagement/TenantActivityLogAlerts/SampleActivityLogAlertSHRuleOnTenantLevel"),
	// 		Location: to.Ptr("Global"),
	// 		Properties: &armtenantactivitylogalerts.AlertRuleProperties{
	// 			Description: to.Ptr("Description of sample Activity Log Alert service health rule on tenant level events."),
	// 			Actions: &armtenantactivitylogalerts.ActionList{
	// 				ActionGroups: []*armtenantactivitylogalerts.ActionGroup{
	// 					{
	// 						ActionGroupID: to.Ptr("/providers/Microsoft.Management/ManagementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.Insights/actionGroups/SampleActionGroup"),
	// 						ActionProperties: map[string]*string{
	// 							"Email.Title": to.Ptr("my email title"),
	// 						},
	// 						WebhookProperties: map[string]*string{
	// 							"sampleWebhookProperty": to.Ptr("SamplePropertyValue"),
	// 						},
	// 					},
	// 				},
	// 			},
	// 			Condition: &armtenantactivitylogalerts.AlertRuleAllOfCondition{
	// 				AllOf: []*armtenantactivitylogalerts.AlertRuleAnyOfOrLeafCondition{
	// 					{
	// 						Equals: to.Ptr("ServiceHealth"),
	// 						Field: to.Ptr("category"),
	// 					},
	// 				},
	// 			},
	// 			Enabled: to.Ptr(true),
	// 			TenantScope: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"),
	// 		},
	// 		Tags: map[string]*string{
	// 		},
	// 	},
	// }
}

func (*Client) NewListByManagementGroupPager

func (client *Client) NewListByManagementGroupPager(managementGroupName string, options *ClientListByManagementGroupOptions) *runtime.Pager[ClientListByManagementGroupResponse]

NewListByManagementGroupPager - Get a list of all Tenant Activity Log Alert rules in a management group.

Generated from API version 2023-04-01-preview

  • managementGroupName - The management group ID.
  • options - ClientListByManagementGroupOptions contains the optional parameters for the Client.NewListByManagementGroupPager method.
Example

Generated from example definition: 2023-04-01-preview/TenantActivityLogAlertRule_ListByManagementGroup.json

package main

import (
	"context"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/tenantactivitylogalerts/armtenantactivitylogalerts"
	"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 := armtenantactivitylogalerts.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewClient().NewListByManagementGroupPager("72f988bf-86f1-41af-91ab-2d7cd011db47", 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 = armtenantactivitylogalerts.ClientListByManagementGroupResponse{
		// 	TenantAlertRuleList: armtenantactivitylogalerts.TenantAlertRuleList{
		// 		Value: []*armtenantactivitylogalerts.TenantActivityLogAlertResource{
		// 			{
		// 				Name: to.Ptr("SampleActivityLogAlertSHRuleOnTenantLevel"),
		// 				Type: to.Ptr("Microsoft.AlertsManagement/TenantActivityLogAlerts"),
		// 				ID: to.Ptr("/providers/Microsoft.Management/ManagementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.AlertsManagement/TenantActivityLogAlerts/SampleActivityLogAlertSHRuleOnTenantLevel"),
		// 				Location: to.Ptr("Global"),
		// 				Properties: &armtenantactivitylogalerts.AlertRuleProperties{
		// 					Description: to.Ptr("Description of sample Activity Log Alert service health rule on tenant level events."),
		// 					Actions: &armtenantactivitylogalerts.ActionList{
		// 						ActionGroups: []*armtenantactivitylogalerts.ActionGroup{
		// 							{
		// 								ActionGroupID: to.Ptr("/providers/Microsoft.Management/ManagementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.Insights/actionGroups/SampleActionGroup"),
		// 								ActionProperties: map[string]*string{
		// 									"Email.Title": to.Ptr("my email title"),
		// 								},
		// 								WebhookProperties: map[string]*string{
		// 									"sampleWebhookProperty": to.Ptr("SamplePropertyValue"),
		// 								},
		// 							},
		// 						},
		// 					},
		// 					Condition: &armtenantactivitylogalerts.AlertRuleAllOfCondition{
		// 						AllOf: []*armtenantactivitylogalerts.AlertRuleAnyOfOrLeafCondition{
		// 							{
		// 								Equals: to.Ptr("ServiceHealth"),
		// 								Field: to.Ptr("category"),
		// 							},
		// 						},
		// 					},
		// 					Enabled: to.Ptr(true),
		// 					TenantScope: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"),
		// 				},
		// 				Tags: map[string]*string{
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}

func (*Client) NewListByTenantPager

func (client *Client) NewListByTenantPager(options *ClientListByTenantOptions) *runtime.Pager[ClientListByTenantResponse]

NewListByTenantPager - Get a list of all Tenant Activity Log Alert rules in the tenant.

Generated from API version 2023-04-01-preview

  • options - ClientListByTenantOptions contains the optional parameters for the Client.NewListByTenantPager method.
Example

Generated from example definition: 2023-04-01-preview/TenantActivityLogAlertRule_ListByTenant.json

package main

import (
	"context"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/tenantactivitylogalerts/armtenantactivitylogalerts"
	"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 := armtenantactivitylogalerts.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewClient().NewListByTenantPager(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 = armtenantactivitylogalerts.ClientListByTenantResponse{
		// 	TenantAlertRuleList: armtenantactivitylogalerts.TenantAlertRuleList{
		// 		Value: []*armtenantactivitylogalerts.TenantActivityLogAlertResource{
		// 			{
		// 				ID: to.Ptr("/providers/Microsoft.Management/ManagementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.AlertsManagement/TenantActivityLogAlerts/SampleActivityLogAlertSHRuleOnTenantLevel"),
		// 				Type: to.Ptr("Microsoft.AlertsManagement/TenantActivityLogAlerts"),
		// 				Name: to.Ptr("SampleActivityLogAlertSHRuleOnTenantLevel"),
		// 				Location: to.Ptr("Global"),
		// 				Tags: map[string]*string{
		// 				},
		// 				Properties: &armtenantactivitylogalerts.AlertRuleProperties{
		// 					TenantScope: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"),
		// 					Condition: &armtenantactivitylogalerts.AlertRuleAllOfCondition{
		// 						AllOf: []*armtenantactivitylogalerts.AlertRuleAnyOfOrLeafCondition{
		// 							{
		// 								Field: to.Ptr("category"),
		// 								Equals: to.Ptr("ServiceHealth"),
		// 							},
		// 						},
		// 					},
		// 					Actions: &armtenantactivitylogalerts.ActionList{
		// 						ActionGroups: []*armtenantactivitylogalerts.ActionGroup{
		// 							{
		// 								ActionGroupID: to.Ptr("/providers/Microsoft.Management/ManagementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.Insights/actionGroups/SampleActionGroup"),
		// 								WebhookProperties: map[string]*string{
		// 									"sampleWebhookProperty": to.Ptr("SamplePropertyValue"),
		// 								},
		// 								ActionProperties: map[string]*string{
		// 									"Email.Title": to.Ptr("my email title"),
		// 								},
		// 							},
		// 						},
		// 					},
		// 					Enabled: to.Ptr(true),
		// 					Description: to.Ptr("Description of sample Activity Log Alert service health rule on tenant level events."),
		// 				},
		// 			},
		// 			{
		// 				ID: to.Ptr("/providers/Microsoft.Management/ManagementGroups/MyManagementGroup/providers/Microsoft.AlertsManagement/TenantActivityLogAlerts/SampleActivityLogAlertSHRuleOnTenantLevel"),
		// 				Type: to.Ptr("Microsoft.AlertsManagement/TenantActivityLogAlerts"),
		// 				Name: to.Ptr("SampleActivityLogAlertSHRuleOnTenantLevel"),
		// 				Location: to.Ptr("Global"),
		// 				Tags: map[string]*string{
		// 				},
		// 				Properties: &armtenantactivitylogalerts.AlertRuleProperties{
		// 					TenantScope: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"),
		// 					Condition: &armtenantactivitylogalerts.AlertRuleAllOfCondition{
		// 						AllOf: []*armtenantactivitylogalerts.AlertRuleAnyOfOrLeafCondition{
		// 							{
		// 								Field: to.Ptr("category"),
		// 								Equals: to.Ptr("ServiceHealth"),
		// 							},
		// 						},
		// 					},
		// 					Actions: &armtenantactivitylogalerts.ActionList{
		// 						ActionGroups: []*armtenantactivitylogalerts.ActionGroup{
		// 							{
		// 								ActionGroupID: to.Ptr("/providers/Microsoft.Management/ManagementGroups/MyManagementGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup"),
		// 								WebhookProperties: map[string]*string{
		// 									"sampleWebhookProperty": to.Ptr("SamplePropertyValue"),
		// 								},
		// 								ActionProperties: map[string]*string{
		// 									"Email.Title": to.Ptr("my email title"),
		// 								},
		// 							},
		// 						},
		// 					},
		// 					Enabled: to.Ptr(true),
		// 					Description: to.Ptr("Description of sample Activity Log Alert service health rule on tenant level events."),
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}

func (*Client) Update

func (client *Client) Update(ctx context.Context, managementGroupName string, alertRuleName string, tenantActivityLogAlertRulePatch TenantAlertRulePatchObject, options *ClientUpdateOptions) (ClientUpdateResponse, error)

Update - Updates 'tags' and 'enabled' fields in an existing Tenant Alert rule. This method is used to update the Alert rule tags, and to enable or disable the Alert rule. To update other fields use CreateOrUpdate operation. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2023-04-01-preview

  • managementGroupName - The management group ID.
  • alertRuleName - The name of the Tenant Activity Log Alert rule.
  • tenantActivityLogAlertRulePatch - Parameters supplied to the operation.
  • options - ClientUpdateOptions contains the optional parameters for the Client.Update method.
Example

Generated from example definition: 2023-04-01-preview/TenantActivityLogAlertRule_UpdateRule.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/tenantactivitylogalerts/armtenantactivitylogalerts"
	"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 := armtenantactivitylogalerts.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().Update(ctx, "72f988bf-86f1-41af-91ab-2d7cd011db47", "SampleActivityLogAlertSHRuleOnTenantLevel", armtenantactivitylogalerts.TenantAlertRulePatchObject{
		Properties: &armtenantactivitylogalerts.TenantAlertRulePatchProperties{
			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 = armtenantactivitylogalerts.ClientUpdateResponse{
	// 	TenantActivityLogAlertResource: &armtenantactivitylogalerts.TenantActivityLogAlertResource{
	// 		Name: to.Ptr("SampleActivityLogAlertSHRuleOnTenantLevel"),
	// 		Type: to.Ptr("Microsoft.AlertsManagement/TenantActivityLogAlerts"),
	// 		ID: to.Ptr("/providers/Microsoft.Management/ManagementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.AlertsManagement/TenantActivityLogAlerts/SampleActivityLogAlertSHRuleOnTenantLevel"),
	// 		Location: to.Ptr("Global"),
	// 		Properties: &armtenantactivitylogalerts.AlertRuleProperties{
	// 			Description: to.Ptr("Description of sample Activity Log Alert service health rule on tenant level events."),
	// 			Actions: &armtenantactivitylogalerts.ActionList{
	// 				ActionGroups: []*armtenantactivitylogalerts.ActionGroup{
	// 					{
	// 						ActionGroupID: to.Ptr("/providers/Microsoft.Management/ManagementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.Insights/actionGroups/SampleActionGroup"),
	// 						ActionProperties: map[string]*string{
	// 							"Email.Title": to.Ptr("my email title"),
	// 						},
	// 						WebhookProperties: map[string]*string{
	// 							"sampleWebhookProperty": to.Ptr("SamplePropertyValue"),
	// 						},
	// 					},
	// 				},
	// 			},
	// 			Condition: &armtenantactivitylogalerts.AlertRuleAllOfCondition{
	// 				AllOf: []*armtenantactivitylogalerts.AlertRuleAnyOfOrLeafCondition{
	// 					{
	// 						Equals: to.Ptr("ServiceHealth"),
	// 						Field: to.Ptr("category"),
	// 					},
	// 				},
	// 			},
	// 			Enabled: to.Ptr(false),
	// 			TenantScope: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"),
	// 		},
	// 		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 {
	// A Tenant Activity Log Alert rule resource.
	TenantActivityLogAlertResource
}

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 {
}

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(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 ClientGetOptions

type ClientGetOptions struct {
}

ClientGetOptions contains the optional parameters for the Client.Get method.

type ClientGetResponse

type ClientGetResponse struct {
	// A Tenant Activity Log Alert rule resource.
	TenantActivityLogAlertResource
}

ClientGetResponse contains the response from method Client.Get.

type ClientListByManagementGroupOptions

type ClientListByManagementGroupOptions struct {
}

ClientListByManagementGroupOptions contains the optional parameters for the Client.NewListByManagementGroupPager method.

type ClientListByManagementGroupResponse

type ClientListByManagementGroupResponse struct {
	// A list of Tenant Activity Log Alert rules.
	TenantAlertRuleList
}

ClientListByManagementGroupResponse contains the response from method Client.NewListByManagementGroupPager.

type ClientListByTenantOptions

type ClientListByTenantOptions struct {
}

ClientListByTenantOptions contains the optional parameters for the Client.NewListByTenantPager method.

type ClientListByTenantResponse

type ClientListByTenantResponse struct {
	// A list of Tenant Activity Log Alert rules.
	TenantAlertRuleList
}

ClientListByTenantResponse contains the response from method Client.NewListByTenantPager.

type ClientUpdateOptions

type ClientUpdateOptions struct {
}

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

type ClientUpdateResponse

type ClientUpdateResponse struct {
	// A Tenant Activity Log Alert rule resource.
	TenantActivityLogAlertResource
}

ClientUpdateResponse contains the response from method Client.Update.

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 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 TenantActivityLogAlertResource

type TenantActivityLogAlertResource struct {
	// REQUIRED; The Activity Log Alert rule properties of the resource.
	Properties *AlertRuleProperties

	// The geo-location where the resource lives
	Location *string

	// 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
}

TenantActivityLogAlertResource - A Tenant Activity Log Alert rule resource.

func (TenantActivityLogAlertResource) MarshalJSON

func (t TenantActivityLogAlertResource) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type TenantActivityLogAlertResource.

func (*TenantActivityLogAlertResource) UnmarshalJSON

func (t *TenantActivityLogAlertResource) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type TenantActivityLogAlertResource.

type TenantAlertRuleList

type TenantAlertRuleList struct {
	// REQUIRED; The TenantActivityLogAlertResource items on this page
	Value []*TenantActivityLogAlertResource

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

TenantAlertRuleList - A list of Tenant Activity Log Alert rules.

func (TenantAlertRuleList) MarshalJSON

func (t TenantAlertRuleList) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type TenantAlertRuleList.

func (*TenantAlertRuleList) UnmarshalJSON

func (t *TenantAlertRuleList) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type TenantAlertRuleList.

type TenantAlertRulePatchObject

type TenantAlertRulePatchObject struct {
	// The activity log alert settings for an update operation.
	Properties *TenantAlertRulePatchProperties

	// The resource tags
	Tags map[string]*string
}

TenantAlertRulePatchObject - An Activity Log Alert rule object for the body of patch operations.

func (TenantAlertRulePatchObject) MarshalJSON

func (t TenantAlertRulePatchObject) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type TenantAlertRulePatchObject.

func (*TenantAlertRulePatchObject) UnmarshalJSON

func (t *TenantAlertRulePatchObject) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type TenantAlertRulePatchObject.

type TenantAlertRulePatchProperties

type TenantAlertRulePatchProperties struct {
	// Indicates whether this Activity Log Alert rule is enabled. If an Activity Log Alert rule is not enabled, then none of its
	// actions will be activated.
	Enabled *bool
}

TenantAlertRulePatchProperties - An Activity Log Alert rule properties for patch operations.

func (TenantAlertRulePatchProperties) MarshalJSON

func (t TenantAlertRulePatchProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type TenantAlertRulePatchProperties.

func (*TenantAlertRulePatchProperties) UnmarshalJSON

func (t *TenantAlertRulePatchProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type TenantAlertRulePatchProperties.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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