Documentation ¶
Index ¶
- type Action
- type ActionClassification
- type ActionGroup
- type ActionList
- type ActionStatus
- type ActionType
- type AddActionGroups
- type Alert
- type AlertModification
- type AlertModificationEvent
- type AlertModificationItem
- type AlertModificationProperties
- type AlertProcessingRule
- type AlertProcessingRuleProperties
- type AlertProcessingRulesClient
- func (client *AlertProcessingRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, alertProcessingRuleName string, ...) (AlertProcessingRulesClientCreateOrUpdateResponse, error)
- func (client *AlertProcessingRulesClient) Delete(ctx context.Context, resourceGroupName string, alertProcessingRuleName string, ...) (AlertProcessingRulesClientDeleteResponse, error)
- func (client *AlertProcessingRulesClient) GetByName(ctx context.Context, resourceGroupName string, alertProcessingRuleName string, ...) (AlertProcessingRulesClientGetByNameResponse, error)
- func (client *AlertProcessingRulesClient) NewListByResourceGroupPager(resourceGroupName string, ...) *runtime.Pager[AlertProcessingRulesClientListByResourceGroupResponse]
- func (client *AlertProcessingRulesClient) NewListBySubscriptionPager(options *AlertProcessingRulesClientListBySubscriptionOptions) *runtime.Pager[AlertProcessingRulesClientListBySubscriptionResponse]
- func (client *AlertProcessingRulesClient) Update(ctx context.Context, resourceGroupName string, alertProcessingRuleName string, ...) (AlertProcessingRulesClientUpdateResponse, error)
- type AlertProcessingRulesClientCreateOrUpdateOptions
- type AlertProcessingRulesClientCreateOrUpdateResponse
- type AlertProcessingRulesClientDeleteOptions
- type AlertProcessingRulesClientDeleteResponse
- type AlertProcessingRulesClientGetByNameOptions
- type AlertProcessingRulesClientGetByNameResponse
- type AlertProcessingRulesClientListByResourceGroupOptions
- type AlertProcessingRulesClientListByResourceGroupResponse
- type AlertProcessingRulesClientListBySubscriptionOptions
- type AlertProcessingRulesClientListBySubscriptionResponse
- type AlertProcessingRulesClientUpdateOptions
- type AlertProcessingRulesClientUpdateResponse
- type AlertProcessingRulesList
- type AlertProperties
- type AlertRuleAllOfCondition
- type AlertRuleAnyOfOrLeafCondition
- type AlertRuleLeafCondition
- type AlertRuleProperties
- type AlertRuleRecommendationProperties
- type AlertRuleRecommendationResource
- type AlertRuleRecommendationsClient
- func (client *AlertRuleRecommendationsClient) NewListByResourcePager(resourceURI string, ...) *runtime.Pager[AlertRuleRecommendationsClientListByResourceResponse]
- func (client *AlertRuleRecommendationsClient) NewListByTargetTypePager(targetType string, ...) *runtime.Pager[AlertRuleRecommendationsClientListByTargetTypeResponse]
- type AlertRuleRecommendationsClientListByResourceOptions
- type AlertRuleRecommendationsClientListByResourceResponse
- type AlertRuleRecommendationsClientListByTargetTypeOptions
- type AlertRuleRecommendationsClientListByTargetTypeResponse
- type AlertRuleRecommendationsListResponse
- type AlertState
- type AlertsClient
- func (client *AlertsClient) ChangeState(ctx context.Context, alertID string, newState AlertState, ...) (AlertsClientChangeStateResponse, error)
- func (client *AlertsClient) GetByID(ctx context.Context, alertID string, options *AlertsClientGetByIDOptions) (AlertsClientGetByIDResponse, error)
- func (client *AlertsClient) GetHistory(ctx context.Context, alertID string, options *AlertsClientGetHistoryOptions) (AlertsClientGetHistoryResponse, error)
- func (client *AlertsClient) GetSummary(ctx context.Context, groupby AlertsSummaryGroupByFields, ...) (AlertsClientGetSummaryResponse, error)
- func (client *AlertsClient) MetaData(ctx context.Context, identifier Identifier, ...) (AlertsClientMetaDataResponse, error)
- func (client *AlertsClient) NewGetAllPager(options *AlertsClientGetAllOptions) *runtime.Pager[AlertsClientGetAllResponse]
- type AlertsClientChangeStateOptions
- type AlertsClientChangeStateResponse
- type AlertsClientGetAllOptions
- type AlertsClientGetAllResponse
- type AlertsClientGetByIDOptions
- type AlertsClientGetByIDResponse
- type AlertsClientGetHistoryOptions
- type AlertsClientGetHistoryResponse
- type AlertsClientGetSummaryOptions
- type AlertsClientGetSummaryResponse
- type AlertsClientMetaDataOptions
- type AlertsClientMetaDataResponse
- type AlertsList
- type AlertsMetaData
- type AlertsMetaDataProperties
- type AlertsMetaDataPropertiesClassification
- type AlertsSortByFields
- type AlertsSummary
- type AlertsSummaryGroup
- type AlertsSummaryGroupByFields
- type AlertsSummaryGroupItem
- type ClientFactory
- func (c *ClientFactory) NewAlertProcessingRulesClient() *AlertProcessingRulesClient
- func (c *ClientFactory) NewAlertRuleRecommendationsClient() *AlertRuleRecommendationsClient
- func (c *ClientFactory) NewAlertsClient() *AlertsClient
- func (c *ClientFactory) NewOperationsClient() *OperationsClient
- func (c *ClientFactory) NewPrometheusRuleGroupsClient() *PrometheusRuleGroupsClient
- func (c *ClientFactory) NewSmartGroupsClient() *SmartGroupsClient
- func (c *ClientFactory) NewTenantActivityLogAlertsClient() *TenantActivityLogAlertsClient
- type Comments
- type Condition
- type CreatedByType
- type DailyRecurrence
- type DaysOfWeek
- type Essentials
- type Field
- type Identifier
- type MetadataIdentifier
- type MonitorCondition
- type MonitorService
- type MonitorServiceDetails
- type MonitorServiceList
- type MonthlyRecurrence
- type Operation
- type OperationDisplay
- type OperationsClient
- type OperationsClientListOptions
- type OperationsClientListResponse
- type OperationsList
- type Operator
- type PatchObject
- type PatchProperties
- type PrometheusRule
- type PrometheusRuleGroupAction
- type PrometheusRuleGroupProperties
- type PrometheusRuleGroupResource
- type PrometheusRuleGroupResourceCollection
- type PrometheusRuleGroupResourcePatch
- type PrometheusRuleGroupResourcePatchProperties
- type PrometheusRuleGroupsClient
- func (client *PrometheusRuleGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleGroupName string, ...) (PrometheusRuleGroupsClientCreateOrUpdateResponse, error)
- func (client *PrometheusRuleGroupsClient) Delete(ctx context.Context, resourceGroupName string, ruleGroupName string, ...) (PrometheusRuleGroupsClientDeleteResponse, error)
- func (client *PrometheusRuleGroupsClient) Get(ctx context.Context, resourceGroupName string, ruleGroupName string, ...) (PrometheusRuleGroupsClientGetResponse, error)
- func (client *PrometheusRuleGroupsClient) NewListByResourceGroupPager(resourceGroupName string, ...) *runtime.Pager[PrometheusRuleGroupsClientListByResourceGroupResponse]
- func (client *PrometheusRuleGroupsClient) NewListBySubscriptionPager(options *PrometheusRuleGroupsClientListBySubscriptionOptions) *runtime.Pager[PrometheusRuleGroupsClientListBySubscriptionResponse]
- func (client *PrometheusRuleGroupsClient) Update(ctx context.Context, resourceGroupName string, ruleGroupName string, ...) (PrometheusRuleGroupsClientUpdateResponse, error)
- type PrometheusRuleGroupsClientCreateOrUpdateOptions
- type PrometheusRuleGroupsClientCreateOrUpdateResponse
- type PrometheusRuleGroupsClientDeleteOptions
- type PrometheusRuleGroupsClientDeleteResponse
- type PrometheusRuleGroupsClientGetOptions
- type PrometheusRuleGroupsClientGetResponse
- type PrometheusRuleGroupsClientListByResourceGroupOptions
- type PrometheusRuleGroupsClientListByResourceGroupResponse
- type PrometheusRuleGroupsClientListBySubscriptionOptions
- type PrometheusRuleGroupsClientListBySubscriptionResponse
- type PrometheusRuleGroupsClientUpdateOptions
- type PrometheusRuleGroupsClientUpdateResponse
- type PrometheusRuleResolveConfiguration
- type Recurrence
- type RecurrenceClassification
- type RecurrenceType
- type RemoveAllActionGroups
- type RuleArmTemplate
- type Schedule
- type Severity
- type SignalType
- type SmartGroup
- type SmartGroupAggregatedProperty
- type SmartGroupModification
- type SmartGroupModificationEvent
- type SmartGroupModificationItem
- type SmartGroupModificationProperties
- type SmartGroupProperties
- type SmartGroupsClient
- func (client *SmartGroupsClient) ChangeState(ctx context.Context, smartGroupID string, newState AlertState, ...) (SmartGroupsClientChangeStateResponse, error)
- func (client *SmartGroupsClient) GetByID(ctx context.Context, smartGroupID string, ...) (SmartGroupsClientGetByIDResponse, error)
- func (client *SmartGroupsClient) GetHistory(ctx context.Context, smartGroupID string, ...) (SmartGroupsClientGetHistoryResponse, error)
- func (client *SmartGroupsClient) NewGetAllPager(options *SmartGroupsClientGetAllOptions) *runtime.Pager[SmartGroupsClientGetAllResponse]
- type SmartGroupsClientChangeStateOptions
- type SmartGroupsClientChangeStateResponse
- type SmartGroupsClientGetAllOptions
- type SmartGroupsClientGetAllResponse
- type SmartGroupsClientGetByIDOptions
- type SmartGroupsClientGetByIDResponse
- type SmartGroupsClientGetHistoryOptions
- type SmartGroupsClientGetHistoryResponse
- type SmartGroupsList
- type SmartGroupsSortByFields
- type SortOrder
- type State
- type SystemData
- type TenantActivityLogAlertResource
- type TenantActivityLogAlertsClient
- func (client *TenantActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, managementGroupName string, alertRuleName string, ...) (TenantActivityLogAlertsClientCreateOrUpdateResponse, error)
- func (client *TenantActivityLogAlertsClient) Delete(ctx context.Context, managementGroupName string, alertRuleName string, ...) (TenantActivityLogAlertsClientDeleteResponse, error)
- func (client *TenantActivityLogAlertsClient) Get(ctx context.Context, managementGroupName string, alertRuleName string, ...) (TenantActivityLogAlertsClientGetResponse, error)
- func (client *TenantActivityLogAlertsClient) NewListByManagementGroupPager(managementGroupName string, ...) *runtime.Pager[TenantActivityLogAlertsClientListByManagementGroupResponse]
- func (client *TenantActivityLogAlertsClient) NewListByTenantPager(options *TenantActivityLogAlertsClientListByTenantOptions) *runtime.Pager[TenantActivityLogAlertsClientListByTenantResponse]
- func (client *TenantActivityLogAlertsClient) Update(ctx context.Context, managementGroupName string, alertRuleName string, ...) (TenantActivityLogAlertsClientUpdateResponse, error)
- type TenantActivityLogAlertsClientCreateOrUpdateOptions
- type TenantActivityLogAlertsClientCreateOrUpdateResponse
- type TenantActivityLogAlertsClientDeleteOptions
- type TenantActivityLogAlertsClientDeleteResponse
- type TenantActivityLogAlertsClientGetOptions
- type TenantActivityLogAlertsClientGetResponse
- type TenantActivityLogAlertsClientListByManagementGroupOptions
- type TenantActivityLogAlertsClientListByManagementGroupResponse
- type TenantActivityLogAlertsClientListByTenantOptions
- type TenantActivityLogAlertsClientListByTenantResponse
- type TenantActivityLogAlertsClientUpdateOptions
- type TenantActivityLogAlertsClientUpdateResponse
- type TenantAlertRuleList
- type TenantAlertRulePatchObject
- type TenantAlertRulePatchProperties
- type TimeRange
- type WeeklyRecurrence
Examples ¶
- AlertProcessingRulesClient.CreateOrUpdate (CreateOrUpdateARuleThatAddsAnActionGroupToAllAlertsInASubscription)
- AlertProcessingRulesClient.CreateOrUpdate (CreateOrUpdateARuleThatAddsTwoActionGroupsToAllSev0AndSev1AlertsInTwoResourceGroups)
- AlertProcessingRulesClient.CreateOrUpdate (CreateOrUpdateARuleThatRemovesAllActionGroupsFromAlertsOnASpecificVmDuringAOneOffMaintenanceWindow18002000AtASpecificDatePacificStandardTime)
- AlertProcessingRulesClient.CreateOrUpdate (CreateOrUpdateARuleThatRemovesAllActionGroupsFromAllAlertsInASubscriptionComingFromASpecificAlertRule)
- AlertProcessingRulesClient.CreateOrUpdate (CreateOrUpdateARuleThatRemovesAllActionGroupsFromAllAlertsOnAnyVmInTwoResourceGroupsDuringARecurringMaintenanceWindow22000400EverySatAndSunIndiaStandardTime)
- AlertProcessingRulesClient.CreateOrUpdate (CreateOrUpdateARuleThatRemovesAllActionGroupsOutsideBusinessHoursMonFri09001700EasternStandardTime)
- AlertProcessingRulesClient.Delete
- AlertProcessingRulesClient.GetByName
- AlertProcessingRulesClient.NewListByResourceGroupPager
- AlertProcessingRulesClient.NewListBySubscriptionPager
- AlertProcessingRulesClient.Update
- AlertRuleRecommendationsClient.NewListByResourcePager (ListAlertRuleRecommendationsForMonitoringAccountsAtResourceLevel)
- AlertRuleRecommendationsClient.NewListByResourcePager (ListAlertRuleRecommendationsForVirtualMachinesAtResourceLevel)
- AlertRuleRecommendationsClient.NewListByTargetTypePager (ListAlertRuleRecommendationsForMonitoringAccountsAtSubscriptionLevel)
- AlertRuleRecommendationsClient.NewListByTargetTypePager (ListAlertRuleRecommendationsForVirtualMachinesAtSubscriptionLevel)
- AlertsClient.ChangeState
- AlertsClient.GetByID
- AlertsClient.GetHistory
- AlertsClient.GetSummary
- AlertsClient.MetaData
- AlertsClient.NewGetAllPager
- OperationsClient.NewListPager
- PrometheusRuleGroupsClient.CreateOrUpdate
- PrometheusRuleGroupsClient.Delete
- PrometheusRuleGroupsClient.Get
- PrometheusRuleGroupsClient.NewListByResourceGroupPager
- PrometheusRuleGroupsClient.NewListBySubscriptionPager
- PrometheusRuleGroupsClient.Update
- SmartGroupsClient.ChangeState
- SmartGroupsClient.GetByID
- SmartGroupsClient.GetHistory
- SmartGroupsClient.NewGetAllPager
- TenantActivityLogAlertsClient.CreateOrUpdate
- TenantActivityLogAlertsClient.Delete
- TenantActivityLogAlertsClient.Get
- TenantActivityLogAlertsClient.NewListByManagementGroupPager
- TenantActivityLogAlertsClient.NewListByTenantPager
- TenantActivityLogAlertsClient.Update
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶ added in v0.3.0
type Action struct { // REQUIRED; Action that should be applied. ActionType *ActionType }
Action to be applied.
func (*Action) GetAction ¶ added in v0.3.0
GetAction implements the ActionClassification interface for type Action.
func (Action) MarshalJSON ¶ added in v0.7.0
MarshalJSON implements the json.Marshaller interface for type Action.
func (*Action) UnmarshalJSON ¶ added in v0.7.0
UnmarshalJSON implements the json.Unmarshaller interface for type Action.
type ActionClassification ¶ added in v0.3.0
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 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 ¶ added in v0.10.0
type ActionList struct { // The list of the Action Groups. ActionGroups []*ActionGroup }
ActionList - A list of Activity Log Alert rule actions.
func (ActionList) MarshalJSON ¶ added in v0.10.0
func (a ActionList) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ActionList.
func (*ActionList) UnmarshalJSON ¶ added in v0.10.0
func (a *ActionList) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ActionList.
type ActionStatus ¶ added in v0.4.0
type ActionStatus struct { // Value indicating whether alert is suppressed. IsSuppressed *bool }
ActionStatus - Action status
func (ActionStatus) MarshalJSON ¶ added in v0.7.0
func (a ActionStatus) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ActionStatus.
func (*ActionStatus) UnmarshalJSON ¶ added in v0.7.0
func (a *ActionStatus) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ActionStatus.
type ActionType ¶ added in v0.3.0
type ActionType string
ActionType - Action that should be applied.
const ( ActionTypeAddActionGroups ActionType = "AddActionGroups" ActionTypeRemoveAllActionGroups ActionType = "RemoveAllActionGroups" )
func PossibleActionTypeValues ¶ added in v0.3.0
func PossibleActionTypeValues() []ActionType
PossibleActionTypeValues returns the possible values for the ActionType const type.
type AddActionGroups ¶ added in v0.3.0
type AddActionGroups struct { // REQUIRED; List of action group Ids to add to alert processing rule. ActionGroupIDs []*string // REQUIRED; Action that should be applied. ActionType *ActionType }
AddActionGroups - Add action groups to alert processing rule.
func (*AddActionGroups) GetAction ¶ added in v0.3.0
func (a *AddActionGroups) GetAction() *Action
GetAction implements the ActionClassification interface for type AddActionGroups.
func (AddActionGroups) MarshalJSON ¶ added in v0.3.0
func (a AddActionGroups) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AddActionGroups.
func (*AddActionGroups) UnmarshalJSON ¶ added in v0.3.0
func (a *AddActionGroups) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AddActionGroups.
type Alert ¶
type Alert struct { // Alert property bag Properties *AlertProperties // READ-ONLY; Azure resource Id ID *string // READ-ONLY; Azure resource name Name *string // READ-ONLY; Azure resource type Type *string }
Alert - An alert created in alert management service.
func (Alert) MarshalJSON ¶
MarshalJSON implements the json.Marshaller interface for type Alert.
func (*Alert) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaller interface for type Alert.
type AlertModification ¶
type AlertModification struct { // Properties of the alert modification item. Properties *AlertModificationProperties // READ-ONLY; Azure resource Id ID *string // READ-ONLY; Azure resource name Name *string // READ-ONLY; Azure resource type Type *string }
AlertModification - Alert Modification details
func (AlertModification) MarshalJSON ¶
func (a AlertModification) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AlertModification.
func (*AlertModification) UnmarshalJSON ¶
func (a *AlertModification) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AlertModification.
type AlertModificationEvent ¶
type AlertModificationEvent string
AlertModificationEvent - Reason for the modification
const ( AlertModificationEventActionRuleSuppressed AlertModificationEvent = "ActionRuleSuppressed" AlertModificationEventActionRuleTriggered AlertModificationEvent = "ActionRuleTriggered" AlertModificationEventActionsFailed AlertModificationEvent = "ActionsFailed" AlertModificationEventActionsSuppressed AlertModificationEvent = "ActionsSuppressed" AlertModificationEventActionsTriggered AlertModificationEvent = "ActionsTriggered" AlertModificationEventAlertCreated AlertModificationEvent = "AlertCreated" AlertModificationEventMonitorConditionChange AlertModificationEvent = "MonitorConditionChange" AlertModificationEventSeverityChange AlertModificationEvent = "SeverityChange" AlertModificationEventStateChange AlertModificationEvent = "StateChange" )
func PossibleAlertModificationEventValues ¶
func PossibleAlertModificationEventValues() []AlertModificationEvent
PossibleAlertModificationEventValues returns the possible values for the AlertModificationEvent const type.
type AlertModificationItem ¶
type AlertModificationItem struct { // Modification comments Comments *string // Description of the modification Description *string // Reason for the modification ModificationEvent *AlertModificationEvent // Modified date and time ModifiedAt *string // Modified user details (Principal client name) ModifiedBy *string // New value NewValue *string // Old value OldValue *string }
AlertModificationItem - Alert modification item.
func (AlertModificationItem) MarshalJSON ¶ added in v0.7.0
func (a AlertModificationItem) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AlertModificationItem.
func (*AlertModificationItem) UnmarshalJSON ¶ added in v0.7.0
func (a *AlertModificationItem) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AlertModificationItem.
type AlertModificationProperties ¶
type AlertModificationProperties struct { // Modification details Modifications []*AlertModificationItem // READ-ONLY; Unique Id of the alert for which the history is being retrieved AlertID *string }
AlertModificationProperties - Properties of the alert modification item.
func (AlertModificationProperties) MarshalJSON ¶
func (a AlertModificationProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AlertModificationProperties.
func (*AlertModificationProperties) UnmarshalJSON ¶ added in v0.7.0
func (a *AlertModificationProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AlertModificationProperties.
type AlertProcessingRule ¶ added in v0.3.0
type AlertProcessingRule struct { // REQUIRED; Resource location Location *string // Alert processing rule properties. Properties *AlertProcessingRuleProperties // Resource tags Tags map[string]*string // READ-ONLY; Azure resource Id ID *string // READ-ONLY; Azure resource name Name *string // READ-ONLY; Alert processing rule system data. SystemData *SystemData // READ-ONLY; Azure resource type Type *string }
AlertProcessingRule - Alert processing rule object containing target scopes, conditions and scheduling logic.
func (AlertProcessingRule) MarshalJSON ¶ added in v0.3.0
func (a AlertProcessingRule) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AlertProcessingRule.
func (*AlertProcessingRule) UnmarshalJSON ¶ added in v0.7.0
func (a *AlertProcessingRule) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AlertProcessingRule.
type AlertProcessingRuleProperties ¶ added in v0.3.0
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 // 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 ¶ added in v0.3.0
func (a AlertProcessingRuleProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AlertProcessingRuleProperties.
func (*AlertProcessingRuleProperties) UnmarshalJSON ¶ added in v0.3.0
func (a *AlertProcessingRuleProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AlertProcessingRuleProperties.
type AlertProcessingRulesClient ¶ added in v0.3.0
type AlertProcessingRulesClient struct {
// contains filtered or unexported fields
}
AlertProcessingRulesClient contains the methods for the AlertProcessingRules group. Don't use this type directly, use NewAlertProcessingRulesClient() instead.
func NewAlertProcessingRulesClient ¶ added in v0.3.0
func NewAlertProcessingRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertProcessingRulesClient, error)
NewAlertProcessingRulesClient creates a new instance of AlertProcessingRulesClient with the specified values.
- subscriptionID - The ID of the target subscription.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*AlertProcessingRulesClient) CreateOrUpdate ¶ added in v0.3.0
func (client *AlertProcessingRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, alertProcessingRuleName string, alertProcessingRule AlertProcessingRule, options *AlertProcessingRulesClientCreateOrUpdateOptions) (AlertProcessingRulesClientCreateOrUpdateResponse, 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 - Resource group name where the resource is created.
- alertProcessingRuleName - The name of the alert processing rule that needs to be created/updated.
- alertProcessingRule - Alert processing rule to be created/updated.
- options - AlertProcessingRulesClientCreateOrUpdateOptions contains the optional parameters for the AlertProcessingRulesClient.CreateOrUpdate method.
Example (CreateOrUpdateARuleThatAddsAnActionGroupToAllAlertsInASubscription) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2021-08-08/examples/AlertProcessingRules_Create_or_update_add_action_group_all_alerts_in_subscription.json
package main import ( "context" "log" "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/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewAlertProcessingRulesClient().CreateOrUpdate(ctx, "alertscorrelationrg", "AddActionGroupToSubscription", armalertsmanagement.AlertProcessingRule{ Location: to.Ptr("Global"), Tags: map[string]*string{}, Properties: &armalertsmanagement.AlertProcessingRuleProperties{ Description: to.Ptr("Add ActionGroup1 to all alerts in the subscription"), Actions: []armalertsmanagement.ActionClassification{ &armalertsmanagement.AddActionGroups{ ActionType: to.Ptr(armalertsmanagement.ActionTypeAddActionGroups), ActionGroupIDs: []*string{ to.Ptr("/subscriptions/subId1/resourcegroups/RGId1/providers/microsoft.insights/actiongroups/ActionGroup1")}, }}, Enabled: to.Ptr(true), Scopes: []*string{ to.Ptr("/subscriptions/subId1")}, }, }, 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.AlertProcessingRule = armalertsmanagement.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"), // Tags: map[string]*string{ // }, // Properties: &armalertsmanagement.AlertProcessingRuleProperties{ // Description: to.Ptr("Add ActionGroup1 to all alerts in the subscription"), // Actions: []armalertsmanagement.ActionClassification{ // &armalertsmanagement.AddActionGroups{ // ActionType: to.Ptr(armalertsmanagement.ActionTypeAddActionGroups), // ActionGroupIDs: []*string{ // to.Ptr("/subscriptions/subId1/resourcegroups/RGId1/providers/microsoft.insights/actiongroups/ActionGroup1")}, // }}, // Enabled: to.Ptr(true), // Scopes: []*string{ // to.Ptr("/subscriptions/subId1")}, // }, // SystemData: &armalertsmanagement.SystemData{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-02-12T22:05:09.000Z"); return t}()), // CreatedBy: to.Ptr("abc@microsoft.com"), // CreatedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-02-13T16:15:34.000Z"); return t}()), // LastModifiedBy: to.Ptr("xyz@microsoft.com"), // LastModifiedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // }, // } }
Output:
Example (CreateOrUpdateARuleThatAddsTwoActionGroupsToAllSev0AndSev1AlertsInTwoResourceGroups) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2021-08-08/examples/AlertProcessingRules_Create_or_update_add_two_action_groups_all_Sev0_Sev1_two_resource_groups.json
package main import ( "context" "log" "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/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewAlertProcessingRulesClient().CreateOrUpdate(ctx, "alertscorrelationrg", "AddActionGroupsBySeverity", armalertsmanagement.AlertProcessingRule{ Location: to.Ptr("Global"), Tags: map[string]*string{}, Properties: &armalertsmanagement.AlertProcessingRuleProperties{ Description: to.Ptr("Add AGId1 and AGId2 to all Sev0 and Sev1 alerts in these resourceGroups"), Actions: []armalertsmanagement.ActionClassification{ &armalertsmanagement.AddActionGroups{ ActionType: to.Ptr(armalertsmanagement.ActionTypeAddActionGroups), ActionGroupIDs: []*string{ to.Ptr("/subscriptions/subId1/resourcegroups/RGId1/providers/microsoft.insights/actiongroups/AGId1"), to.Ptr("/subscriptions/subId1/resourcegroups/RGId1/providers/microsoft.insights/actiongroups/AGId2")}, }}, Conditions: []*armalertsmanagement.Condition{ { Field: to.Ptr(armalertsmanagement.FieldSeverity), Operator: to.Ptr(armalertsmanagement.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")}, }, }, 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.AlertProcessingRule = armalertsmanagement.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"), // Tags: map[string]*string{ // }, // Properties: &armalertsmanagement.AlertProcessingRuleProperties{ // Description: to.Ptr("Add AGId1 and AGId2 to all Sev0 and Sev1 alerts in these resourceGroups"), // Actions: []armalertsmanagement.ActionClassification{ // &armalertsmanagement.AddActionGroups{ // ActionType: to.Ptr(armalertsmanagement.ActionTypeAddActionGroups), // ActionGroupIDs: []*string{ // to.Ptr("/subscriptions/subId1/resourcegroups/RGId1/providers/microsoft.insights/actiongroups/AGId1"), // to.Ptr("/subscriptions/subId1/resourcegroups/RGId1/providers/microsoft.insights/actiongroups/AGId2")}, // }}, // Conditions: []*armalertsmanagement.Condition{ // { // Field: to.Ptr(armalertsmanagement.FieldSeverity), // Operator: to.Ptr(armalertsmanagement.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: &armalertsmanagement.SystemData{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09.000Z"); return t}()), // CreatedBy: to.Ptr("abc@microsoft.com"), // CreatedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-13T22:05:09.000Z"); return t}()), // LastModifiedBy: to.Ptr("xyz@microsoft.com"), // LastModifiedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // }, // } }
Output:
Example (CreateOrUpdateARuleThatRemovesAllActionGroupsFromAlertsOnASpecificVmDuringAOneOffMaintenanceWindow18002000AtASpecificDatePacificStandardTime) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2021-08-08/examples/AlertProcessingRules_Create_or_update_remove_all_action_groups_specific_VM_one-off_maintenance_window.json
package main import ( "context" "log" "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/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewAlertProcessingRulesClient().CreateOrUpdate(ctx, "alertscorrelationrg", "RemoveActionGroupsMaintenanceWindow", armalertsmanagement.AlertProcessingRule{ Location: to.Ptr("Global"), Tags: map[string]*string{}, Properties: &armalertsmanagement.AlertProcessingRuleProperties{ Description: to.Ptr("Removes all ActionGroups from all Alerts on VMName during the maintenance window"), Actions: []armalertsmanagement.ActionClassification{ &armalertsmanagement.RemoveAllActionGroups{ ActionType: to.Ptr(armalertsmanagement.ActionTypeRemoveAllActionGroups), }}, Enabled: to.Ptr(true), Schedule: &armalertsmanagement.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")}, }, }, 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.AlertProcessingRule = armalertsmanagement.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"), // Tags: map[string]*string{ // }, // Properties: &armalertsmanagement.AlertProcessingRuleProperties{ // Description: to.Ptr("Removes all ActionGroups from all Alerts on VMName during the maintenance window"), // Actions: []armalertsmanagement.ActionClassification{ // &armalertsmanagement.RemoveAllActionGroups{ // ActionType: to.Ptr(armalertsmanagement.ActionTypeRemoveAllActionGroups), // }}, // Enabled: to.Ptr(true), // Schedule: &armalertsmanagement.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: &armalertsmanagement.SystemData{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T20:13:29.000Z"); return t}()), // CreatedBy: to.Ptr("abc@microsoft.com"), // CreatedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09.000Z"); return t}()), // LastModifiedBy: to.Ptr("xyz@microsoft.com"), // LastModifiedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // }, // } }
Output:
Example (CreateOrUpdateARuleThatRemovesAllActionGroupsFromAllAlertsInASubscriptionComingFromASpecificAlertRule) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2021-08-08/examples/AlertProcessingRules_Create_or_update_remove_all_action_groups_from_specific_alert_rule.json
package main import ( "context" "log" "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/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewAlertProcessingRulesClient().CreateOrUpdate(ctx, "alertscorrelationrg", "RemoveActionGroupsSpecificAlertRule", armalertsmanagement.AlertProcessingRule{ Location: to.Ptr("Global"), Tags: map[string]*string{}, Properties: &armalertsmanagement.AlertProcessingRuleProperties{ Description: to.Ptr("Removes all ActionGroups from all Alerts that fire on above AlertRule"), Actions: []armalertsmanagement.ActionClassification{ &armalertsmanagement.RemoveAllActionGroups{ ActionType: to.Ptr(armalertsmanagement.ActionTypeRemoveAllActionGroups), }}, Conditions: []*armalertsmanagement.Condition{ { Field: to.Ptr(armalertsmanagement.FieldAlertRuleID), Operator: to.Ptr(armalertsmanagement.OperatorEquals), Values: []*string{ to.Ptr("/subscriptions/suubId1/resourceGroups/Rgid2/providers/microsoft.insights/activityLogAlerts/RuleName")}, }}, Enabled: to.Ptr(true), Scopes: []*string{ to.Ptr("/subscriptions/subId1")}, }, }, 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.AlertProcessingRule = armalertsmanagement.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"), // Tags: map[string]*string{ // }, // Properties: &armalertsmanagement.AlertProcessingRuleProperties{ // Description: to.Ptr("Removes all ActionGroups from all Alerts that fire on above AlertRule"), // Actions: []armalertsmanagement.ActionClassification{ // &armalertsmanagement.RemoveAllActionGroups{ // ActionType: to.Ptr(armalertsmanagement.ActionTypeRemoveAllActionGroups), // }}, // Conditions: []*armalertsmanagement.Condition{ // { // Field: to.Ptr(armalertsmanagement.FieldAlertRuleID), // Operator: to.Ptr(armalertsmanagement.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: &armalertsmanagement.SystemData{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T22:05:09.000Z"); return t}()), // CreatedBy: to.Ptr("abc@microsoft.com"), // CreatedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09.000Z"); return t}()), // LastModifiedBy: to.Ptr("xyz@microsoft.com"), // LastModifiedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // }, // } }
Output:
Example (CreateOrUpdateARuleThatRemovesAllActionGroupsFromAllAlertsOnAnyVmInTwoResourceGroupsDuringARecurringMaintenanceWindow22000400EverySatAndSunIndiaStandardTime) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2021-08-08/examples/AlertProcessingRules_Create_or_update_remove_all_action_groups_recurring_maintenance_window.json
package main import ( "context" "log" "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/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewAlertProcessingRulesClient().CreateOrUpdate(ctx, "alertscorrelationrg", "RemoveActionGroupsRecurringMaintenance", armalertsmanagement.AlertProcessingRule{ Location: to.Ptr("Global"), Tags: map[string]*string{}, Properties: &armalertsmanagement.AlertProcessingRuleProperties{ Description: to.Ptr("Remove all ActionGroups from all Vitual machine Alerts during the recurring maintenance"), Actions: []armalertsmanagement.ActionClassification{ &armalertsmanagement.RemoveAllActionGroups{ ActionType: to.Ptr(armalertsmanagement.ActionTypeRemoveAllActionGroups), }}, Conditions: []*armalertsmanagement.Condition{ { Field: to.Ptr(armalertsmanagement.FieldTargetResourceType), Operator: to.Ptr(armalertsmanagement.OperatorEquals), Values: []*string{ to.Ptr("microsoft.compute/virtualmachines")}, }}, Enabled: to.Ptr(true), Schedule: &armalertsmanagement.Schedule{ Recurrences: []armalertsmanagement.RecurrenceClassification{ &armalertsmanagement.WeeklyRecurrence{ EndTime: to.Ptr("04:00:00"), RecurrenceType: to.Ptr(armalertsmanagement.RecurrenceTypeWeekly), StartTime: to.Ptr("22:00:00"), DaysOfWeek: []*armalertsmanagement.DaysOfWeek{ to.Ptr(armalertsmanagement.DaysOfWeekSaturday), to.Ptr(armalertsmanagement.DaysOfWeekSunday)}, }}, TimeZone: to.Ptr("India Standard Time"), }, Scopes: []*string{ to.Ptr("/subscriptions/subId1/resourceGroups/RGId1"), to.Ptr("/subscriptions/subId1/resourceGroups/RGId2")}, }, }, 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.AlertProcessingRule = armalertsmanagement.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"), // Tags: map[string]*string{ // }, // Properties: &armalertsmanagement.AlertProcessingRuleProperties{ // Description: to.Ptr("Remove all ActionGroups from all Vitual machine Alerts during the recurring maintenance"), // Actions: []armalertsmanagement.ActionClassification{ // &armalertsmanagement.RemoveAllActionGroups{ // ActionType: to.Ptr(armalertsmanagement.ActionTypeRemoveAllActionGroups), // }}, // Conditions: []*armalertsmanagement.Condition{ // { // Field: to.Ptr(armalertsmanagement.FieldTargetResourceType), // Operator: to.Ptr(armalertsmanagement.OperatorEquals), // Values: []*string{ // to.Ptr("microsoft.compute/virtualmachines")}, // }}, // Enabled: to.Ptr(true), // Schedule: &armalertsmanagement.Schedule{ // Recurrences: []armalertsmanagement.RecurrenceClassification{ // &armalertsmanagement.WeeklyRecurrence{ // EndTime: to.Ptr("04:00:00"), // RecurrenceType: to.Ptr(armalertsmanagement.RecurrenceTypeWeekly), // StartTime: to.Ptr("22:00:00"), // DaysOfWeek: []*armalertsmanagement.DaysOfWeek{ // to.Ptr(armalertsmanagement.DaysOfWeekSaturday), // to.Ptr(armalertsmanagement.DaysOfWeekSunday)}, // }}, // TimeZone: to.Ptr("India Standard Time"), // }, // Scopes: []*string{ // to.Ptr("/subscriptions/subId1/resourceGroups/RGId1"), // to.Ptr("/subscriptions/subId1/resourceGroups/RGId2")}, // }, // SystemData: &armalertsmanagement.SystemData{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T22:05:09.000Z"); return t}()), // CreatedBy: to.Ptr("abc@microsoft.com"), // CreatedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09.000Z"); return t}()), // LastModifiedBy: to.Ptr("xyz@microsoft.com"), // LastModifiedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // }, // } }
Output:
Example (CreateOrUpdateARuleThatRemovesAllActionGroupsOutsideBusinessHoursMonFri09001700EasternStandardTime) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2021-08-08/examples/AlertProcessingRules_Create_or_update_remove_all_action_groups_outside_business_hours.json
package main import ( "context" "log" "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/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewAlertProcessingRulesClient().CreateOrUpdate(ctx, "alertscorrelationrg", "RemoveActionGroupsOutsideBusinessHours", armalertsmanagement.AlertProcessingRule{ Location: to.Ptr("Global"), Tags: map[string]*string{}, Properties: &armalertsmanagement.AlertProcessingRuleProperties{ Description: to.Ptr("Remove all ActionGroups outside business hours"), Actions: []armalertsmanagement.ActionClassification{ &armalertsmanagement.RemoveAllActionGroups{ ActionType: to.Ptr(armalertsmanagement.ActionTypeRemoveAllActionGroups), }}, Enabled: to.Ptr(true), Schedule: &armalertsmanagement.Schedule{ Recurrences: []armalertsmanagement.RecurrenceClassification{ &armalertsmanagement.DailyRecurrence{ EndTime: to.Ptr("09:00:00"), RecurrenceType: to.Ptr(armalertsmanagement.RecurrenceTypeDaily), StartTime: to.Ptr("17:00:00"), }, &armalertsmanagement.WeeklyRecurrence{ RecurrenceType: to.Ptr(armalertsmanagement.RecurrenceTypeWeekly), DaysOfWeek: []*armalertsmanagement.DaysOfWeek{ to.Ptr(armalertsmanagement.DaysOfWeekSaturday), to.Ptr(armalertsmanagement.DaysOfWeekSunday)}, }}, TimeZone: to.Ptr("Eastern Standard Time"), }, Scopes: []*string{ to.Ptr("/subscriptions/subId1")}, }, }, 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.AlertProcessingRule = armalertsmanagement.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"), // Tags: map[string]*string{ // }, // Properties: &armalertsmanagement.AlertProcessingRuleProperties{ // Description: to.Ptr("Remove all ActionGroups outside business hours"), // Actions: []armalertsmanagement.ActionClassification{ // &armalertsmanagement.RemoveAllActionGroups{ // ActionType: to.Ptr(armalertsmanagement.ActionTypeRemoveAllActionGroups), // }}, // Enabled: to.Ptr(true), // Schedule: &armalertsmanagement.Schedule{ // Recurrences: []armalertsmanagement.RecurrenceClassification{ // &armalertsmanagement.DailyRecurrence{ // EndTime: to.Ptr("09:00:00"), // RecurrenceType: to.Ptr(armalertsmanagement.RecurrenceTypeDaily), // StartTime: to.Ptr("17:00:00"), // }, // &armalertsmanagement.WeeklyRecurrence{ // RecurrenceType: to.Ptr(armalertsmanagement.RecurrenceTypeWeekly), // DaysOfWeek: []*armalertsmanagement.DaysOfWeek{ // to.Ptr(armalertsmanagement.DaysOfWeekSaturday), // to.Ptr(armalertsmanagement.DaysOfWeekSunday)}, // }}, // TimeZone: to.Ptr("Eastern Standard Time"), // }, // Scopes: []*string{ // to.Ptr("/subscriptions/subId1")}, // }, // SystemData: &armalertsmanagement.SystemData{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T22:05:09.000Z"); return t}()), // CreatedBy: to.Ptr("abc@microsoft.com"), // CreatedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09.000Z"); return t}()), // LastModifiedBy: to.Ptr("xyz@microsoft.com"), // LastModifiedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // }, // } }
Output:
func (*AlertProcessingRulesClient) Delete ¶ added in v0.3.0
func (client *AlertProcessingRulesClient) Delete(ctx context.Context, resourceGroupName string, alertProcessingRuleName string, options *AlertProcessingRulesClientDeleteOptions) (AlertProcessingRulesClientDeleteResponse, 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 - Resource group name where the resource is created.
- alertProcessingRuleName - The name of the alert processing rule that needs to be deleted.
- options - AlertProcessingRulesClientDeleteOptions contains the optional parameters for the AlertProcessingRulesClient.Delete method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2021-08-08/examples/AlertProcessingRules_Delete.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } _, err = clientFactory.NewAlertProcessingRulesClient().Delete(ctx, "alertscorrelationrg", "DailySuppression", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } }
Output:
func (*AlertProcessingRulesClient) GetByName ¶ added in v0.3.0
func (client *AlertProcessingRulesClient) GetByName(ctx context.Context, resourceGroupName string, alertProcessingRuleName string, options *AlertProcessingRulesClientGetByNameOptions) (AlertProcessingRulesClientGetByNameResponse, 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 - Resource group name where the resource is created.
- alertProcessingRuleName - The name of the alert processing rule that needs to be fetched.
- options - AlertProcessingRulesClientGetByNameOptions contains the optional parameters for the AlertProcessingRulesClient.GetByName method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2021-08-08/examples/AlertProcessingRules_GetById.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewAlertProcessingRulesClient().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.AlertProcessingRule = armalertsmanagement.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"), // Tags: map[string]*string{ // }, // Properties: &armalertsmanagement.AlertProcessingRuleProperties{ // Description: to.Ptr("Alert processing rule on resource group for daily and weekly scheduling"), // Actions: []armalertsmanagement.ActionClassification{ // &armalertsmanagement.AddActionGroups{ // ActionType: to.Ptr(armalertsmanagement.ActionTypeAddActionGroups), // ActionGroupIDs: []*string{ // to.Ptr("actiongGroup1"), // to.Ptr("actiongGroup2")}, // }}, // Conditions: []*armalertsmanagement.Condition{ // { // Field: to.Ptr(armalertsmanagement.FieldSeverity), // Operator: to.Ptr(armalertsmanagement.OperatorEquals), // Values: []*string{ // to.Ptr("Sev0"), // to.Ptr("Sev2")}, // }, // { // Field: to.Ptr(armalertsmanagement.FieldMonitorService), // Operator: to.Ptr(armalertsmanagement.OperatorEquals), // Values: []*string{ // to.Ptr("Platform"), // to.Ptr("Application Insights")}, // }, // { // Field: to.Ptr(armalertsmanagement.FieldMonitorCondition), // Operator: to.Ptr(armalertsmanagement.OperatorEquals), // Values: []*string{ // to.Ptr("Fired")}, // }, // { // Field: to.Ptr(armalertsmanagement.FieldTargetResourceType), // Operator: to.Ptr(armalertsmanagement.OperatorNotEquals), // Values: []*string{ // to.Ptr("Microsoft.Compute/VirtualMachines")}, // }}, // Enabled: to.Ptr(true), // Schedule: &armalertsmanagement.Schedule{ // EffectiveFrom: to.Ptr("2018-01-10T22:05:09"), // EffectiveUntil: to.Ptr("2018-12-10T22:05:09"), // Recurrences: []armalertsmanagement.RecurrenceClassification{ // &armalertsmanagement.DailyRecurrence{ // EndTime: to.Ptr("14:00:00"), // RecurrenceType: to.Ptr(armalertsmanagement.RecurrenceTypeDaily), // StartTime: to.Ptr("06:00:00"), // }, // &armalertsmanagement.WeeklyRecurrence{ // EndTime: to.Ptr("20:00:00"), // RecurrenceType: to.Ptr(armalertsmanagement.RecurrenceTypeWeekly), // StartTime: to.Ptr("10:00:00"), // DaysOfWeek: []*armalertsmanagement.DaysOfWeek{ // to.Ptr(armalertsmanagement.DaysOfWeekSaturday), // to.Ptr(armalertsmanagement.DaysOfWeekSunday)}, // }}, // TimeZone: to.Ptr("Pacific Standard Time"), // }, // Scopes: []*string{ // to.Ptr("/subscriptions/1e3ff1c0-771a-4119-a03b-be82a51e232d/resourceGroups/alertscorrelationrg")}, // }, // SystemData: &armalertsmanagement.SystemData{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09.000Z"); return t}()), // CreatedBy: to.Ptr("abc@microsoft.com"), // CreatedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09.000Z"); return t}()), // LastModifiedBy: to.Ptr("xyz@microsoft.com"), // LastModifiedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // }, // } }
Output:
func (*AlertProcessingRulesClient) NewListByResourceGroupPager ¶ added in v0.5.0
func (client *AlertProcessingRulesClient) NewListByResourceGroupPager(resourceGroupName string, options *AlertProcessingRulesClientListByResourceGroupOptions) *runtime.Pager[AlertProcessingRulesClientListByResourceGroupResponse]
NewListByResourceGroupPager - List all alert processing rules in a resource group.
Generated from API version 2021-08-08
- resourceGroupName - Resource group name where the resource is created.
- options - AlertProcessingRulesClientListByResourceGroupOptions contains the optional parameters for the AlertProcessingRulesClient.NewListByResourceGroupPager method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2021-08-08/examples/AlertProcessingRules_List_ResourceGroup.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewAlertProcessingRulesClient().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.AlertProcessingRulesList = armalertsmanagement.AlertProcessingRulesList{ // Value: []*armalertsmanagement.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"), // Tags: map[string]*string{ // }, // Properties: &armalertsmanagement.AlertProcessingRuleProperties{ // Description: to.Ptr("Alert processing rule on resource group for daily suppression"), // Actions: []armalertsmanagement.ActionClassification{ // &armalertsmanagement.RemoveAllActionGroups{ // ActionType: to.Ptr(armalertsmanagement.ActionTypeRemoveAllActionGroups), // }}, // Conditions: []*armalertsmanagement.Condition{ // { // Field: to.Ptr(armalertsmanagement.FieldSeverity), // Operator: to.Ptr(armalertsmanagement.OperatorEquals), // Values: []*string{ // to.Ptr("Sev0"), // to.Ptr("Sev2")}, // }, // { // Field: to.Ptr(armalertsmanagement.FieldMonitorService), // Operator: to.Ptr(armalertsmanagement.OperatorEquals), // Values: []*string{ // to.Ptr("Platform"), // to.Ptr("Application Insights")}, // }, // { // Field: to.Ptr(armalertsmanagement.FieldTargetResourceType), // Operator: to.Ptr(armalertsmanagement.OperatorNotEquals), // Values: []*string{ // to.Ptr("Microsoft.Compute/VirtualMachines")}, // }}, // Enabled: to.Ptr(true), // Schedule: &armalertsmanagement.Schedule{ // EffectiveFrom: to.Ptr("2018-09-12T06:00:00"), // EffectiveUntil: to.Ptr("2018-09-20T14:00:00"), // Recurrences: []armalertsmanagement.RecurrenceClassification{ // &armalertsmanagement.DailyRecurrence{ // EndTime: to.Ptr("14:00:00"), // RecurrenceType: to.Ptr(armalertsmanagement.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: &armalertsmanagement.SystemData{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09.000Z"); return t}()), // CreatedBy: to.Ptr("abc@microsoft.com"), // CreatedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09.000Z"); return t}()), // LastModifiedBy: to.Ptr("xyz@microsoft.com"), // LastModifiedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // }, // }, // { // 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"), // Tags: map[string]*string{ // }, // Properties: &armalertsmanagement.AlertProcessingRuleProperties{ // Description: to.Ptr("Alert processing rule on resource group for sending email"), // Actions: []armalertsmanagement.ActionClassification{ // &armalertsmanagement.AddActionGroups{ // ActionType: to.Ptr(armalertsmanagement.ActionTypeAddActionGroups), // ActionGroupIDs: []*string{ // to.Ptr("/subscriptions/1e3ff1c0-771a-4119-a03b-be82a51e232d/resourceGroups/alertscorrelationrg/providers/Microsoft.insights/actiongroups/testAG")}, // }}, // Conditions: []*armalertsmanagement.Condition{ // { // Field: to.Ptr(armalertsmanagement.FieldMonitorCondition), // Operator: to.Ptr(armalertsmanagement.OperatorEquals), // Values: []*string{ // to.Ptr("Fired")}, // }, // { // Field: to.Ptr(armalertsmanagement.FieldDescription), // Operator: to.Ptr(armalertsmanagement.OperatorContains), // Values: []*string{ // to.Ptr("Percentage CPU greater than 80%"), // to.Ptr("Metric alert on resource foo")}, // }, // { // Field: to.Ptr(armalertsmanagement.FieldAlertContext), // Operator: to.Ptr(armalertsmanagement.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: &armalertsmanagement.SystemData{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09.000Z"); return t}()), // CreatedBy: to.Ptr("abc@microsoft.com"), // CreatedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09.000Z"); return t}()), // LastModifiedBy: to.Ptr("xyz@microsoft.com"), // LastModifiedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // }, // }}, // } } }
Output:
func (*AlertProcessingRulesClient) NewListBySubscriptionPager ¶ added in v0.5.0
func (client *AlertProcessingRulesClient) NewListBySubscriptionPager(options *AlertProcessingRulesClientListBySubscriptionOptions) *runtime.Pager[AlertProcessingRulesClientListBySubscriptionResponse]
NewListBySubscriptionPager - List all alert processing rules in a subscription.
Generated from API version 2021-08-08
- options - AlertProcessingRulesClientListBySubscriptionOptions contains the optional parameters for the AlertProcessingRulesClient.NewListBySubscriptionPager method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2021-08-08/examples/AlertProcessingRules_List_Subscription.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewAlertProcessingRulesClient().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.AlertProcessingRulesList = armalertsmanagement.AlertProcessingRulesList{ // Value: []*armalertsmanagement.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"), // Tags: map[string]*string{ // }, // Properties: &armalertsmanagement.AlertProcessingRuleProperties{ // Description: to.Ptr("Alert processing rule on resource group for daily suppression"), // Actions: []armalertsmanagement.ActionClassification{ // &armalertsmanagement.RemoveAllActionGroups{ // ActionType: to.Ptr(armalertsmanagement.ActionTypeRemoveAllActionGroups), // }}, // Conditions: []*armalertsmanagement.Condition{ // { // Field: to.Ptr(armalertsmanagement.FieldSeverity), // Operator: to.Ptr(armalertsmanagement.OperatorEquals), // Values: []*string{ // to.Ptr("Sev0"), // to.Ptr("Sev2")}, // }, // { // Field: to.Ptr(armalertsmanagement.FieldMonitorService), // Operator: to.Ptr(armalertsmanagement.OperatorEquals), // Values: []*string{ // to.Ptr("Platform"), // to.Ptr("Application Insights")}, // }, // { // Field: to.Ptr(armalertsmanagement.FieldTargetResourceType), // Operator: to.Ptr(armalertsmanagement.OperatorNotEquals), // Values: []*string{ // to.Ptr("Microsoft.Compute/VirtualMachines")}, // }}, // Enabled: to.Ptr(true), // Schedule: &armalertsmanagement.Schedule{ // EffectiveFrom: to.Ptr("2018-01-10T22:05:09"), // EffectiveUntil: to.Ptr("2018-12-10T22:05:09"), // Recurrences: []armalertsmanagement.RecurrenceClassification{ // &armalertsmanagement.DailyRecurrence{ // EndTime: to.Ptr("14:00:00"), // RecurrenceType: to.Ptr(armalertsmanagement.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: &armalertsmanagement.SystemData{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09.000Z"); return t}()), // CreatedBy: to.Ptr("abc@microsoft.com"), // CreatedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09.000Z"); return t}()), // LastModifiedBy: to.Ptr("xyz@microsoft.com"), // LastModifiedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // }, // }, // { // 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"), // Tags: map[string]*string{ // }, // Properties: &armalertsmanagement.AlertProcessingRuleProperties{ // Description: to.Ptr("Alert processing rule on resource group for adding action group"), // Actions: []armalertsmanagement.ActionClassification{ // &armalertsmanagement.AddActionGroups{ // ActionType: to.Ptr(armalertsmanagement.ActionTypeAddActionGroups), // ActionGroupIDs: []*string{ // to.Ptr("actiongGroup1")}, // }}, // Conditions: []*armalertsmanagement.Condition{ // { // Field: to.Ptr(armalertsmanagement.FieldMonitorCondition), // Operator: to.Ptr(armalertsmanagement.OperatorEquals), // Values: []*string{ // to.Ptr("Fired")}, // }, // { // Field: to.Ptr(armalertsmanagement.FieldDescription), // Operator: to.Ptr(armalertsmanagement.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: &armalertsmanagement.SystemData{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09.000Z"); return t}()), // CreatedBy: to.Ptr("abc@microsoft.com"), // CreatedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09.000Z"); return t}()), // LastModifiedBy: to.Ptr("xyz@microsoft.com"), // LastModifiedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // }, // }}, // } } }
Output:
func (*AlertProcessingRulesClient) Update ¶ added in v0.3.0
func (client *AlertProcessingRulesClient) Update(ctx context.Context, resourceGroupName string, alertProcessingRuleName string, alertProcessingRulePatch PatchObject, options *AlertProcessingRulesClientUpdateOptions) (AlertProcessingRulesClientUpdateResponse, 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 - Resource group name where the resource is created.
- alertProcessingRuleName - The name that needs to be updated.
- alertProcessingRulePatch - Parameters supplied to the operation.
- options - AlertProcessingRulesClientUpdateOptions contains the optional parameters for the AlertProcessingRulesClient.Update method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2021-08-08/examples/AlertProcessingRules_Patch.json
package main import ( "context" "log" "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/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewAlertProcessingRulesClient().Update(ctx, "alertscorrelationrg", "WeeklySuppression", armalertsmanagement.PatchObject{ Properties: &armalertsmanagement.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.AlertProcessingRule = armalertsmanagement.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"), // Tags: map[string]*string{ // "key1": to.Ptr("value1"), // "key2": to.Ptr("value2"), // }, // Properties: &armalertsmanagement.AlertProcessingRuleProperties{ // Description: to.Ptr("Alert processing rule on resource group for weekly suppression"), // Actions: []armalertsmanagement.ActionClassification{ // &armalertsmanagement.RemoveAllActionGroups{ // ActionType: to.Ptr(armalertsmanagement.ActionTypeRemoveAllActionGroups), // }}, // Conditions: []*armalertsmanagement.Condition{ // { // Field: to.Ptr(armalertsmanagement.FieldSeverity), // Operator: to.Ptr(armalertsmanagement.OperatorEquals), // Values: []*string{ // to.Ptr("Sev0"), // to.Ptr("Sev2")}, // }, // { // Field: to.Ptr(armalertsmanagement.FieldMonitorService), // Operator: to.Ptr(armalertsmanagement.OperatorEquals), // Values: []*string{ // to.Ptr("Platform"), // to.Ptr("Application Insights")}, // }, // { // Field: to.Ptr(armalertsmanagement.FieldTargetResourceType), // Operator: to.Ptr(armalertsmanagement.OperatorNotEquals), // Values: []*string{ // to.Ptr("Microsoft.Compute/VirtualMachines")}, // }}, // Enabled: to.Ptr(false), // Schedule: &armalertsmanagement.Schedule{ // EffectiveFrom: to.Ptr("2018-12-10T22:05:09"), // EffectiveUntil: to.Ptr("2018-12-05T22:05:09"), // Recurrences: []armalertsmanagement.RecurrenceClassification{ // &armalertsmanagement.WeeklyRecurrence{ // EndTime: to.Ptr("14:00:00"), // RecurrenceType: to.Ptr(armalertsmanagement.RecurrenceTypeWeekly), // StartTime: to.Ptr("06:00:00"), // DaysOfWeek: []*armalertsmanagement.DaysOfWeek{ // to.Ptr(armalertsmanagement.DaysOfWeekTuesday), // to.Ptr(armalertsmanagement.DaysOfWeekFriday)}, // }}, // TimeZone: to.Ptr("Pacific Standard Time"), // }, // Scopes: []*string{ // to.Ptr("/subscriptions/1e3ff1c0-771a-4119-a03b-be82a51e232d/resourceGroups/alertscorrelationrg")}, // }, // SystemData: &armalertsmanagement.SystemData{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09.000Z"); return t}()), // CreatedBy: to.Ptr("abc@microsoft.com"), // CreatedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09.000Z"); return t}()), // LastModifiedBy: to.Ptr("xyz@microsoft.com"), // LastModifiedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // }, // } }
Output:
type AlertProcessingRulesClientCreateOrUpdateOptions ¶ added in v0.3.0
type AlertProcessingRulesClientCreateOrUpdateOptions struct { }
AlertProcessingRulesClientCreateOrUpdateOptions contains the optional parameters for the AlertProcessingRulesClient.CreateOrUpdate method.
type AlertProcessingRulesClientCreateOrUpdateResponse ¶ added in v0.3.0
type AlertProcessingRulesClientCreateOrUpdateResponse struct { // Alert processing rule object containing target scopes, conditions and scheduling logic. AlertProcessingRule // XMSRequestID contains the information returned from the x-ms-request-id header response. XMSRequestID *string }
AlertProcessingRulesClientCreateOrUpdateResponse contains the response from method AlertProcessingRulesClient.CreateOrUpdate.
type AlertProcessingRulesClientDeleteOptions ¶ added in v0.3.0
type AlertProcessingRulesClientDeleteOptions struct { }
AlertProcessingRulesClientDeleteOptions contains the optional parameters for the AlertProcessingRulesClient.Delete method.
type AlertProcessingRulesClientDeleteResponse ¶ added in v0.3.0
type AlertProcessingRulesClientDeleteResponse struct { // XMSRequestID contains the information returned from the x-ms-request-id header response. XMSRequestID *string }
AlertProcessingRulesClientDeleteResponse contains the response from method AlertProcessingRulesClient.Delete.
type AlertProcessingRulesClientGetByNameOptions ¶ added in v0.3.0
type AlertProcessingRulesClientGetByNameOptions struct { }
AlertProcessingRulesClientGetByNameOptions contains the optional parameters for the AlertProcessingRulesClient.GetByName method.
type AlertProcessingRulesClientGetByNameResponse ¶ added in v0.3.0
type AlertProcessingRulesClientGetByNameResponse struct { // Alert processing rule object containing target scopes, conditions and scheduling logic. AlertProcessingRule // XMSRequestID contains the information returned from the x-ms-request-id header response. XMSRequestID *string }
AlertProcessingRulesClientGetByNameResponse contains the response from method AlertProcessingRulesClient.GetByName.
type AlertProcessingRulesClientListByResourceGroupOptions ¶ added in v0.3.0
type AlertProcessingRulesClientListByResourceGroupOptions struct { }
AlertProcessingRulesClientListByResourceGroupOptions contains the optional parameters for the AlertProcessingRulesClient.NewListByResourceGroupPager method.
type AlertProcessingRulesClientListByResourceGroupResponse ¶ added in v0.3.0
type AlertProcessingRulesClientListByResourceGroupResponse struct { // List of alert processing rules. AlertProcessingRulesList // XMSRequestID contains the information returned from the x-ms-request-id header response. XMSRequestID *string }
AlertProcessingRulesClientListByResourceGroupResponse contains the response from method AlertProcessingRulesClient.NewListByResourceGroupPager.
type AlertProcessingRulesClientListBySubscriptionOptions ¶ added in v0.3.0
type AlertProcessingRulesClientListBySubscriptionOptions struct { }
AlertProcessingRulesClientListBySubscriptionOptions contains the optional parameters for the AlertProcessingRulesClient.NewListBySubscriptionPager method.
type AlertProcessingRulesClientListBySubscriptionResponse ¶ added in v0.3.0
type AlertProcessingRulesClientListBySubscriptionResponse struct { // List of alert processing rules. AlertProcessingRulesList // XMSRequestID contains the information returned from the x-ms-request-id header response. XMSRequestID *string }
AlertProcessingRulesClientListBySubscriptionResponse contains the response from method AlertProcessingRulesClient.NewListBySubscriptionPager.
type AlertProcessingRulesClientUpdateOptions ¶ added in v0.3.0
type AlertProcessingRulesClientUpdateOptions struct { }
AlertProcessingRulesClientUpdateOptions contains the optional parameters for the AlertProcessingRulesClient.Update method.
type AlertProcessingRulesClientUpdateResponse ¶ added in v0.3.0
type AlertProcessingRulesClientUpdateResponse struct { // Alert processing rule object containing target scopes, conditions and scheduling logic. AlertProcessingRule // XMSRequestID contains the information returned from the x-ms-request-id header response. XMSRequestID *string }
AlertProcessingRulesClientUpdateResponse contains the response from method AlertProcessingRulesClient.Update.
type AlertProcessingRulesList ¶ added in v0.3.0
type AlertProcessingRulesList struct { // URL to fetch the next set of alert processing rules. NextLink *string // List of alert processing rules. Value []*AlertProcessingRule }
AlertProcessingRulesList - List of alert processing rules.
func (AlertProcessingRulesList) MarshalJSON ¶ added in v0.3.0
func (a AlertProcessingRulesList) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AlertProcessingRulesList.
func (*AlertProcessingRulesList) UnmarshalJSON ¶ added in v0.7.0
func (a *AlertProcessingRulesList) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AlertProcessingRulesList.
type AlertProperties ¶
type AlertProperties struct { // This object contains consistent fields across different monitor services. Essentials *Essentials // READ-ONLY; Information specific to the monitor service that gives more contextual details about the alert. Context any // READ-ONLY; Config which would be used for displaying the data in portal. EgressConfig any }
AlertProperties - Alert property bag
func (AlertProperties) MarshalJSON ¶ added in v0.7.0
func (a AlertProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AlertProperties.
func (*AlertProperties) UnmarshalJSON ¶ added in v0.7.0
func (a *AlertProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AlertProperties.
type AlertRuleAllOfCondition ¶ added in v0.10.0
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 ¶ added in v0.10.0
func (a AlertRuleAllOfCondition) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AlertRuleAllOfCondition.
func (*AlertRuleAllOfCondition) UnmarshalJSON ¶ added in v0.10.0
func (a *AlertRuleAllOfCondition) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleAllOfCondition.
type AlertRuleAnyOfOrLeafCondition ¶ added in v0.10.0
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 ¶ added in v0.10.0
func (a AlertRuleAnyOfOrLeafCondition) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AlertRuleAnyOfOrLeafCondition.
func (*AlertRuleAnyOfOrLeafCondition) UnmarshalJSON ¶ added in v0.10.0
func (a *AlertRuleAnyOfOrLeafCondition) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleAnyOfOrLeafCondition.
type AlertRuleLeafCondition ¶ added in v0.10.0
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 ¶ added in v0.10.0
func (a AlertRuleLeafCondition) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AlertRuleLeafCondition.
func (*AlertRuleLeafCondition) UnmarshalJSON ¶ added in v0.10.0
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 ¶ added in v0.10.0
func (a *AlertRuleProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleProperties.
type AlertRuleRecommendationProperties ¶ added in v0.10.0
type AlertRuleRecommendationProperties struct { // REQUIRED; The recommendation alert rule type. AlertRuleType *string // REQUIRED; A dictionary that provides the display information for an alert rule recommendation. DisplayInformation map[string]*string // REQUIRED; A complete ARM template to deploy the alert rules. RuleArmTemplate *RuleArmTemplate }
AlertRuleRecommendationProperties - Describes the format of Alert Rule Recommendations response.
func (AlertRuleRecommendationProperties) MarshalJSON ¶ added in v0.10.0
func (a AlertRuleRecommendationProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AlertRuleRecommendationProperties.
func (*AlertRuleRecommendationProperties) UnmarshalJSON ¶ added in v0.10.0
func (a *AlertRuleRecommendationProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleRecommendationProperties.
type AlertRuleRecommendationResource ¶ added in v0.10.0
type AlertRuleRecommendationResource struct { // REQUIRED; recommendation properties. Properties *AlertRuleRecommendationProperties // 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 }
AlertRuleRecommendationResource - A single alert rule recommendation resource.
func (AlertRuleRecommendationResource) MarshalJSON ¶ added in v0.10.0
func (a AlertRuleRecommendationResource) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AlertRuleRecommendationResource.
func (*AlertRuleRecommendationResource) UnmarshalJSON ¶ added in v0.10.0
func (a *AlertRuleRecommendationResource) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleRecommendationResource.
type AlertRuleRecommendationsClient ¶ added in v0.10.0
type AlertRuleRecommendationsClient struct {
// contains filtered or unexported fields
}
AlertRuleRecommendationsClient contains the methods for the AlertRuleRecommendations group. Don't use this type directly, use NewAlertRuleRecommendationsClient() instead.
func NewAlertRuleRecommendationsClient ¶ added in v0.10.0
func NewAlertRuleRecommendationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertRuleRecommendationsClient, error)
NewAlertRuleRecommendationsClient creates a new instance of AlertRuleRecommendationsClient with the specified values.
- subscriptionID - The ID of the target subscription.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*AlertRuleRecommendationsClient) NewListByResourcePager ¶ added in v0.10.0
func (client *AlertRuleRecommendationsClient) NewListByResourcePager(resourceURI string, options *AlertRuleRecommendationsClientListByResourceOptions) *runtime.Pager[AlertRuleRecommendationsClientListByResourceResponse]
NewListByResourcePager - Retrieve alert rule recommendations for a resource.
Generated from API version 2023-01-01-preview
- resourceURI - The identifier of the resource.
- options - AlertRuleRecommendationsClientListByResourceOptions contains the optional parameters for the AlertRuleRecommendationsClient.NewListByResourcePager method.
Example (ListAlertRuleRecommendationsForMonitoringAccountsAtResourceLevel) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2023-01-01-preview/examples/AlertRuleRecommendations_GetByResource_MAC.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewAlertRuleRecommendationsClient().NewListByResourcePager("subscriptions/2f00cc51-6809-498f-9ffc-48c42aff570d/resourceGroups/GenevaAlertRP-RunnerResources-eastus/providers/microsoft.monitor/accounts/alertsrp-eastus-pgms", 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.AlertRuleRecommendationsListResponse = armalertsmanagement.AlertRuleRecommendationsListResponse{ // Value: []*armalertsmanagement.AlertRuleRecommendationResource{ // { // Name: to.Ptr("NodeRecordingRulesRuleGroup"), // Type: to.Ptr("Microsoft.AlertsManagement/alertRuleRecommendations"), // ID: to.Ptr("/subscriptions/2f00cc51-6809-498f-9ffc-48c42aff570d/resourceGroups/GenevaAlertRP-RunnerResources-eastus/providers/microsoft.monitor/accounts/alertsrp-eastus-pgms/providers/Microsoft.AlertsManagement/alertRuleRecommendations/NodeRecordingRulesRuleGroup"), // Properties: &armalertsmanagement.AlertRuleRecommendationProperties{ // AlertRuleType: to.Ptr("Microsoft.AlertsManagement/prometheusRuleGroups"), // DisplayInformation: map[string]*string{ // "ruleInfo": to.Ptr("Rule Information for first recording rule."), // }, // RuleArmTemplate: &armalertsmanagement.RuleArmTemplate{ // Schema: to.Ptr("https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#"), // ContentVersion: to.Ptr("1.0.0.0"), // Parameters: map[string]any{ // "actionGroupIds":map[string]any{ // "type": "array", // "defaultValue":[]any{ // }, // "metadata":map[string]any{ // "description": "Insert Action groups ids to attach them to the below alert rules.", // }, // }, // "alertName":map[string]any{ // "type": "string", // "defaultValue": "[concat('parameters('alertNamePrefix'), ' - ', parameters('clusterNameForPrometheus'))]", // "metadata":map[string]any{ // "description": "Name of the alert rule", // }, // "minLength": float64(1), // }, // "alertNamePrefix":map[string]any{ // "type": "string", // "defaultValue": "NodeRecordingRulesRuleGroup", // "metadata":map[string]any{ // "description": "prefix of the alert rule name", // }, // "minLength": float64(1), // }, // "clusterNameForPrometheus":map[string]any{ // "type": "string", // }, // "location":map[string]any{ // "type": "string", // "defaultValue": "eastus", // }, // "targetResourceId":map[string]any{ // "type": "string", // "defaultValue": "/subscriptions/2f00cc51-6809-498f-9ffc-48c42aff570d/resourceGroups/GenevaAlertRP-RunnerResources-eastus/providers/microsoft.monitor/accounts/alertsrp-eastus-pgms", // }, // "targetResourceName":map[string]any{ // "type": "string", // "defaultValue": "alertsrp-eastus-pgms", // }, // }, // Resources: []any{ // map[string]any{ // "name": "[parameters('alertName')]", // "type": "Microsoft.AlertsManagement/prometheusRuleGroups", // "apiVersion": "2021-07-22-preview", // "location": "[parameters('location')]", // "properties":map[string]any{ // "description": "Node Recording Rules RuleGroup", // "clusterName": "[parameters('clusterNameForPrometheus')]", // "interval": "PT1M", // "rules":[]any{ // map[string]any{ // "expression": "count without (cpu, mode) ( node_cpu_seconds_total{job=\"node\",mode=\"idle\"})", // "record": "instance:node_num_cpu:sum", // }, // }, // "scopes": "[variables('scopes')]", // }, // }}, // Variables: map[string]any{ // "copy":[]any{ // map[string]any{ // "name": "actionsForPrometheusRuleGroups", // "count": "[length(parameters('actionGroupIds'))]", // "input":map[string]any{ // "actiongroupId": "[parameters('actionGroupIds')[copyIndex('actionsForPrometheusRuleGroups')]]", // }, // }, // }, // "scopes": "[array(parameters('targetResourceId'))]", // }, // }, // }, // }, // { // Name: to.Ptr("KubernetesReccordingRulesRuleGroup"), // Type: to.Ptr("Microsoft.AlertsManagement/alertRuleRecommendations"), // ID: to.Ptr("/subscriptions/2f00cc51-6809-498f-9ffc-48c42aff570d/resourceGroups/GenevaAlertRP-RunnerResources-eastus/providers/microsoft.monitor/accounts/alertsrp-eastus-pgms/providers/Microsoft.AlertsManagement/alertRuleRecommendations/KubernetesReccordingRulesRuleGroup"), // Properties: &armalertsmanagement.AlertRuleRecommendationProperties{ // AlertRuleType: to.Ptr("Microsoft.AlertsManagement/prometheusRuleGroups"), // DisplayInformation: map[string]*string{ // "ruleInfo": to.Ptr("Rule Information for second recording rule."), // }, // RuleArmTemplate: &armalertsmanagement.RuleArmTemplate{ // Schema: to.Ptr("https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#"), // ContentVersion: to.Ptr("1.0.0.0"), // Parameters: map[string]any{ // "actionGroupIds":map[string]any{ // "type": "array", // "defaultValue":[]any{ // }, // "metadata":map[string]any{ // "description": "Insert Action groups ids to attach them to the below alert rules.", // }, // }, // "alertName":map[string]any{ // "type": "string", // "defaultValue": "[concat('parameters('alertNamePrefix'), ' - ', parameters('clusterNameForPrometheus'))]", // "metadata":map[string]any{ // "description": "Name of the alert rule", // }, // "minLength": float64(1), // }, // "alertNamePrefix":map[string]any{ // "type": "string", // "defaultValue": "KubernetesReccordingRulesRuleGroup", // "metadata":map[string]any{ // "description": "prefix of the alert rule name", // }, // "minLength": float64(1), // }, // "clusterNameForPrometheus":map[string]any{ // "type": "string", // }, // "location":map[string]any{ // "type": "string", // "defaultValue": "eastus", // }, // "targetResourceId":map[string]any{ // "type": "string", // "defaultValue": "/subscriptions/2f00cc51-6809-498f-9ffc-48c42aff570d/resourceGroups/GenevaAlertRP-RunnerResources-eastus/providers/microsoft.monitor/accounts/alertsrp-eastus-pgms", // }, // "targetResourceName":map[string]any{ // "type": "string", // "defaultValue": "alertsrp-eastus-pgms", // }, // }, // Resources: []any{ // map[string]any{ // "name": "[parameters('alertName')]", // "type": "Microsoft.AlertsManagement/prometheusRuleGroups", // "apiVersion": "2021-07-22-preview", // "location": "[parameters('location')]", // "properties":map[string]any{ // "description": "Kubernetes Recording Rules RuleGroup", // "clusterName": "[parameters('clusterNameForPrometheus')]", // "interval": "PT1M", // "rules":[]any{ // map[string]any{ // "expression": "sum by (cluster, namespace, pod, container) ( irate(container_cpu_usage_seconds_total{job=\"cadvisor\", image!=\"\"}[5m])) * on (cluster, namespace, pod) group_left(node) topk by (cluster, namespace, pod) ( 1, max by(cluster, namespace, pod, node) (kube_pod_info{node!=\"\"}))", // "record": "node_namespace_pod_container:container_cpu_usage_seconds_total:sum_irate", // }, // }, // "scopes": "[variables('scopes')]", // }, // }}, // Variables: map[string]any{ // "copy":[]any{ // map[string]any{ // "name": "actionsForPrometheusRuleGroups", // "count": "[length(parameters('actionGroupIds'))]", // "input":map[string]any{ // "actiongroupId": "[parameters('actionGroupIds')[copyIndex('actionsForPrometheusRuleGroups')]]", // }, // }, // }, // "scopes": "[array(parameters('targetResourceId'))]", // }, // }, // }, // }, // { // Name: to.Ptr("KubernetesAlert-DefaultAlert"), // Type: to.Ptr("Microsoft.AlertsManagement/alertRuleRecommendations"), // ID: to.Ptr("/subscriptions/2f00cc51-6809-498f-9ffc-48c42aff570d/resourceGroups/GenevaAlertRP-RunnerResources-eastus/providers/microsoft.monitor/accounts/alertsrp-eastus-pgms/providers/Microsoft.AlertsManagement/alertRuleRecommendations/KubernetesAlert-DefaultAlert"), // Properties: &armalertsmanagement.AlertRuleRecommendationProperties{ // AlertRuleType: to.Ptr("Microsoft.AlertsManagement/prometheusRuleGroups"), // DisplayInformation: map[string]*string{ // "ruleInfo": to.Ptr("Rule Information for alerting rule."), // }, // RuleArmTemplate: &armalertsmanagement.RuleArmTemplate{ // Schema: to.Ptr("https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#"), // ContentVersion: to.Ptr("1.0.0.0"), // Parameters: map[string]any{ // "actionGroupIds":map[string]any{ // "type": "array", // "defaultValue":[]any{ // }, // "metadata":map[string]any{ // "description": "Insert Action groups ids to attach them to the below alert rules.", // }, // }, // "alertName":map[string]any{ // "type": "string", // "defaultValue": "[concat('parameters('alertNamePrefix'), ' - ', parameters('clusterNameForPrometheus'))]", // "metadata":map[string]any{ // "description": "Name of the alert rule", // }, // "minLength": float64(1), // }, // "alertNamePrefix":map[string]any{ // "type": "string", // "defaultValue": "KubernetesAlert-DefaultAlerts", // "metadata":map[string]any{ // "description": "prefix of the alert rule name", // }, // "minLength": float64(1), // }, // "clusterNameForPrometheus":map[string]any{ // "type": "string", // }, // "location":map[string]any{ // "type": "string", // "defaultValue": "eastus", // }, // "targetResourceId":map[string]any{ // "type": "string", // "defaultValue": "/subscriptions/2f00cc51-6809-498f-9ffc-48c42aff570d/resourceGroups/GenevaAlertRP-RunnerResources-eastus/providers/microsoft.monitor/accounts/alertsrp-eastus-pgms", // }, // "targetResourceName":map[string]any{ // "type": "string", // "defaultValue": "alertsrp-eastus-pgms", // }, // }, // Resources: []any{ // map[string]any{ // "name": "[parameters('alertName')]", // "type": "Microsoft.AlertsManagement/prometheusRuleGroups", // "apiVersion": "2021-07-22-preview", // "location": "[parameters('location')]", // "properties":map[string]any{ // "description": "Kubernetes Alert RuleGroup-DefaultAlerts", // "clusterName": "[parameters('clusterNameForPrometheus')]", // "interval": "PT1M", // "rules":[]any{ // map[string]any{ // "Severity": float64(3), // "actions": "[variables('actionsForPrometheusRuleGroups')]", // "alert": "KubePodCrashLooping", // "expression": "max_over_time(kube_pod_container_status_waiting_reason{reason=\"CrashLoopBackOff\", job=\"kube-state-metrics\"}[5m]) >= 1", // "for": "PT15M", // "labels":map[string]any{ // "severity": "warning", // }, // }, // map[string]any{ // "Severity": float64(3), // "actions": "[variables('actionsForPrometheusRuleGroups')]", // "alert": "KubePodNotReady", // "expression": "sum by (namespace, pod, cluster) ( max by(namespace, pod, cluster) ( kube_pod_status_phase{job=\"kube-state-metrics\", phase=~\"Pending|Unknown\"} ) * on(namespace, pod, cluster) group_left(owner_kind) topk by(namespace, pod, cluster) ( 1, max by(namespace, pod, owner_kind, cluster) (kube_pod_owner{owner_kind!=\"Job\"}) )) > 0", // "for": "PT15M", // "labels":map[string]any{ // "severity": "warning", // }, // }, // }, // "scopes": "[variables('scopes')]", // }, // }}, // Variables: map[string]any{ // "copy":[]any{ // map[string]any{ // "name": "actionsForPrometheusRuleGroups", // "count": "[length(parameters('actionGroupIds'))]", // "input":map[string]any{ // "actiongroupId": "[parameters('actionGroupIds')[copyIndex('actionsForPrometheusRuleGroups')]]", // }, // }, // }, // "scopes": "[array(parameters('targetResourceId'))]", // }, // }, // }, // }}, // } } }
Output:
Example (ListAlertRuleRecommendationsForVirtualMachinesAtResourceLevel) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2023-01-01-preview/examples/AlertRuleRecommendations_GetByResource_VM.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewAlertRuleRecommendationsClient().NewListByResourcePager("subscriptions/2f00cc51-6809-498f-9ffc-48c42aff570d/resourcegroups/test/providers/Microsoft.Compute/virtualMachines/testMachineCanBeSafelyDeleted", 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.AlertRuleRecommendationsListResponse = armalertsmanagement.AlertRuleRecommendationsListResponse{ // Value: []*armalertsmanagement.AlertRuleRecommendationResource{ // { // Name: to.Ptr("Percentage CPU"), // Type: to.Ptr("Microsoft.AlertsManagement/alertRuleRecommendations"), // ID: to.Ptr("/subscriptions/2f00cc51-6809-498f-9ffc-48c42aff570d/resourcegroups/test/providers/Microsoft.Compute/virtualMachines/testMachineCanBeSafelyDeleted/providers/Microsoft.AlertsManagement/alertRuleRecommendations/Percentage CPU"), // Properties: &armalertsmanagement.AlertRuleRecommendationProperties{ // AlertRuleType: to.Ptr("Microsoft.Insights/metricAlerts"), // DisplayInformation: map[string]*string{ // "displayUnits": to.Ptr("Percentage"), // "infoBallonLink": to.Ptr("Rule1 InfoBalloon Link"), // "infoBallonMessage": to.Ptr("Rule1 InfoBalloon Message"), // "metricDisplayName": to.Ptr("Percentage CPU"), // }, // RuleArmTemplate: &armalertsmanagement.RuleArmTemplate{ // Schema: to.Ptr("https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#"), // ContentVersion: to.Ptr("1.0.0.0"), // Parameters: map[string]any{ // "actionGroupIds":map[string]any{ // "type": "array", // "defaultValue":[]any{ // }, // "metadata":map[string]any{ // "description": "Insert Action groups ids to attach them to the below alert rules.", // }, // }, // "alertName":map[string]any{ // "type": "string", // "defaultValue": "[concat('parameters('alertNamePrefix'), ' - ', parameters('targetResourceName'))]", // "metadata":map[string]any{ // "description": "Name of the alert rule", // }, // "minLength": float64(1), // }, // "alertNamePrefix":map[string]any{ // "type": "string", // "defaultValue": "Percentage CPU", // "metadata":map[string]any{ // "description": "prefix of the alert rule name", // }, // "minLength": float64(1), // }, // "alertSeverity":map[string]any{ // "type": "int", // "allowedValues":[]any{ // float64(0), // float64(1), // float64(2), // float64(3), // float64(4), // }, // "defaultValue": float64(3), // "metadata":map[string]any{ // "description": "Severity of alert {0,1,2,3,4}", // }, // }, // "targetResourceId":map[string]any{ // "type": "string", // "defaultValue": "/subscriptions/2f00cc51-6809-498f-9ffc-48c42aff570d/resourcegroups/test/providers/Microsoft.Compute/virtualMachines/testMachineCanBeSafelyDeleted", // }, // "targetResourceName":map[string]any{ // "type": "string", // "defaultValue": "testmachinecanbesafelydeleted", // }, // "threshold":map[string]any{ // "type": "int", // "defaultValue": float64(80), // "metadata":map[string]any{ // "description": "The threshold value at which the alert is activated.", // }, // }, // }, // Resources: []any{ // map[string]any{ // "name": "[parameters('alertName')]", // "type": "Microsoft.Insights/metricAlerts", // "apiVersion": "2018-03-01", // "location": "global", // "properties":map[string]any{ // "description": "Percentage CPU is greater than 80 %", // "actions": "[variables('actionsForMetricAlerts')]", // "criteria":map[string]any{ // "allOf":[]any{ // map[string]any{ // "name": "Metric1", // "metricName": "Percentage CPU", // "operator": "GreaterThan", // "threshold": "[parameters('threshold')]", // "timeAggregation": "Average", // }, // }, // "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria", // }, // "enabled": true, // "evaluationFrequency": "PT5M", // "scopes": "[variables('scopes')]", // "severity": "[parameters('alertSeverity')]", // "windowSize": "PT5M", // }, // }}, // Variables: map[string]any{ // "copy":[]any{ // map[string]any{ // "name": "actionsForMetricAlerts", // "count": "[length(parameters('actionGroupIds'))]", // "input":map[string]any{ // "actiongroupId": "[parameters('actionGroupIds')[copyIndex('actionsForMetricAlerts')]]", // }, // }, // }, // "scopes": "[array(parameters('targetResourceId'))]", // }, // }, // }, // }, // { // Name: to.Ptr("Available Memory Bytes"), // Type: to.Ptr("Microsoft.AlertsManagement/alertRuleRecommendations"), // ID: to.Ptr("/subscriptions/2f00cc51-6809-498f-9ffc-48c42aff570d/resourcegroups/test/providers/Microsoft.Compute/virtualMachines/testMachineCanBeSafelyDeleted/providers/Microsoft.AlertsManagement/alertRuleRecommendations/Available Memory Bytes"), // Properties: &armalertsmanagement.AlertRuleRecommendationProperties{ // AlertRuleType: to.Ptr("Microsoft.Insights/metricAlerts"), // DisplayInformation: map[string]*string{ // "displayUnits": to.Ptr("Gigabytes"), // "infoBallonLink": to.Ptr("Rule2 InfoBalloon Link"), // "infoBallonMessage": to.Ptr("Rule2 InfoBalloon Message"), // "metricDisplayName": to.Ptr("Available Memory Bytes"), // }, // RuleArmTemplate: &armalertsmanagement.RuleArmTemplate{ // Schema: to.Ptr("https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#"), // ContentVersion: to.Ptr("1.0.0.0"), // Parameters: map[string]any{ // "actionGroupIds":map[string]any{ // "type": "array", // "defaultValue":[]any{ // }, // "metadata":map[string]any{ // "description": "Insert Action groups ids to attach them to the below alert rules.", // }, // }, // "alertName":map[string]any{ // "type": "string", // "defaultValue": "[concat('parameters('alertNamePrefix'), ' - ', parameters('targetResourceName'))]", // "metadata":map[string]any{ // "description": "Name of the alert rule", // }, // "minLength": float64(1), // }, // "alertNamePrefix":map[string]any{ // "type": "string", // "defaultValue": "Available Memory Bytes", // "metadata":map[string]any{ // "description": "prefix of the alert rule name", // }, // "minLength": float64(1), // }, // "alertSeverity":map[string]any{ // "type": "int", // "allowedValues":[]any{ // float64(0), // float64(1), // float64(2), // float64(3), // float64(4), // }, // "defaultValue": float64(3), // "metadata":map[string]any{ // "description": "Severity of alert {0,1,2,3,4}", // }, // }, // "targetResourceId":map[string]any{ // "type": "string", // "defaultValue": "/subscriptions/2f00cc51-6809-498f-9ffc-48c42aff570d/resourcegroups/test/providers/Microsoft.Compute/virtualMachines/testMachineCanBeSafelyDeleted", // }, // "targetResourceName":map[string]any{ // "type": "string", // "defaultValue": "testmachinecanbesafelydeleted", // }, // "threshold":map[string]any{ // "type": "int", // "defaultValue": float64(1000000000), // "metadata":map[string]any{ // "description": "The threshold value at which the alert is activated.", // }, // }, // }, // Resources: []any{ // map[string]any{ // "name": "[parameters('alertName')]", // "type": "Microsoft.Insights/metricAlerts", // "apiVersion": "2018-03-01", // "location": "global", // "properties":map[string]any{ // "description": "Available Memory Bytes is less than 1 GB", // "actions": "[variables('actionsForMetricAlerts')]", // "criteria":map[string]any{ // "allOf":[]any{ // map[string]any{ // "name": "Metric1", // "metricName": "Available Memory Bytes", // "operator": "LessThan", // "threshold": "[parameters('threshold')]", // "timeAggregation": "Average", // }, // }, // "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria", // }, // "enabled": true, // "evaluationFrequency": "PT5M", // "scopes": "[variables('scopes')]", // "severity": "[parameters('alertSeverity')]", // "windowSize": "PT5M", // }, // }}, // Variables: map[string]any{ // "copy":[]any{ // map[string]any{ // "name": "actionsForMetricAlerts", // "count": "[length(parameters('actionGroupIds'))]", // "input":map[string]any{ // "actiongroupId": "[parameters('actionGroupIds')[copyIndex('actionsForMetricAlerts')]]", // }, // }, // }, // "scopes": "[array(parameters('targetResourceId'))]", // }, // }, // }, // }}, // } } }
Output:
func (*AlertRuleRecommendationsClient) NewListByTargetTypePager ¶ added in v0.10.0
func (client *AlertRuleRecommendationsClient) NewListByTargetTypePager(targetType string, options *AlertRuleRecommendationsClientListByTargetTypeOptions) *runtime.Pager[AlertRuleRecommendationsClientListByTargetTypeResponse]
NewListByTargetTypePager - Retrieve alert rule recommendations for a target type.
Generated from API version 2023-01-01-preview
- targetType - The recommendations target type.
- options - AlertRuleRecommendationsClientListByTargetTypeOptions contains the optional parameters for the AlertRuleRecommendationsClient.NewListByTargetTypePager method.
Example (ListAlertRuleRecommendationsForMonitoringAccountsAtSubscriptionLevel) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2023-01-01-preview/examples/AlertRuleRecommendations_GetBySubscription_MAC.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewAlertRuleRecommendationsClient().NewListByTargetTypePager("microsoft.monitor/accounts", 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.AlertRuleRecommendationsListResponse = armalertsmanagement.AlertRuleRecommendationsListResponse{ // Value: []*armalertsmanagement.AlertRuleRecommendationResource{ // { // Name: to.Ptr("NodeRecordingRulesRuleGroup"), // Type: to.Ptr("Microsoft.AlertsManagement/alertRuleRecommendations"), // ID: to.Ptr("/subscriptions/2f00cc51-6809-498f-9ffc-48c42aff570d/providers/Microsoft.AlertsManagement/alertRuleRecommendations/NodeRecordingRulesRuleGroup"), // Properties: &armalertsmanagement.AlertRuleRecommendationProperties{ // AlertRuleType: to.Ptr("Microsoft.AlertsManagement/prometheusRuleGroups"), // DisplayInformation: map[string]*string{ // "ruleInfo": to.Ptr("Rule Information for first recording rule."), // }, // RuleArmTemplate: &armalertsmanagement.RuleArmTemplate{ // Schema: to.Ptr("https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#"), // ContentVersion: to.Ptr("1.0.0.0"), // Parameters: map[string]any{ // "actionGroupIds":map[string]any{ // "type": "array", // "defaultValue":[]any{ // }, // "metadata":map[string]any{ // "description": "Insert Action groups ids to attach them to the below alert rules.", // }, // }, // "alertName":map[string]any{ // "type": "string", // "defaultValue": "[concat('parameters('alertNamePrefix'), ' - ', parameters('clusterNameForPrometheus'))]", // "metadata":map[string]any{ // "description": "Name of the alert rule", // }, // "minLength": float64(1), // }, // "alertNamePrefix":map[string]any{ // "type": "string", // "defaultValue": "NodeRecordingRulesRuleGroup", // "metadata":map[string]any{ // "description": "prefix of the alert rule name", // }, // "minLength": float64(1), // }, // "clusterNameForPrometheus":map[string]any{ // "type": "string", // }, // "location":map[string]any{ // "type": "string", // }, // "targetResourceId":map[string]any{ // "type": "string", // }, // "targetResourceName":map[string]any{ // "type": "string", // }, // }, // Resources: []any{ // map[string]any{ // "name": "[parameters('alertName')]", // "type": "Microsoft.AlertsManagement/prometheusRuleGroups", // "apiVersion": "2021-07-22-preview", // "location": "[parameters('location')]", // "properties":map[string]any{ // "description": "Node Recording Rules RuleGroup", // "clusterName": "[parameters('clusterNameForPrometheus')]", // "interval": "PT1M", // "rules":[]any{ // map[string]any{ // "expression": "count without (cpu, mode) ( node_cpu_seconds_total{job=\"node\",mode=\"idle\"})", // "record": "instance:node_num_cpu:sum", // }, // }, // "scopes": "[variables('scopes')]", // }, // }}, // Variables: map[string]any{ // "copy":[]any{ // map[string]any{ // "name": "actionsForPrometheusRuleGroups", // "count": "[length(parameters('actionGroupIds'))]", // "input":map[string]any{ // "actiongroupId": "[parameters('actionGroupIds')[copyIndex('actionsForPrometheusRuleGroups')]]", // }, // }, // }, // "scopes": "[array(parameters('targetResourceId'))]", // }, // }, // }, // }, // { // Name: to.Ptr("KubernetesReccordingRulesRuleGroup"), // Type: to.Ptr("Microsoft.AlertsManagement/alertRuleRecommendations"), // ID: to.Ptr("/subscriptions/2f00cc51-6809-498f-9ffc-48c42aff570d/providers/Microsoft.AlertsManagement/alertRuleRecommendations/KubernetesReccordingRulesRuleGroup"), // Properties: &armalertsmanagement.AlertRuleRecommendationProperties{ // AlertRuleType: to.Ptr("Microsoft.AlertsManagement/prometheusRuleGroups"), // DisplayInformation: map[string]*string{ // "ruleInfo": to.Ptr("Rule Information for second recording rule."), // }, // RuleArmTemplate: &armalertsmanagement.RuleArmTemplate{ // Schema: to.Ptr("https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#"), // ContentVersion: to.Ptr("1.0.0.0"), // Parameters: map[string]any{ // "actionGroupIds":map[string]any{ // "type": "array", // "defaultValue":[]any{ // }, // "metadata":map[string]any{ // "description": "Insert Action groups ids to attach them to the below alert rules.", // }, // }, // "alertName":map[string]any{ // "type": "string", // "defaultValue": "[concat('parameters('alertNamePrefix'), ' - ', parameters('clusterNameForPrometheus'))]", // "metadata":map[string]any{ // "description": "Name of the alert rule", // }, // "minLength": float64(1), // }, // "alertNamePrefix":map[string]any{ // "type": "string", // "defaultValue": "KubernetesReccordingRulesRuleGroup", // "metadata":map[string]any{ // "description": "prefix of the alert rule name", // }, // "minLength": float64(1), // }, // "clusterNameForPrometheus":map[string]any{ // "type": "string", // }, // "location":map[string]any{ // "type": "string", // }, // "targetResourceId":map[string]any{ // "type": "string", // }, // "targetResourceName":map[string]any{ // "type": "string", // }, // }, // Resources: []any{ // map[string]any{ // "name": "[parameters('alertName')]", // "type": "Microsoft.AlertsManagement/prometheusRuleGroups", // "apiVersion": "2021-07-22-preview", // "location": "[parameters('location')]", // "properties":map[string]any{ // "description": "Kubernetes Recording Rules RuleGroup", // "clusterName": "[parameters('clusterNameForPrometheus')]", // "interval": "PT1M", // "rules":[]any{ // map[string]any{ // "expression": "sum by (cluster, namespace, pod, container) ( irate(container_cpu_usage_seconds_total{job=\"cadvisor\", image!=\"\"}[5m])) * on (cluster, namespace, pod) group_left(node) topk by (cluster, namespace, pod) ( 1, max by(cluster, namespace, pod, node) (kube_pod_info{node!=\"\"}))", // "record": "node_namespace_pod_container:container_cpu_usage_seconds_total:sum_irate", // }, // }, // "scopes": "[variables('scopes')]", // }, // }}, // Variables: map[string]any{ // "copy":[]any{ // map[string]any{ // "name": "actionsForPrometheusRuleGroups", // "count": "[length(parameters('actionGroupIds'))]", // "input":map[string]any{ // "actiongroupId": "[parameters('actionGroupIds')[copyIndex('actionsForPrometheusRuleGroups')]]", // }, // }, // }, // "scopes": "[array(parameters('targetResourceId'))]", // }, // }, // }, // }, // { // Name: to.Ptr("KubernetesAlert-DefaultAlerts"), // Type: to.Ptr("Microsoft.AlertsManagement/alertRuleRecommendations"), // ID: to.Ptr("/subscriptions/2f00cc51-6809-498f-9ffc-48c42aff570d/providers/Microsoft.AlertsManagement/alertRuleRecommendations/KubernetesAlert-DefaultAlerts"), // Properties: &armalertsmanagement.AlertRuleRecommendationProperties{ // AlertRuleType: to.Ptr("Microsoft.AlertsManagement/prometheusRuleGroups"), // DisplayInformation: map[string]*string{ // "ruleInfo": to.Ptr("Rule Information for alerting rule."), // }, // RuleArmTemplate: &armalertsmanagement.RuleArmTemplate{ // Schema: to.Ptr("https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#"), // ContentVersion: to.Ptr("1.0.0.0"), // Parameters: map[string]any{ // "actionGroupIds":map[string]any{ // "type": "array", // "defaultValue":[]any{ // }, // "metadata":map[string]any{ // "description": "Insert Action groups ids to attach them to the below alert rules.", // }, // }, // "alertName":map[string]any{ // "type": "string", // "defaultValue": "[concat('parameters('alertNamePrefix'), ' - ', parameters('clusterNameForPrometheus'))]", // "metadata":map[string]any{ // "description": "Name of the alert rule", // }, // "minLength": float64(1), // }, // "alertNamePrefix":map[string]any{ // "type": "string", // "defaultValue": "KubernetesAlert-DefaultAlerts", // "metadata":map[string]any{ // "description": "prefix of the alert rule name", // }, // "minLength": float64(1), // }, // "clusterNameForPrometheus":map[string]any{ // "type": "string", // }, // "location":map[string]any{ // "type": "string", // }, // "targetResourceId":map[string]any{ // "type": "string", // }, // "targetResourceName":map[string]any{ // "type": "string", // }, // }, // Resources: []any{ // map[string]any{ // "name": "[parameters('alertName')]", // "type": "Microsoft.AlertsManagement/prometheusRuleGroups", // "apiVersion": "2021-07-22-preview", // "location": "[parameters('location')]", // "properties":map[string]any{ // "description": "Kubernetes Alert RuleGroup-DefaultAlerts", // "clusterName": "[parameters('clusterNameForPrometheus')]", // "interval": "PT1M", // "rules":[]any{ // map[string]any{ // "Severity": float64(3), // "actions": "[variables('actionsForPrometheusRuleGroups')]", // "alert": "KubePodCrashLooping", // "expression": "max_over_time(kube_pod_container_status_waiting_reason{reason=\"CrashLoopBackOff\", job=\"kube-state-metrics\"}[5m]) >= 1", // "for": "PT15M", // "labels":map[string]any{ // "severity": "warning", // }, // }, // map[string]any{ // "Severity": float64(3), // "actions": "[variables('actionsForPrometheusRuleGroups')]", // "alert": "KubePodNotReady", // "expression": "sum by (namespace, pod, cluster) ( max by(namespace, pod, cluster) ( kube_pod_status_phase{job=\"kube-state-metrics\", phase=~\"Pending|Unknown\"} ) * on(namespace, pod, cluster) group_left(owner_kind) topk by(namespace, pod, cluster) ( 1, max by(namespace, pod, owner_kind, cluster) (kube_pod_owner{owner_kind!=\"Job\"}) )) > 0", // "for": "PT15M", // "labels":map[string]any{ // "severity": "warning", // }, // }, // }, // "scopes": "[variables('scopes')]", // }, // }}, // Variables: map[string]any{ // "copy":[]any{ // map[string]any{ // "name": "actionsForPrometheusRuleGroups", // "count": "[length(parameters('actionGroupIds'))]", // "input":map[string]any{ // "actiongroupId": "[parameters('actionGroupIds')[copyIndex('actionsForPrometheusRuleGroups')]]", // }, // }, // }, // "scopes": "[array(parameters('targetResourceId'))]", // }, // }, // }, // }}, // } } }
Output:
Example (ListAlertRuleRecommendationsForVirtualMachinesAtSubscriptionLevel) ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2023-01-01-preview/examples/AlertRuleRecommendations_GetBySubscription_VM.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewAlertRuleRecommendationsClient().NewListByTargetTypePager("microsoft.compute/virtualmachines", 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.AlertRuleRecommendationsListResponse = armalertsmanagement.AlertRuleRecommendationsListResponse{ // Value: []*armalertsmanagement.AlertRuleRecommendationResource{ // { // Name: to.Ptr("Percentage CPU"), // Type: to.Ptr("Microsoft.AlertsManagement/alertRuleRecommendations"), // ID: to.Ptr("/subscriptions/2f00cc51-6809-498f-9ffc-48c42aff570d/providers/Microsoft.AlertsManagement/alertRuleRecommendations/Percentage CPU"), // Properties: &armalertsmanagement.AlertRuleRecommendationProperties{ // AlertRuleType: to.Ptr("Microsoft.Insights/metricAlerts"), // DisplayInformation: map[string]*string{ // "displayUnits": to.Ptr("Percentage"), // "infoBallonLink": to.Ptr("Rule1 InfoBalloon Link"), // "infoBallonMessage": to.Ptr("Rule1 InfoBalloon Message"), // "metricDisplayName": to.Ptr("Percentage CPU"), // }, // RuleArmTemplate: &armalertsmanagement.RuleArmTemplate{ // Schema: to.Ptr("https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#"), // ContentVersion: to.Ptr("1.0.0.0"), // Parameters: map[string]any{ // "actionGroupIds":map[string]any{ // "type": "array", // "defaultValue":[]any{ // }, // "metadata":map[string]any{ // "description": "Insert Action groups ids to attach them to the below alert rules.", // }, // }, // "alertName":map[string]any{ // "type": "string", // "defaultValue": "[concat('parameters('alertNamePrefix'), ' - ', parameters('targetResourceName'))]", // "metadata":map[string]any{ // "description": "Name of the alert rule", // }, // "minLength": float64(1), // }, // "alertNamePrefix":map[string]any{ // "type": "string", // "defaultValue": "Percentage CPU", // "metadata":map[string]any{ // "description": "prefix of the alert rule name", // }, // "minLength": float64(1), // }, // "alertSeverity":map[string]any{ // "type": "int", // "allowedValues":[]any{ // float64(0), // float64(1), // float64(2), // float64(3), // float64(4), // }, // "defaultValue": float64(3), // "metadata":map[string]any{ // "description": "Severity of alert {0,1,2,3,4}", // }, // }, // "targetResourceId":map[string]any{ // "type": "string", // }, // "targetResourceName":map[string]any{ // "type": "string", // }, // "threshold":map[string]any{ // "type": "int", // "defaultValue": float64(80), // "metadata":map[string]any{ // "description": "The threshold value at which the alert is activated.", // }, // }, // }, // Resources: []any{ // map[string]any{ // "name": "[parameters('alertName')]", // "type": "Microsoft.Insights/metricAlerts", // "apiVersion": "2018-03-01", // "location": "global", // "properties":map[string]any{ // "description": "Percentage CPU is greater than 80 %", // "actions": "[variables('actionsForMetricAlerts')]", // "criteria":map[string]any{ // "allOf":[]any{ // map[string]any{ // "name": "Metric1", // "metricName": "Percentage CPU", // "operator": "GreaterThan", // "threshold": "[parameters('threshold')]", // "timeAggregation": "Average", // }, // }, // "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria", // }, // "enabled": true, // "evaluationFrequency": "PT5M", // "scopes": "[variables('scopes')]", // "severity": "[parameters('alertSeverity')]", // "windowSize": "PT5M", // }, // }}, // Variables: map[string]any{ // "copy":[]any{ // map[string]any{ // "name": "actionsForMetricAlerts", // "count": "[length(parameters('actionGroupIds'))]", // "input":map[string]any{ // "actiongroupId": "[parameters('actionGroupIds')[copyIndex('actionsForMetricAlerts')]]", // }, // }, // }, // "scopes": "[array(parameters('targetResourceId'))]", // }, // }, // }, // }, // { // Name: to.Ptr("Available Memory Bytes"), // Type: to.Ptr("Microsoft.AlertsManagement/alertRuleRecommendations"), // ID: to.Ptr("/subscriptions/2f00cc51-6809-498f-9ffc-48c42aff570d/providers/Microsoft.AlertsManagement/alertRuleRecommendations/Available Memory Bytes"), // Properties: &armalertsmanagement.AlertRuleRecommendationProperties{ // AlertRuleType: to.Ptr("Microsoft.Insights/metricAlerts"), // DisplayInformation: map[string]*string{ // "displayUnits": to.Ptr("Gigabytes"), // "infoBallonLink": to.Ptr("Rule2 InfoBalloon Link"), // "infoBallonMessage": to.Ptr("Rule2 InfoBalloon Message"), // "metricDisplayName": to.Ptr("Available Memory Bytes"), // }, // RuleArmTemplate: &armalertsmanagement.RuleArmTemplate{ // Schema: to.Ptr("https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#"), // ContentVersion: to.Ptr("1.0.0.0"), // Parameters: map[string]any{ // "actionGroupIds":map[string]any{ // "type": "array", // "defaultValue":[]any{ // }, // "metadata":map[string]any{ // "description": "Insert Action groups ids to attach them to the below alert rules.", // }, // }, // "alertName":map[string]any{ // "type": "string", // "defaultValue": "[concat('parameters('alertNamePrefix'), ' - ', parameters('targetResourceName'))]", // "metadata":map[string]any{ // "description": "Name of the alert rule", // }, // "minLength": float64(1), // }, // "alertNamePrefix":map[string]any{ // "type": "string", // "defaultValue": "Available Memory Bytes", // "metadata":map[string]any{ // "description": "prefix of the alert rule name", // }, // "minLength": float64(1), // }, // "alertSeverity":map[string]any{ // "type": "int", // "allowedValues":[]any{ // float64(0), // float64(1), // float64(2), // float64(3), // float64(4), // }, // "defaultValue": float64(3), // "metadata":map[string]any{ // "description": "Severity of alert {0,1,2,3,4}", // }, // }, // "targetResourceId":map[string]any{ // "type": "string", // }, // "targetResourceName":map[string]any{ // "type": "string", // }, // "threshold":map[string]any{ // "type": "int", // "defaultValue": float64(1000000000), // "metadata":map[string]any{ // "description": "The threshold value at which the alert is activated.", // }, // }, // }, // Resources: []any{ // map[string]any{ // "name": "[parameters('alertName')]", // "type": "Microsoft.Insights/metricAlerts", // "apiVersion": "2018-03-01", // "location": "global", // "properties":map[string]any{ // "description": "Available Memory Bytes is less than 1 GB", // "actions": "[variables('actionsForMetricAlerts')]", // "criteria":map[string]any{ // "allOf":[]any{ // map[string]any{ // "name": "Metric1", // "metricName": "Available Memory Bytes", // "operator": "LessThan", // "threshold": "[parameters('threshold')]", // "timeAggregation": "Average", // }, // }, // "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria", // }, // "enabled": true, // "evaluationFrequency": "PT5M", // "scopes": "[variables('scopes')]", // "severity": "[parameters('alertSeverity')]", // "windowSize": "PT5M", // }, // }}, // Variables: map[string]any{ // "copy":[]any{ // map[string]any{ // "name": "actionsForMetricAlerts", // "count": "[length(parameters('actionGroupIds'))]", // "input":map[string]any{ // "actiongroupId": "[parameters('actionGroupIds')[copyIndex('actionsForMetricAlerts')]]", // }, // }, // }, // "scopes": "[array(parameters('targetResourceId'))]", // }, // }, // }, // }}, // } } }
Output:
type AlertRuleRecommendationsClientListByResourceOptions ¶ added in v0.10.0
type AlertRuleRecommendationsClientListByResourceOptions struct { }
AlertRuleRecommendationsClientListByResourceOptions contains the optional parameters for the AlertRuleRecommendationsClient.NewListByResourcePager method.
type AlertRuleRecommendationsClientListByResourceResponse ¶ added in v0.10.0
type AlertRuleRecommendationsClientListByResourceResponse struct { // List of alert rule recommendations. AlertRuleRecommendationsListResponse }
AlertRuleRecommendationsClientListByResourceResponse contains the response from method AlertRuleRecommendationsClient.NewListByResourcePager.
type AlertRuleRecommendationsClientListByTargetTypeOptions ¶ added in v0.10.0
type AlertRuleRecommendationsClientListByTargetTypeOptions struct { }
AlertRuleRecommendationsClientListByTargetTypeOptions contains the optional parameters for the AlertRuleRecommendationsClient.NewListByTargetTypePager method.
type AlertRuleRecommendationsClientListByTargetTypeResponse ¶ added in v0.10.0
type AlertRuleRecommendationsClientListByTargetTypeResponse struct { // List of alert rule recommendations. AlertRuleRecommendationsListResponse }
AlertRuleRecommendationsClientListByTargetTypeResponse contains the response from method AlertRuleRecommendationsClient.NewListByTargetTypePager.
type AlertRuleRecommendationsListResponse ¶ added in v0.10.0
type AlertRuleRecommendationsListResponse struct { // REQUIRED; the values for the alert rule recommendations. Value []*AlertRuleRecommendationResource // URL to fetch the next set of recommendations. NextLink *string }
AlertRuleRecommendationsListResponse - List of alert rule recommendations.
func (AlertRuleRecommendationsListResponse) MarshalJSON ¶ added in v0.10.0
func (a AlertRuleRecommendationsListResponse) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AlertRuleRecommendationsListResponse.
func (*AlertRuleRecommendationsListResponse) UnmarshalJSON ¶ added in v0.10.0
func (a *AlertRuleRecommendationsListResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleRecommendationsListResponse.
type AlertState ¶
type AlertState string
const ( AlertStateAcknowledged AlertState = "Acknowledged" AlertStateClosed AlertState = "Closed" AlertStateNew AlertState = "New" )
func PossibleAlertStateValues ¶
func PossibleAlertStateValues() []AlertState
PossibleAlertStateValues returns the possible values for the AlertState const type.
type AlertsClient ¶
type AlertsClient struct {
// contains filtered or unexported fields
}
AlertsClient contains the methods for the Alerts group. Don't use this type directly, use NewAlertsClient() instead.
func NewAlertsClient ¶
func NewAlertsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertsClient, error)
NewAlertsClient creates a new instance of AlertsClient with the specified values.
- subscriptionID - The ID of the target subscription.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*AlertsClient) ChangeState ¶
func (client *AlertsClient) ChangeState(ctx context.Context, alertID string, newState AlertState, options *AlertsClientChangeStateOptions) (AlertsClientChangeStateResponse, error)
ChangeState - Change the state of an alert. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2019-05-05-preview
- alertID - Unique ID of an alert instance.
- newState - New state of the alert.
- options - AlertsClientChangeStateOptions contains the optional parameters for the AlertsClient.ChangeState method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2019-05-05-preview/examples/Alerts_ChangeState.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewAlertsClient().ChangeState(ctx, "66114d64-d9d9-478b-95c9-b789d6502100", armalertsmanagement.AlertStateAcknowledged, &armalertsmanagement.AlertsClientChangeStateOptions{Comment: 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.Alert = armalertsmanagement.Alert{ // Name: to.Ptr("cpu alert"), // Type: to.Ptr("Microsoft.AlertsManagement/alerts"), // ID: to.Ptr("/subscriptions/9e261de7-c804-4b9d-9ebf-6f50fe350a9a/providers/Microsoft.AlertsManagement/alerts/66114d64-d9d9-478b-95c9-b789d6502100"), // Properties: &armalertsmanagement.AlertProperties{ // Context: map[string]any{ // }, // EgressConfig: map[string]any{ // }, // Essentials: &armalertsmanagement.Essentials{ // Description: to.Ptr("description of the alert"), // ActionStatus: &armalertsmanagement.ActionStatus{ // IsSuppressed: to.Ptr(false), // }, // AlertRule: to.Ptr("https://servisdfsdfappinsight.portal.mms.microsoft.com/#Workspace/overview/settings/details/Edit Alert Rule/details/index?savedSearchId=&scheduleId="), // AlertState: to.Ptr(armalertsmanagement.AlertStateAcknowledged), // LastModifiedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T15:51:02.000Z"); return t}()), // LastModifiedUserName: to.Ptr("System"), // MonitorCondition: to.Ptr(armalertsmanagement.MonitorConditionFired), // MonitorConditionResolvedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T15:51:02.000Z"); return t}()), // MonitorService: to.Ptr(armalertsmanagement.MonitorServiceApplicationInsights), // Severity: to.Ptr(armalertsmanagement.SeveritySev3), // SignalType: to.Ptr(armalertsmanagement.SignalTypeLog), // SmartGroupID: to.Ptr("23d6b2ce-8c54-468f-aff0-sd32aebb7e56"), // SmartGroupingReason: to.Ptr("Occurred frequently with other alerts"), // SourceCreatedID: to.Ptr("6cd6b2ce-8c54-468f-aff0-9d12aebb7e49"), // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T15:51:02.000Z"); return t}()), // TargetResource: to.Ptr("/subscriptions/3b540246-808d-4331-99aa-917b808a9166/resourcegroups/servicedeskresourcegroup/providers/microsoft.insights/components/servicedeskappinsight"), // TargetResourceGroup: to.Ptr("servicedeskresourcegroup"), // TargetResourceName: to.Ptr("servicedeskappinsight"), // TargetResourceType: to.Ptr("components"), // }, // }, // } }
Output:
func (*AlertsClient) GetByID ¶
func (client *AlertsClient) GetByID(ctx context.Context, alertID string, options *AlertsClientGetByIDOptions) (AlertsClientGetByIDResponse, error)
GetByID - Get information related to a specific alert If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2019-05-05-preview
- alertID - Unique ID of an alert instance.
- options - AlertsClientGetByIDOptions contains the optional parameters for the AlertsClient.GetByID method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2019-05-05-preview/examples/Alerts_GetById.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewAlertsClient().GetByID(ctx, "66114d64-d9d9-478b-95c9-b789d6502100", 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.Alert = armalertsmanagement.Alert{ // Name: to.Ptr("cpu alert"), // Type: to.Ptr("Microsoft.AlertsManagement/alerts"), // ID: to.Ptr("/subscriptions/9e261de7-c804-4b9d-9ebf-6f50fe350a9a/providers/Microsoft.AlertsManagement/alerts/66114d64-d9d9-478b-95c9-b789d6502100"), // Properties: &armalertsmanagement.AlertProperties{ // Context: map[string]any{ // }, // EgressConfig: map[string]any{ // }, // Essentials: &armalertsmanagement.Essentials{ // Description: to.Ptr("description of the alert"), // ActionStatus: &armalertsmanagement.ActionStatus{ // IsSuppressed: to.Ptr(false), // }, // AlertRule: to.Ptr("https://sersdfsdfinsight.portal.mms.microsoft.com/#Workspace/overview/settings/details/Edit Alert Rule/details/index?savedSearchId=&scheduleId="), // AlertState: to.Ptr(armalertsmanagement.AlertStateAcknowledged), // LastModifiedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T15:51:02.000Z"); return t}()), // LastModifiedUserName: to.Ptr("System"), // MonitorCondition: to.Ptr(armalertsmanagement.MonitorConditionFired), // MonitorConditionResolvedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T15:51:02.000Z"); return t}()), // MonitorService: to.Ptr(armalertsmanagement.MonitorServiceApplicationInsights), // Severity: to.Ptr(armalertsmanagement.SeveritySev3), // SignalType: to.Ptr(armalertsmanagement.SignalTypeLog), // SmartGroupID: to.Ptr("23d6b2ce-8c54-468f-aff0-sd32aebb7e56"), // SmartGroupingReason: to.Ptr("Occurred frequently with other alerts"), // SourceCreatedID: to.Ptr("6cd6b2ce-8c54-468f-aff0-9d12aebb7e49"), // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T15:51:02.000Z"); return t}()), // TargetResource: to.Ptr("/subscriptions/3b540246-808d-4331-99aa-917b808a9166/resourcegroups/servicedeskresourcegroup/providers/microsoft.insights/components/servicedeskappinsight"), // TargetResourceGroup: to.Ptr("servicedeskresourcegroup"), // TargetResourceName: to.Ptr("servicedeskappinsight"), // TargetResourceType: to.Ptr("components"), // }, // }, // } }
Output:
func (*AlertsClient) GetHistory ¶
func (client *AlertsClient) GetHistory(ctx context.Context, alertID string, options *AlertsClientGetHistoryOptions) (AlertsClientGetHistoryResponse, error)
GetHistory - Get the history of an alert, which captures any monitor condition changes (Fired/Resolved) and alert state changes (New/Acknowledged/Closed). If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2019-05-05-preview
- alertID - Unique ID of an alert instance.
- options - AlertsClientGetHistoryOptions contains the optional parameters for the AlertsClient.GetHistory method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2019-05-05-preview/examples/Alerts_History.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewAlertsClient().GetHistory(ctx, "66114d64-d9d9-478b-95c9-b789d6502100", 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.AlertModification = armalertsmanagement.AlertModification{ // Name: to.Ptr("CPU Alert"), // Type: to.Ptr("Microsoft.AlertsManagement/alerts"), // ID: to.Ptr("/subscriptions/9e261de7-c804-4b9d-9ebf-6f50fe350a9a/providers/Microsoft.AlertsManagement/alerts/66114d64-d9d9-478b-95c9-b789d6502100/history/default"), // Properties: &armalertsmanagement.AlertModificationProperties{ // AlertID: to.Ptr("66114d64-d9d9-478b-95c9-b789d6502100"), // Modifications: []*armalertsmanagement.AlertModificationItem{ // { // Description: to.Ptr("State changed from 'New' to 'Acknowledged'"), // Comments: to.Ptr("Acknowledging alert"), // ModificationEvent: to.Ptr(armalertsmanagement.AlertModificationEventStateChange), // ModifiedAt: to.Ptr("2018-06-13T06:14:15.7378737Z"), // ModifiedBy: to.Ptr("vikramm@microsoft.com"), // NewValue: to.Ptr("Acknowledged"), // OldValue: to.Ptr("New"), // }, // { // Description: to.Ptr("New Alert Object is created"), // Comments: to.Ptr(""), // ModificationEvent: to.Ptr(armalertsmanagement.AlertModificationEventAlertCreated), // ModifiedAt: to.Ptr("2018-06-13T06:09:01Z"), // ModifiedBy: to.Ptr("System"), // NewValue: to.Ptr(""), // OldValue: to.Ptr(""), // }}, // }, // } }
Output:
func (*AlertsClient) GetSummary ¶
func (client *AlertsClient) GetSummary(ctx context.Context, groupby AlertsSummaryGroupByFields, options *AlertsClientGetSummaryOptions) (AlertsClientGetSummaryResponse, error)
GetSummary - Get a summarized count of your alerts grouped by various parameters (e.g. grouping by 'Severity' returns the count of alerts for each severity). If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2019-05-05-preview
- groupby - This parameter allows the result set to be grouped by input fields (Maximum 2 comma separated fields supported). For example, groupby=severity or groupby=severity,alertstate.
- options - AlertsClientGetSummaryOptions contains the optional parameters for the AlertsClient.GetSummary method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2019-05-05-preview/examples/Alerts_Summary.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewAlertsClient().GetSummary(ctx, armalertsmanagement.AlertsSummaryGroupByFields("severity,alertState"), &armalertsmanagement.AlertsClientGetSummaryOptions{IncludeSmartGroupsCount: nil, TargetResource: nil, TargetResourceType: nil, TargetResourceGroup: nil, MonitorService: nil, MonitorCondition: nil, Severity: nil, AlertState: nil, AlertRule: nil, TimeRange: nil, CustomTimeRange: 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.AlertsSummary = armalertsmanagement.AlertsSummary{ // Name: to.Ptr("current"), // Type: to.Ptr("Microsoft.AlertsManagement/alertsSummary"), // ID: to.Ptr("/subscriptions/1e3ff1c0-771a-4119-a03b-be82a51e232d/providers/Microsoft.AlertsManagement/alertsSummary/current"), // Properties: &armalertsmanagement.AlertsSummaryGroup{ // Groupedby: to.Ptr("severity"), // SmartGroupsCount: to.Ptr[int64](100), // Total: to.Ptr[int64](14189), // Values: []*armalertsmanagement.AlertsSummaryGroupItem{ // { // Name: to.Ptr("Sev0"), // Count: to.Ptr[int64](6517), // Groupedby: to.Ptr("alertState"), // Values: []*armalertsmanagement.AlertsSummaryGroupItem{ // { // Name: to.Ptr("New"), // Count: to.Ptr[int64](6517), // }, // { // Name: to.Ptr("Acknowledged"), // Count: to.Ptr[int64](0), // }, // { // Name: to.Ptr("Closed"), // Count: to.Ptr[int64](0), // }}, // }, // { // Name: to.Ptr("Sev1"), // Count: to.Ptr[int64](3175), // Groupedby: to.Ptr("alertState"), // Values: []*armalertsmanagement.AlertsSummaryGroupItem{ // { // Name: to.Ptr("New"), // Count: to.Ptr[int64](3175), // }, // { // Name: to.Ptr("Acknowledged"), // Count: to.Ptr[int64](0), // }, // { // Name: to.Ptr("Closed"), // Count: to.Ptr[int64](0), // }}, // }, // { // Name: to.Ptr("Sev2"), // Count: to.Ptr[int64](1120), // Groupedby: to.Ptr("alertState"), // Values: []*armalertsmanagement.AlertsSummaryGroupItem{ // { // Name: to.Ptr("New"), // Count: to.Ptr[int64](1120), // }, // { // Name: to.Ptr("Acknowledged"), // Count: to.Ptr[int64](0), // }, // { // Name: to.Ptr("Closed"), // Count: to.Ptr[int64](0), // }}, // }, // { // Name: to.Ptr("Sev3"), // Count: to.Ptr[int64](1902), // Groupedby: to.Ptr("alertState"), // Values: []*armalertsmanagement.AlertsSummaryGroupItem{ // { // Name: to.Ptr("New"), // Count: to.Ptr[int64](1902), // }, // { // Name: to.Ptr("Acknowledged"), // Count: to.Ptr[int64](0), // }, // { // Name: to.Ptr("Closed"), // Count: to.Ptr[int64](0), // }}, // }, // { // Name: to.Ptr("Sev4"), // Count: to.Ptr[int64](1475), // Groupedby: to.Ptr("alertState"), // Values: []*armalertsmanagement.AlertsSummaryGroupItem{ // { // Name: to.Ptr("New"), // Count: to.Ptr[int64](1475), // }, // { // Name: to.Ptr("Acknowledged"), // Count: to.Ptr[int64](0), // }, // { // Name: to.Ptr("Closed"), // Count: to.Ptr[int64](0), // }}, // }}, // }, // } }
Output:
func (*AlertsClient) MetaData ¶
func (client *AlertsClient) MetaData(ctx context.Context, identifier Identifier, options *AlertsClientMetaDataOptions) (AlertsClientMetaDataResponse, error)
MetaData - List alerts meta data information based on value of identifier parameter. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2019-05-05-preview
- identifier - Identification of the information to be retrieved by API call.
- options - AlertsClientMetaDataOptions contains the optional parameters for the AlertsClient.MetaData method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2019-05-05-preview/examples/AlertsMetaData_MonitorService.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewAlertsClient().MetaData(ctx, armalertsmanagement.IdentifierMonitorServiceList, 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.AlertsMetaData = armalertsmanagement.AlertsMetaData{ // Properties: &armalertsmanagement.MonitorServiceList{ // MetadataIdentifier: to.Ptr(armalertsmanagement.MetadataIdentifierMonitorServiceList), // Data: []*armalertsmanagement.MonitorServiceDetails{ // { // Name: to.Ptr("ActivityLog Administrative"), // DisplayName: to.Ptr("Activity Log - Administrative"), // }, // { // Name: to.Ptr("ActivityLog Autoscale"), // DisplayName: to.Ptr("Activity Log - Autoscale"), // }, // { // Name: to.Ptr("ActivityLog Policy"), // DisplayName: to.Ptr("Activity Log - Policy"), // }, // { // Name: to.Ptr("ActivityLog Recommendation"), // DisplayName: to.Ptr("Activity Log - Recommendation"), // }, // { // Name: to.Ptr("ActivityLog Security"), // DisplayName: to.Ptr("Activity Log - Security"), // }, // { // Name: to.Ptr("Application Insights"), // DisplayName: to.Ptr("Application Insights"), // }, // { // Name: to.Ptr("Azure Backup"), // DisplayName: to.Ptr("Azure Backup"), // }, // { // Name: to.Ptr("Custom"), // DisplayName: to.Ptr("Custom"), // }, // { // Name: to.Ptr("Data Box Edge"), // DisplayName: to.Ptr("Data Box Edge"), // }, // { // Name: to.Ptr("VM Insights"), // DisplayName: to.Ptr("VM Insights"), // }, // { // Name: to.Ptr("Log Analytics"), // DisplayName: to.Ptr("Log Analytics"), // }, // { // Name: to.Ptr("Nagios"), // DisplayName: to.Ptr("NAGIOS"), // }, // { // Name: to.Ptr("Platform"), // DisplayName: to.Ptr("Platform"), // }, // { // Name: to.Ptr("Resource Health"), // DisplayName: to.Ptr("Resource Health"), // }, // { // Name: to.Ptr("SCOM"), // DisplayName: to.Ptr("SCOM"), // }, // { // Name: to.Ptr("ServiceHealth"), // DisplayName: to.Ptr("Service Health"), // }, // { // Name: to.Ptr("Smart Detector"), // DisplayName: to.Ptr("SmartDetector"), // }, // { // Name: to.Ptr("Zabbix"), // DisplayName: to.Ptr("ZABBIX"), // }}, // }, // } }
Output:
func (*AlertsClient) NewGetAllPager ¶ added in v0.5.0
func (client *AlertsClient) NewGetAllPager(options *AlertsClientGetAllOptions) *runtime.Pager[AlertsClientGetAllResponse]
NewGetAllPager - List all existing alerts, where the results can be filtered on the basis of multiple parameters (e.g. time range). The results can then be sorted on the basis specific fields, with the default being lastModifiedDateTime.
Generated from API version 2019-05-05-preview
- options - AlertsClientGetAllOptions contains the optional parameters for the AlertsClient.NewGetAllPager method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2019-05-05-preview/examples/Alerts_List.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewAlertsClient().NewGetAllPager(&armalertsmanagement.AlertsClientGetAllOptions{TargetResource: nil, TargetResourceType: nil, TargetResourceGroup: nil, MonitorService: nil, MonitorCondition: nil, Severity: nil, AlertState: nil, AlertRule: nil, SmartGroupID: nil, IncludeContext: nil, IncludeEgressConfig: nil, PageCount: nil, SortBy: nil, SortOrder: nil, Select: nil, TimeRange: nil, CustomTimeRange: 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.AlertsList = armalertsmanagement.AlertsList{ // Value: []*armalertsmanagement.Alert{ // { // Name: to.Ptr("cpu alert"), // Type: to.Ptr("Microsoft.AlertsManagement/alerts"), // ID: to.Ptr("/subscriptions/9e261de7-c804-4b9d-9ebf-6f50fe350a9a/providers/Microsoft.AlertsManagement/alerts/66114d64-d9d9-478b-95c9-b789d6502100"), // Properties: &armalertsmanagement.AlertProperties{ // Context: map[string]any{ // }, // EgressConfig: map[string]any{ // }, // Essentials: &armalertsmanagement.Essentials{ // Description: to.Ptr("description of the alert"), // ActionStatus: &armalertsmanagement.ActionStatus{ // IsSuppressed: to.Ptr(false), // }, // AlertRule: to.Ptr("https://servisdffsdf.portal.mms.microsoft.com/#Workspace/overview/settings/details/Edit Alert Rule/details/index?savedSearchId=&scheduleId="), // AlertState: to.Ptr(armalertsmanagement.AlertStateAcknowledged), // LastModifiedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T15:51:02.000Z"); return t}()), // LastModifiedUserName: to.Ptr("System"), // MonitorCondition: to.Ptr(armalertsmanagement.MonitorConditionFired), // MonitorConditionResolvedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T15:51:02.000Z"); return t}()), // MonitorService: to.Ptr(armalertsmanagement.MonitorServiceApplicationInsights), // Severity: to.Ptr(armalertsmanagement.SeveritySev3), // SignalType: to.Ptr(armalertsmanagement.SignalTypeLog), // SmartGroupID: to.Ptr("23d6b2ce-8c54-468f-aff0-sd32aebb7e56"), // SmartGroupingReason: to.Ptr("Occurred frequently with other alerts"), // SourceCreatedID: to.Ptr("6cd6b2ce-8c54-468f-aff0-9d12aebb7e49"), // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T15:51:02.000Z"); return t}()), // TargetResource: to.Ptr("/subscriptions/3b540246-808d-4331-99aa-917b808a9166/resourcegroups/servicedeskresourcegroup/providers/microsoft.insights/components/servicedeskappinsight"), // TargetResourceGroup: to.Ptr("servicedeskresourcegroup"), // TargetResourceName: to.Ptr("servicedeskappinsight"), // TargetResourceType: to.Ptr("components"), // }, // }, // }, // { // Name: to.Ptr("cpu alert"), // Type: to.Ptr("Microsoft.AlertsManagement/alerts"), // ID: to.Ptr("/subscriptions/9e261de7-c804-4b9d-9ebf-6f50fe350a9a/providers/Microsoft.AlertsManagement/alerts/66114d64-d9d9-478b-95c9-b789d6502100"), // Properties: &armalertsmanagement.AlertProperties{ // Context: map[string]any{ // }, // EgressConfig: map[string]any{ // }, // Essentials: &armalertsmanagement.Essentials{ // Description: to.Ptr("description of the alert"), // ActionStatus: &armalertsmanagement.ActionStatus{ // IsSuppressed: to.Ptr(false), // }, // AlertRule: to.Ptr("https://servicsdfsdf.portal.mms.microsoft.com/#Workspace/overview/settings/details/Edit Alert Rule/details/index?savedSearchId=&scheduleId="), // AlertState: to.Ptr(armalertsmanagement.AlertStateNew), // LastModifiedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T15:51:02.000Z"); return t}()), // LastModifiedUserName: to.Ptr("System"), // MonitorCondition: to.Ptr(armalertsmanagement.MonitorConditionFired), // MonitorConditionResolvedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T15:51:02.000Z"); return t}()), // MonitorService: to.Ptr(armalertsmanagement.MonitorServiceApplicationInsights), // Severity: to.Ptr(armalertsmanagement.SeveritySev3), // SignalType: to.Ptr(armalertsmanagement.SignalTypeLog), // SmartGroupID: to.Ptr("d1c49c89-ea95-4697-a299-c0f5ebac62f1"), // SmartGroupingReason: to.Ptr("Alerts that frequently occur together have been grouped."), // SourceCreatedID: to.Ptr("6cd6b2ce-8c54-468f-aff0-9d12aebb7e49"), // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-09-13T15:51:02.000Z"); return t}()), // TargetResource: to.Ptr("/subscriptions/3b540246-808d-4331-99aa-917b808a9166/resourcegroups/cind/providers/microsoft.operationalinsights/workspaces/servicedeskwcus"), // TargetResourceGroup: to.Ptr("servicedeskresourcegroup"), // TargetResourceName: to.Ptr("servicedeskwcus"), // TargetResourceType: to.Ptr("components"), // }, // }, // }}, // } } }
Output:
type AlertsClientChangeStateOptions ¶ added in v0.3.0
type AlertsClientChangeStateOptions struct { // reason of change alert state Comment *Comments }
AlertsClientChangeStateOptions contains the optional parameters for the AlertsClient.ChangeState method.
type AlertsClientChangeStateResponse ¶ added in v0.3.0
type AlertsClientChangeStateResponse struct { // An alert created in alert management service. Alert }
AlertsClientChangeStateResponse contains the response from method AlertsClient.ChangeState.
type AlertsClientGetAllOptions ¶ added in v0.3.0
type AlertsClientGetAllOptions struct { // Filter by specific alert rule. Default value is to select all. AlertRule *string // Filter by state of the alert instance. Default value is to select all. AlertState *AlertState // Filter by custom time range in the format / where time is in (ISO-8601 format)'. Permissible values is within 30 days from // query time. Either timeRange or customTimeRange could be used but not both. // Default is none. CustomTimeRange *string // Include context which has contextual data specific to the monitor service. Default value is false' IncludeContext *bool // Include egress config which would be used for displaying the content in portal. Default value is 'false'. IncludeEgressConfig *bool // Filter by monitor condition which is either 'Fired' or 'Resolved'. Default value is to select all. MonitorCondition *MonitorCondition // Filter by monitor service which generates the alert instance. Default value is select all. MonitorService *MonitorService // Determines number of alerts returned per page in response. Permissible value is between 1 to 250. When the "includeContent" // filter is selected, maximum value allowed is 25. Default value is 25. PageCount *int64 // This filter allows to selection of the fields(comma separated) which would be part of the essential section. This would // allow to project only the required fields rather than getting entire content. // Default is to fetch all the fields in the essentials section. Select *string // Filter by severity. Default value is select all. Severity *Severity // Filter the alerts list by the Smart Group Id. Default value is none. SmartGroupID *string // Sort the query results by input field, Default value is 'lastModifiedDateTime'. SortBy *AlertsSortByFields // Sort the query results order in either ascending or descending. Default value is 'desc' for time fields and 'asc' for others. SortOrder *SortOrder // Filter by target resource( which is full ARM ID) Default value is select all. TargetResource *string // Filter by target resource group name. Default value is select all. TargetResourceGroup *string // Filter by target resource type. Default value is select all. TargetResourceType *string // Filter by time range by below listed values. Default value is 1 day. TimeRange *TimeRange }
AlertsClientGetAllOptions contains the optional parameters for the AlertsClient.NewGetAllPager method.
type AlertsClientGetAllResponse ¶ added in v0.3.0
type AlertsClientGetAllResponse struct { // List the alerts. AlertsList }
AlertsClientGetAllResponse contains the response from method AlertsClient.NewGetAllPager.
type AlertsClientGetByIDOptions ¶ added in v0.3.0
type AlertsClientGetByIDOptions struct { }
AlertsClientGetByIDOptions contains the optional parameters for the AlertsClient.GetByID method.
type AlertsClientGetByIDResponse ¶ added in v0.3.0
type AlertsClientGetByIDResponse struct { // An alert created in alert management service. Alert }
AlertsClientGetByIDResponse contains the response from method AlertsClient.GetByID.
type AlertsClientGetHistoryOptions ¶ added in v0.3.0
type AlertsClientGetHistoryOptions struct { }
AlertsClientGetHistoryOptions contains the optional parameters for the AlertsClient.GetHistory method.
type AlertsClientGetHistoryResponse ¶ added in v0.3.0
type AlertsClientGetHistoryResponse struct { // Alert Modification details AlertModification }
AlertsClientGetHistoryResponse contains the response from method AlertsClient.GetHistory.
type AlertsClientGetSummaryOptions ¶ added in v0.3.0
type AlertsClientGetSummaryOptions struct { // Filter by specific alert rule. Default value is to select all. AlertRule *string // Filter by state of the alert instance. Default value is to select all. AlertState *AlertState // Filter by custom time range in the format / where time is in (ISO-8601 format)'. Permissible values is within 30 days from // query time. Either timeRange or customTimeRange could be used but not both. // Default is none. CustomTimeRange *string // Include count of the SmartGroups as part of the summary. Default value is 'false'. IncludeSmartGroupsCount *bool // Filter by monitor condition which is either 'Fired' or 'Resolved'. Default value is to select all. MonitorCondition *MonitorCondition // Filter by monitor service which generates the alert instance. Default value is select all. MonitorService *MonitorService // Filter by severity. Default value is select all. Severity *Severity // Filter by target resource( which is full ARM ID) Default value is select all. TargetResource *string // Filter by target resource group name. Default value is select all. TargetResourceGroup *string // Filter by target resource type. Default value is select all. TargetResourceType *string // Filter by time range by below listed values. Default value is 1 day. TimeRange *TimeRange }
AlertsClientGetSummaryOptions contains the optional parameters for the AlertsClient.GetSummary method.
type AlertsClientGetSummaryResponse ¶ added in v0.3.0
type AlertsClientGetSummaryResponse struct { // Summary of alerts based on the input filters and 'groupby' parameters. AlertsSummary }
AlertsClientGetSummaryResponse contains the response from method AlertsClient.GetSummary.
type AlertsClientMetaDataOptions ¶ added in v0.3.0
type AlertsClientMetaDataOptions struct { }
AlertsClientMetaDataOptions contains the optional parameters for the AlertsClient.MetaData method.
type AlertsClientMetaDataResponse ¶ added in v0.3.0
type AlertsClientMetaDataResponse struct { // alert meta data information. AlertsMetaData }
AlertsClientMetaDataResponse contains the response from method AlertsClient.MetaData.
type AlertsList ¶
type AlertsList struct { // URL to fetch the next set of alerts. NextLink *string // List of alerts Value []*Alert }
AlertsList - List the alerts.
func (AlertsList) MarshalJSON ¶
func (a AlertsList) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AlertsList.
func (*AlertsList) UnmarshalJSON ¶ added in v0.7.0
func (a *AlertsList) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AlertsList.
type AlertsMetaData ¶
type AlertsMetaData struct { // alert meta data property bag Properties AlertsMetaDataPropertiesClassification }
AlertsMetaData - alert meta data information.
func (AlertsMetaData) MarshalJSON ¶
func (a AlertsMetaData) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AlertsMetaData.
func (*AlertsMetaData) UnmarshalJSON ¶
func (a *AlertsMetaData) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AlertsMetaData.
type AlertsMetaDataProperties ¶
type AlertsMetaDataProperties struct { // REQUIRED; Identification of the information to be retrieved by API call MetadataIdentifier *MetadataIdentifier }
AlertsMetaDataProperties - alert meta data property bag
func (*AlertsMetaDataProperties) GetAlertsMetaDataProperties ¶
func (a *AlertsMetaDataProperties) GetAlertsMetaDataProperties() *AlertsMetaDataProperties
GetAlertsMetaDataProperties implements the AlertsMetaDataPropertiesClassification interface for type AlertsMetaDataProperties.
func (AlertsMetaDataProperties) MarshalJSON ¶ added in v0.7.0
func (a AlertsMetaDataProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AlertsMetaDataProperties.
func (*AlertsMetaDataProperties) UnmarshalJSON ¶
func (a *AlertsMetaDataProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AlertsMetaDataProperties.
type AlertsMetaDataPropertiesClassification ¶
type AlertsMetaDataPropertiesClassification interface { // GetAlertsMetaDataProperties returns the AlertsMetaDataProperties content of the underlying type. GetAlertsMetaDataProperties() *AlertsMetaDataProperties }
AlertsMetaDataPropertiesClassification provides polymorphic access to related types. Call the interface's GetAlertsMetaDataProperties() method to access the common type. Use a type switch to determine the concrete type. The possible types are: - *AlertsMetaDataProperties, *MonitorServiceList
type AlertsSortByFields ¶
type AlertsSortByFields string
const ( AlertsSortByFieldsAlertState AlertsSortByFields = "alertState" AlertsSortByFieldsLastModifiedDateTime AlertsSortByFields = "lastModifiedDateTime" AlertsSortByFieldsMonitorCondition AlertsSortByFields = "monitorCondition" AlertsSortByFieldsName AlertsSortByFields = "name" AlertsSortByFieldsSeverity AlertsSortByFields = "severity" AlertsSortByFieldsStartDateTime AlertsSortByFields = "startDateTime" AlertsSortByFieldsTargetResource AlertsSortByFields = "targetResource" AlertsSortByFieldsTargetResourceGroup AlertsSortByFields = "targetResourceGroup" AlertsSortByFieldsTargetResourceName AlertsSortByFields = "targetResourceName" AlertsSortByFieldsTargetResourceType AlertsSortByFields = "targetResourceType" )
func PossibleAlertsSortByFieldsValues ¶
func PossibleAlertsSortByFieldsValues() []AlertsSortByFields
PossibleAlertsSortByFieldsValues returns the possible values for the AlertsSortByFields const type.
type AlertsSummary ¶
type AlertsSummary struct { // Group the result set. Properties *AlertsSummaryGroup // READ-ONLY; Azure resource Id ID *string // READ-ONLY; Azure resource name Name *string // READ-ONLY; Azure resource type Type *string }
AlertsSummary - Summary of alerts based on the input filters and 'groupby' parameters.
func (AlertsSummary) MarshalJSON ¶
func (a AlertsSummary) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AlertsSummary.
func (*AlertsSummary) UnmarshalJSON ¶
func (a *AlertsSummary) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AlertsSummary.
type AlertsSummaryGroup ¶
type AlertsSummaryGroup struct { // Name of the field aggregated Groupedby *string // Total count of the smart groups. SmartGroupsCount *int64 // Total count of the result set. Total *int64 // List of the items Values []*AlertsSummaryGroupItem }
AlertsSummaryGroup - Group the result set.
func (AlertsSummaryGroup) MarshalJSON ¶
func (a AlertsSummaryGroup) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AlertsSummaryGroup.
func (*AlertsSummaryGroup) UnmarshalJSON ¶ added in v0.7.0
func (a *AlertsSummaryGroup) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AlertsSummaryGroup.
type AlertsSummaryGroupByFields ¶
type AlertsSummaryGroupByFields string
const ( AlertsSummaryGroupByFieldsAlertRule AlertsSummaryGroupByFields = "alertRule" AlertsSummaryGroupByFieldsAlertState AlertsSummaryGroupByFields = "alertState" AlertsSummaryGroupByFieldsMonitorCondition AlertsSummaryGroupByFields = "monitorCondition" AlertsSummaryGroupByFieldsMonitorService AlertsSummaryGroupByFields = "monitorService" AlertsSummaryGroupByFieldsSeverity AlertsSummaryGroupByFields = "severity" AlertsSummaryGroupByFieldsSignalType AlertsSummaryGroupByFields = "signalType" )
func PossibleAlertsSummaryGroupByFieldsValues ¶
func PossibleAlertsSummaryGroupByFieldsValues() []AlertsSummaryGroupByFields
PossibleAlertsSummaryGroupByFieldsValues returns the possible values for the AlertsSummaryGroupByFields const type.
type AlertsSummaryGroupItem ¶
type AlertsSummaryGroupItem struct { // Count of the aggregated field Count *int64 // Name of the field aggregated Groupedby *string // Value of the aggregated field Name *string // List of the items Values []*AlertsSummaryGroupItem }
AlertsSummaryGroupItem - Alerts summary group item
func (AlertsSummaryGroupItem) MarshalJSON ¶
func (a AlertsSummaryGroupItem) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type AlertsSummaryGroupItem.
func (*AlertsSummaryGroupItem) UnmarshalJSON ¶ added in v0.7.0
func (a *AlertsSummaryGroupItem) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type AlertsSummaryGroupItem.
type ClientFactory ¶ added in v0.8.0
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 ¶ added in v0.8.0
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.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*ClientFactory) NewAlertProcessingRulesClient ¶ added in v0.8.0
func (c *ClientFactory) NewAlertProcessingRulesClient() *AlertProcessingRulesClient
NewAlertProcessingRulesClient creates a new instance of AlertProcessingRulesClient.
func (*ClientFactory) NewAlertRuleRecommendationsClient ¶ added in v0.10.0
func (c *ClientFactory) NewAlertRuleRecommendationsClient() *AlertRuleRecommendationsClient
NewAlertRuleRecommendationsClient creates a new instance of AlertRuleRecommendationsClient.
func (*ClientFactory) NewAlertsClient ¶ added in v0.8.0
func (c *ClientFactory) NewAlertsClient() *AlertsClient
NewAlertsClient creates a new instance of AlertsClient.
func (*ClientFactory) NewOperationsClient ¶ added in v0.8.0
func (c *ClientFactory) NewOperationsClient() *OperationsClient
NewOperationsClient creates a new instance of OperationsClient.
func (*ClientFactory) NewPrometheusRuleGroupsClient ¶ added in v0.10.0
func (c *ClientFactory) NewPrometheusRuleGroupsClient() *PrometheusRuleGroupsClient
NewPrometheusRuleGroupsClient creates a new instance of PrometheusRuleGroupsClient.
func (*ClientFactory) NewSmartGroupsClient ¶ added in v0.8.0
func (c *ClientFactory) NewSmartGroupsClient() *SmartGroupsClient
NewSmartGroupsClient creates a new instance of SmartGroupsClient.
func (*ClientFactory) NewTenantActivityLogAlertsClient ¶ added in v0.10.0
func (c *ClientFactory) NewTenantActivityLogAlertsClient() *TenantActivityLogAlertsClient
NewTenantActivityLogAlertsClient creates a new instance of TenantActivityLogAlertsClient.
type Comments ¶ added in v0.10.0
type Comments struct {
Comments *string
}
Comments - Change alert state reason
func (Comments) MarshalJSON ¶ added in v0.10.0
MarshalJSON implements the json.Marshaller interface for type Comments.
func (*Comments) UnmarshalJSON ¶ added in v0.10.0
UnmarshalJSON implements the json.Unmarshaller interface for type Comments.
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 ¶
MarshalJSON implements the json.Marshaller interface for type Condition.
func (*Condition) UnmarshalJSON ¶ added in v0.7.0
UnmarshalJSON implements the json.Unmarshaller interface for type Condition.
type CreatedByType ¶ added in v0.3.0
type CreatedByType string
CreatedByType - The type of identity that created the resource.
const ( CreatedByTypeApplication CreatedByType = "Application" CreatedByTypeKey CreatedByType = "Key" CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" CreatedByTypeUser CreatedByType = "User" )
func PossibleCreatedByTypeValues ¶ added in v0.3.0
func PossibleCreatedByTypeValues() []CreatedByType
PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type.
type DailyRecurrence ¶ added in v0.3.0
type DailyRecurrence struct { // REQUIRED; Specifies when the recurrence should be applied. RecurrenceType *RecurrenceType // End time for recurrence. EndTime *string // Start time for recurrence. StartTime *string }
DailyRecurrence - Daily recurrence object.
func (*DailyRecurrence) GetRecurrence ¶ added in v0.3.0
func (d *DailyRecurrence) GetRecurrence() *Recurrence
GetRecurrence implements the RecurrenceClassification interface for type DailyRecurrence.
func (DailyRecurrence) MarshalJSON ¶ added in v0.3.0
func (d DailyRecurrence) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type DailyRecurrence.
func (*DailyRecurrence) UnmarshalJSON ¶ added in v0.3.0
func (d *DailyRecurrence) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type DailyRecurrence.
type DaysOfWeek ¶ added in v0.3.0
type DaysOfWeek string
DaysOfWeek - Days of week.
const ( DaysOfWeekFriday DaysOfWeek = "Friday" DaysOfWeekMonday DaysOfWeek = "Monday" DaysOfWeekSaturday DaysOfWeek = "Saturday" DaysOfWeekSunday DaysOfWeek = "Sunday" DaysOfWeekThursday DaysOfWeek = "Thursday" DaysOfWeekTuesday DaysOfWeek = "Tuesday" DaysOfWeekWednesday DaysOfWeek = "Wednesday" )
func PossibleDaysOfWeekValues ¶ added in v0.3.0
func PossibleDaysOfWeekValues() []DaysOfWeek
PossibleDaysOfWeekValues returns the possible values for the DaysOfWeek const type.
type Essentials ¶
type Essentials struct { // Action status ActionStatus *ActionStatus // Alert description. Description *string // Target ARM resource, on which alert got created. TargetResource *string // Resource group of target ARM resource, on which alert got created. TargetResourceGroup *string // Name of the target ARM resource name, on which alert got created. TargetResourceName *string // Resource type of target ARM resource, on which alert got created. TargetResourceType *string // READ-ONLY; Rule(monitor) which fired alert instance. Depending on the monitor service, this would be ARM id or name of // the rule. AlertRule *string // READ-ONLY; Alert object state, which can be modified by the user. AlertState *AlertState // READ-ONLY; Last modification time(ISO-8601 format) of alert instance. LastModifiedDateTime *time.Time // READ-ONLY; User who last modified the alert, in case of monitor service updates user would be 'system', otherwise name // of the user. LastModifiedUserName *string // READ-ONLY; Condition of the rule at the monitor service. It represents whether the underlying conditions have crossed the // defined alert rule thresholds. MonitorCondition *MonitorCondition // READ-ONLY; Resolved time(ISO-8601 format) of alert instance. This will be updated when monitor service resolves the alert // instance because the rule condition is no longer met. MonitorConditionResolvedDateTime *time.Time // READ-ONLY; Monitor service on which the rule(monitor) is set. MonitorService *MonitorService // READ-ONLY; Severity of alert Sev0 being highest and Sev4 being lowest. Severity *Severity // READ-ONLY; The type of signal the alert is based on, which could be metrics, logs or activity logs. SignalType *SignalType // READ-ONLY; Unique Id of the smart group SmartGroupID *string // READ-ONLY; Verbose reason describing the reason why this alert instance is added to a smart group SmartGroupingReason *string // READ-ONLY; Unique Id created by monitor service for each alert instance. This could be used to track the issue at the monitor // service, in case of Nagios, Zabbix, SCOM etc. SourceCreatedID *string // READ-ONLY; Creation time(ISO-8601 format) of alert instance. StartDateTime *time.Time }
Essentials - This object contains consistent fields across different monitor services.
func (Essentials) MarshalJSON ¶
func (e Essentials) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type Essentials.
func (*Essentials) UnmarshalJSON ¶
func (e *Essentials) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type Essentials.
type Field ¶ added in v0.3.0
type Field string
Field - Field for a given condition.
const ( FieldAlertContext Field = "AlertContext" FieldAlertRuleID Field = "AlertRuleId" FieldAlertRuleName Field = "AlertRuleName" FieldDescription Field = "Description" FieldMonitorCondition Field = "MonitorCondition" FieldMonitorService Field = "MonitorService" FieldSeverity Field = "Severity" FieldSignalType Field = "SignalType" FieldTargetResource Field = "TargetResource" FieldTargetResourceGroup Field = "TargetResourceGroup" FieldTargetResourceType Field = "TargetResourceType" )
func PossibleFieldValues ¶ added in v0.3.0
func PossibleFieldValues() []Field
PossibleFieldValues returns the possible values for the Field const type.
type Identifier ¶
type Identifier string
const (
IdentifierMonitorServiceList Identifier = "MonitorServiceList"
)
func PossibleIdentifierValues ¶
func PossibleIdentifierValues() []Identifier
PossibleIdentifierValues returns the possible values for the Identifier const type.
type MetadataIdentifier ¶
type MetadataIdentifier string
MetadataIdentifier - Identification of the information to be retrieved by API call
const (
MetadataIdentifierMonitorServiceList MetadataIdentifier = "MonitorServiceList"
)
func PossibleMetadataIdentifierValues ¶
func PossibleMetadataIdentifierValues() []MetadataIdentifier
PossibleMetadataIdentifierValues returns the possible values for the MetadataIdentifier const type.
type MonitorCondition ¶
type MonitorCondition string
const ( MonitorConditionFired MonitorCondition = "Fired" MonitorConditionResolved MonitorCondition = "Resolved" )
func PossibleMonitorConditionValues ¶
func PossibleMonitorConditionValues() []MonitorCondition
PossibleMonitorConditionValues returns the possible values for the MonitorCondition const type.
type MonitorService ¶
type MonitorService string
const ( MonitorServiceActivityLogAdministrative MonitorService = "ActivityLog Administrative" MonitorServiceActivityLogAutoscale MonitorService = "ActivityLog Autoscale" MonitorServiceActivityLogPolicy MonitorService = "ActivityLog Policy" MonitorServiceActivityLogRecommendation MonitorService = "ActivityLog Recommendation" MonitorServiceActivityLogSecurity MonitorService = "ActivityLog Security" MonitorServiceApplicationInsights MonitorService = "Application Insights" MonitorServiceLogAnalytics MonitorService = "Log Analytics" MonitorServiceNagios MonitorService = "Nagios" MonitorServicePlatform MonitorService = "Platform" MonitorServiceSCOM MonitorService = "SCOM" MonitorServiceServiceHealth MonitorService = "ServiceHealth" MonitorServiceSmartDetector MonitorService = "SmartDetector" MonitorServiceVMInsights MonitorService = "VM Insights" MonitorServiceZabbix MonitorService = "Zabbix" )
func PossibleMonitorServiceValues ¶
func PossibleMonitorServiceValues() []MonitorService
PossibleMonitorServiceValues returns the possible values for the MonitorService const type.
type MonitorServiceDetails ¶
type MonitorServiceDetails struct { // Monitor service display name DisplayName *string // Monitor service name Name *string }
MonitorServiceDetails - Details of a monitor service
func (MonitorServiceDetails) MarshalJSON ¶ added in v0.7.0
func (m MonitorServiceDetails) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type MonitorServiceDetails.
func (*MonitorServiceDetails) UnmarshalJSON ¶ added in v0.7.0
func (m *MonitorServiceDetails) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type MonitorServiceDetails.
type MonitorServiceList ¶
type MonitorServiceList struct { // REQUIRED; Array of operations Data []*MonitorServiceDetails // REQUIRED; Identification of the information to be retrieved by API call MetadataIdentifier *MetadataIdentifier }
MonitorServiceList - Monitor service details
func (*MonitorServiceList) GetAlertsMetaDataProperties ¶ added in v0.3.0
func (m *MonitorServiceList) GetAlertsMetaDataProperties() *AlertsMetaDataProperties
GetAlertsMetaDataProperties implements the AlertsMetaDataPropertiesClassification interface for type MonitorServiceList.
func (MonitorServiceList) MarshalJSON ¶
func (m MonitorServiceList) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type MonitorServiceList.
func (*MonitorServiceList) UnmarshalJSON ¶
func (m *MonitorServiceList) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type MonitorServiceList.
type MonthlyRecurrence ¶ added in v0.3.0
type MonthlyRecurrence struct { // REQUIRED; Specifies the values for monthly recurrence pattern. DaysOfMonth []*int32 // REQUIRED; Specifies when the recurrence should be applied. RecurrenceType *RecurrenceType // End time for recurrence. EndTime *string // Start time for recurrence. StartTime *string }
MonthlyRecurrence - Monthly recurrence object.
func (*MonthlyRecurrence) GetRecurrence ¶ added in v0.3.0
func (m *MonthlyRecurrence) GetRecurrence() *Recurrence
GetRecurrence implements the RecurrenceClassification interface for type MonthlyRecurrence.
func (MonthlyRecurrence) MarshalJSON ¶ added in v0.3.0
func (m MonthlyRecurrence) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type MonthlyRecurrence.
func (*MonthlyRecurrence) UnmarshalJSON ¶ added in v0.3.0
func (m *MonthlyRecurrence) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type MonthlyRecurrence.
type Operation ¶
type Operation struct { // Properties of the operation Display *OperationDisplay // Name of the operation Name *string // Origin of the operation Origin *string }
Operation provided by provider
func (Operation) MarshalJSON ¶ added in v0.7.0
MarshalJSON implements the json.Marshaller interface for type Operation.
func (*Operation) UnmarshalJSON ¶ added in v0.7.0
UnmarshalJSON implements the json.Unmarshaller interface for type Operation.
type OperationDisplay ¶
type OperationDisplay struct { // Description of the operation Description *string // Operation name Operation *string // Provider name Provider *string // Resource name Resource *string }
OperationDisplay - Properties of the operation
func (OperationDisplay) MarshalJSON ¶ added in v0.7.0
func (o OperationDisplay) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type OperationDisplay.
func (*OperationDisplay) UnmarshalJSON ¶ added in v0.7.0
func (o *OperationDisplay) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay.
type OperationsClient ¶
type OperationsClient struct {
// contains filtered or unexported fields
}
OperationsClient contains the methods for the Operations group. Don't use this type directly, use NewOperationsClient() instead.
func NewOperationsClient ¶
func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error)
NewOperationsClient creates a new instance of OperationsClient with the specified values.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*OperationsClient) NewListPager ¶ added in v0.5.0
func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse]
NewListPager - List all operations available through Azure Alerts Management Resource Provider.
Generated from API version 2019-05-05-preview
- options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2019-05-05-preview/examples/Operations_List.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewOperationsClient().NewListPager(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.OperationsList = armalertsmanagement.OperationsList{ // Value: []*armalertsmanagement.Operation{ // { // Name: to.Ptr("Microsoft.AlertsManagement/register/action"), // Display: &armalertsmanagement.OperationDisplay{ // Description: to.Ptr("Subscription Registration Action"), // Operation: to.Ptr("Subscription Registration Action"), // Provider: to.Ptr("Microsoft.AlertsManagement"), // Resource: to.Ptr("Subscription"), // }, // }, // { // Name: to.Ptr("Microsoft.AlertsManagement/register/action"), // Display: &armalertsmanagement.OperationDisplay{ // Description: to.Ptr("Registers the subscription for the Microsoft Alerts Management"), // Operation: to.Ptr("Register subscription"), // Provider: to.Ptr("Microsoft.AlertsManagement"), // Resource: to.Ptr("register"), // }, // }, // { // Name: to.Ptr("Microsoft.AlertsManagement/alerts/read"), // Display: &armalertsmanagement.OperationDisplay{ // Description: to.Ptr("Get all the alerts for the input filters."), // Operation: to.Ptr("Read alerts"), // Provider: to.Ptr("Microsoft.AlertsManagement"), // Resource: to.Ptr("alerts"), // }, // }, // { // Name: to.Ptr("Microsoft.AlertsManagement/alerts/changestate/action"), // Display: &armalertsmanagement.OperationDisplay{ // Description: to.Ptr("Change the state of the alert."), // Operation: to.Ptr("Resolve alerts"), // Provider: to.Ptr("Microsoft.AlertsManagement"), // Resource: to.Ptr("alerts"), // }, // }, // { // Name: to.Ptr("Microsoft.AlertsManagement/alerts/history/read"), // Display: &armalertsmanagement.OperationDisplay{ // Description: to.Ptr("Get history of the alert"), // Operation: to.Ptr("Read alert history"), // Provider: to.Ptr("Microsoft.AlertsManagement"), // Resource: to.Ptr("alerts"), // }, // }, // { // Name: to.Ptr("Microsoft.AlertsManagement/smartDetectorAlertRules/write"), // Display: &armalertsmanagement.OperationDisplay{ // Description: to.Ptr("Create or update Smart Detector alert rule in a given subscription"), // Operation: to.Ptr("Create Smart Detector alert rule"), // Provider: to.Ptr("Microsoft.AlertsManagement"), // Resource: to.Ptr("smartDetectorAlertRules"), // }, // }, // { // Name: to.Ptr("Microsoft.AlertsManagement/smartDetectorAlertRules/read"), // Display: &armalertsmanagement.OperationDisplay{ // Description: to.Ptr("Get all the Smart Detector alert rules for the input filters"), // Operation: to.Ptr("Read Smart Detector alert rules"), // Provider: to.Ptr("Microsoft.AlertsManagement"), // Resource: to.Ptr("smartDetectorAlertRules"), // }, // }, // { // Name: to.Ptr("Microsoft.AlertsManagement/smartDetectorAlertRules/delete"), // Display: &armalertsmanagement.OperationDisplay{ // Description: to.Ptr("Delete Smart Detector alert rule in a given subscription"), // Operation: to.Ptr("Delete Smart Detector alert rule"), // Provider: to.Ptr("Microsoft.AlertsManagement"), // Resource: to.Ptr("smartDetectorAlertRules"), // }, // }, // { // Name: to.Ptr("Microsoft.AlertsManagement/resourceHealthAlertRules/write"), // Display: &armalertsmanagement.OperationDisplay{ // Description: to.Ptr("Create or update Resource Health alert rule in a given subscription"), // Operation: to.Ptr("Create Resource Health alert rule"), // Provider: to.Ptr("Microsoft.AlertsManagement"), // Resource: to.Ptr("resourceHealthAlertRules"), // }, // }, // { // Name: to.Ptr("Microsoft.AlertsManagement/resourceHealthAlertRules/read"), // Display: &armalertsmanagement.OperationDisplay{ // Description: to.Ptr("Get all the Resource Health alert rules for the input filters"), // Operation: to.Ptr("Read Resource Health alert rules"), // Provider: to.Ptr("Microsoft.AlertsManagement"), // Resource: to.Ptr("resourceHealthAlertRules"), // }, // }, // { // Name: to.Ptr("Microsoft.AlertsManagement/resourceHealthAlertRules/delete"), // Display: &armalertsmanagement.OperationDisplay{ // Description: to.Ptr("Delete Resource Health alert rule in a given subscription"), // Operation: to.Ptr("Delete Resource Health alert rule"), // Provider: to.Ptr("Microsoft.AlertsManagement"), // Resource: to.Ptr("resourceHealthAlertRules"), // }, // }, // { // Name: to.Ptr("Microsoft.AlertsManagement/migrateFromSmartDetection/read"), // Display: &armalertsmanagement.OperationDisplay{ // Description: to.Ptr("Get the status of an asynchronous Smart Detection to smart alerts migration process"), // Operation: to.Ptr("Get Smart Detection Migration status"), // Provider: to.Ptr("Microsoft.AlertsManagement"), // Resource: to.Ptr("migrateFromSmartDetection"), // }, // }, // { // Name: to.Ptr("Microsoft.AlertsManagement/migrateFromSmartDetection/action"), // Display: &armalertsmanagement.OperationDisplay{ // Description: to.Ptr("Starts an asynchronous migration process of Smart Detection to smart alerts in an Application Insights resource"), // Operation: to.Ptr("Migrate From Smart Detection"), // Provider: to.Ptr("Microsoft.AlertsManagement"), // Resource: to.Ptr("migrateFromSmartDetection"), // }, // }, // { // Name: to.Ptr("Microsoft.AlertsManagement/alertsSummary/read"), // Display: &armalertsmanagement.OperationDisplay{ // Description: to.Ptr("Get the summary of alerts"), // Operation: to.Ptr("Read alerts summary"), // Provider: to.Ptr("Microsoft.AlertsManagement"), // Resource: to.Ptr("alertsSummary"), // }, // }, // { // Name: to.Ptr("Microsoft.AlertsManagement/smartGroups/read"), // Display: &armalertsmanagement.OperationDisplay{ // Description: to.Ptr("Get all the smart groups for the input filters"), // Operation: to.Ptr("Read smart groups"), // Provider: to.Ptr("Microsoft.AlertsManagement"), // Resource: to.Ptr("smartGroups"), // }, // }, // { // Name: to.Ptr("Microsoft.AlertsManagement/smartGroups/changestate/action"), // Display: &armalertsmanagement.OperationDisplay{ // Description: to.Ptr("Change the state of the smart group"), // Operation: to.Ptr("Read smart groups"), // Provider: to.Ptr("Microsoft.AlertsManagement"), // Resource: to.Ptr("smartGroups"), // }, // }, // { // Name: to.Ptr("Microsoft.AlertsManagement/smartGroups/history/read"), // Display: &armalertsmanagement.OperationDisplay{ // Description: to.Ptr("Get history of the smart group"), // Operation: to.Ptr("Read smart group history"), // Provider: to.Ptr("Microsoft.AlertsManagement"), // Resource: to.Ptr("smartGroups"), // }, // }, // { // Name: to.Ptr("Microsoft.AlertsManagement/actionRules/read"), // Display: &armalertsmanagement.OperationDisplay{ // Description: to.Ptr("Get all the alert processing rules for the input filters."), // Operation: to.Ptr("Read action rules"), // Provider: to.Ptr("Microsoft.AlertsManagement"), // Resource: to.Ptr("actionRules"), // }, // }, // { // Name: to.Ptr("Microsoft.AlertsManagement/actionRules/write"), // Display: &armalertsmanagement.OperationDisplay{ // Description: to.Ptr("Create or update alert processing rule in a given subscription"), // Operation: to.Ptr("Write action rule"), // Provider: to.Ptr("Microsoft.AlertsManagement"), // Resource: to.Ptr("actionRules"), // }, // }, // { // Name: to.Ptr("Microsoft.AlertsManagement/actionRules/delete"), // Display: &armalertsmanagement.OperationDisplay{ // Description: to.Ptr("Delete alert processing rule in a given subscription."), // Operation: to.Ptr("Delete action rule"), // Provider: to.Ptr("Microsoft.AlertsManagement"), // Resource: to.Ptr("actionRules"), // }, // }, // { // Name: to.Ptr("Microsoft.AlertsManagement/alertsMetaData/read"), // Display: &armalertsmanagement.OperationDisplay{ // Description: to.Ptr("Get alerts meta data for the input parameter."), // Operation: to.Ptr("Read alerts meta data"), // Provider: to.Ptr("Microsoft.AlertsManagement"), // Resource: to.Ptr("Microsoft.AlertsManagement/alertsMetaData"), // }, // }, // { // Name: to.Ptr("Microsoft.AlertsManagement/Operations/read"), // Display: &armalertsmanagement.OperationDisplay{ // Description: to.Ptr("Reads the operations provided"), // Operation: to.Ptr("Read operations"), // Provider: to.Ptr("Microsoft.AlertsManagement"), // Resource: to.Ptr("operations"), // }, // }}, // } } }
Output:
type OperationsClientListOptions ¶ added in v0.3.0
type OperationsClientListOptions struct { }
OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method.
type OperationsClientListResponse ¶ added in v0.3.0
type OperationsClientListResponse struct { // Lists the operations available in the AlertsManagement RP. OperationsList }
OperationsClientListResponse contains the response from method OperationsClient.NewListPager.
type OperationsList ¶
type OperationsList struct { // REQUIRED; Array of operations Value []*Operation // URL to fetch the next set of alerts. NextLink *string }
OperationsList - Lists the operations available in the AlertsManagement RP.
func (OperationsList) MarshalJSON ¶
func (o OperationsList) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type OperationsList.
func (*OperationsList) UnmarshalJSON ¶ added in v0.7.0
func (o *OperationsList) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type OperationsList.
type Operator ¶
type Operator string
Operator - Operator for a given condition.
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 ¶ added in v0.7.0
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 ¶ added in v0.7.0
func (p PatchProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type PatchProperties.
func (*PatchProperties) UnmarshalJSON ¶ added in v0.7.0
func (p *PatchProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type PatchProperties.
type PrometheusRule ¶ added in v0.10.0
type PrometheusRule struct { // REQUIRED; the expression to run for the rule. Expression *string // The array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. Only // relevant for alerts. Actions []*PrometheusRuleGroupAction // the name of the alert rule. Alert *string // annotations for rule group. Only relevant for alerts. Annotations map[string]*string // the flag that indicates whether the Prometheus rule is enabled. Enabled *bool // the amount of time alert must be active before firing. Only relevant for alerts. For *string // labels for rule group. Only relevant for alerts. Labels map[string]*string // the name of the recording rule. Record *string // defines the configuration for resolving fired alerts. Only relevant for alerts. ResolveConfiguration *PrometheusRuleResolveConfiguration // the severity of the alerts fired by the rule. Only relevant for alerts. Severity *int32 }
func (PrometheusRule) MarshalJSON ¶ added in v0.10.0
func (p PrometheusRule) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type PrometheusRule.
func (*PrometheusRule) UnmarshalJSON ¶ added in v0.10.0
func (p *PrometheusRule) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type PrometheusRule.
type PrometheusRuleGroupAction ¶ added in v0.10.0
type PrometheusRuleGroupAction struct { // The resource id of the action group to use. ActionGroupID *string // The properties of an action group object. ActionProperties map[string]*string }
PrometheusRuleGroupAction - An alert action. Only relevant for alerts.
func (PrometheusRuleGroupAction) MarshalJSON ¶ added in v0.10.0
func (p PrometheusRuleGroupAction) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type PrometheusRuleGroupAction.
func (*PrometheusRuleGroupAction) UnmarshalJSON ¶ added in v0.10.0
func (p *PrometheusRuleGroupAction) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type PrometheusRuleGroupAction.
type PrometheusRuleGroupProperties ¶ added in v0.10.0
type PrometheusRuleGroupProperties struct { // REQUIRED; defines the rules in the Prometheus rule group. Rules []*PrometheusRule // REQUIRED; the list of resource id's that this rule group is scoped to. Scopes []*string // the cluster name of the rule group evaluation. ClusterName *string // the description of the Prometheus rule group that will be included in the alert email. Description *string // the flag that indicates whether the Prometheus rule group is enabled. Enabled *bool // the interval in which to run the Prometheus rule group represented in ISO 8601 duration format. Should be between 1 and // 15 minutes Interval *string }
PrometheusRuleGroupProperties - An alert rule.
func (PrometheusRuleGroupProperties) MarshalJSON ¶ added in v0.10.0
func (p PrometheusRuleGroupProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type PrometheusRuleGroupProperties.
func (*PrometheusRuleGroupProperties) UnmarshalJSON ¶ added in v0.10.0
func (p *PrometheusRuleGroupProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type PrometheusRuleGroupProperties.
type PrometheusRuleGroupResource ¶ added in v0.10.0
type PrometheusRuleGroupResource struct { // REQUIRED; The geo-location where the resource lives Location *string // REQUIRED; The Prometheus rule group properties of the resource. Properties *PrometheusRuleGroupProperties // 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 }
PrometheusRuleGroupResource - The Prometheus rule group resource.
func (PrometheusRuleGroupResource) MarshalJSON ¶ added in v0.10.0
func (p PrometheusRuleGroupResource) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type PrometheusRuleGroupResource.
func (*PrometheusRuleGroupResource) UnmarshalJSON ¶ added in v0.10.0
func (p *PrometheusRuleGroupResource) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type PrometheusRuleGroupResource.
type PrometheusRuleGroupResourceCollection ¶ added in v0.10.0
type PrometheusRuleGroupResourceCollection struct { // the values for the alert rule resources. Value []*PrometheusRuleGroupResource }
PrometheusRuleGroupResourceCollection - Represents a collection of alert rule resources.
func (PrometheusRuleGroupResourceCollection) MarshalJSON ¶ added in v0.10.0
func (p PrometheusRuleGroupResourceCollection) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type PrometheusRuleGroupResourceCollection.
func (*PrometheusRuleGroupResourceCollection) UnmarshalJSON ¶ added in v0.10.0
func (p *PrometheusRuleGroupResourceCollection) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type PrometheusRuleGroupResourceCollection.
type PrometheusRuleGroupResourcePatch ¶ added in v0.10.0
type PrometheusRuleGroupResourcePatch struct { Properties *PrometheusRuleGroupResourcePatchProperties // Resource tags Tags map[string]*string }
PrometheusRuleGroupResourcePatch - The Prometheus rule group resource for patch operations.
func (PrometheusRuleGroupResourcePatch) MarshalJSON ¶ added in v0.10.0
func (p PrometheusRuleGroupResourcePatch) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type PrometheusRuleGroupResourcePatch.
func (*PrometheusRuleGroupResourcePatch) UnmarshalJSON ¶ added in v0.10.0
func (p *PrometheusRuleGroupResourcePatch) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type PrometheusRuleGroupResourcePatch.
type PrometheusRuleGroupResourcePatchProperties ¶ added in v0.10.0
type PrometheusRuleGroupResourcePatchProperties struct { // the flag that indicates whether the Prometheus rule group is enabled. Enabled *bool }
func (PrometheusRuleGroupResourcePatchProperties) MarshalJSON ¶ added in v0.10.0
func (p PrometheusRuleGroupResourcePatchProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type PrometheusRuleGroupResourcePatchProperties.
func (*PrometheusRuleGroupResourcePatchProperties) UnmarshalJSON ¶ added in v0.10.0
func (p *PrometheusRuleGroupResourcePatchProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type PrometheusRuleGroupResourcePatchProperties.
type PrometheusRuleGroupsClient ¶ added in v0.10.0
type PrometheusRuleGroupsClient struct {
// contains filtered or unexported fields
}
PrometheusRuleGroupsClient contains the methods for the PrometheusRuleGroups group. Don't use this type directly, use NewPrometheusRuleGroupsClient() instead.
func NewPrometheusRuleGroupsClient ¶ added in v0.10.0
func NewPrometheusRuleGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrometheusRuleGroupsClient, error)
NewPrometheusRuleGroupsClient creates a new instance of PrometheusRuleGroupsClient with the specified values.
- subscriptionID - The ID of the target subscription.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*PrometheusRuleGroupsClient) CreateOrUpdate ¶ added in v0.10.0
func (client *PrometheusRuleGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleGroupName string, parameters PrometheusRuleGroupResource, options *PrometheusRuleGroupsClientCreateOrUpdateOptions) (PrometheusRuleGroupsClientCreateOrUpdateResponse, error)
CreateOrUpdate - Create or update a Prometheus rule group definition. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2021-07-22-preview
- resourceGroupName - The name of the resource group. The name is case insensitive.
- ruleGroupName - The name of the rule group.
- parameters - The parameters of the rule group to create or update.
- options - PrometheusRuleGroupsClientCreateOrUpdateOptions contains the optional parameters for the PrometheusRuleGroupsClient.CreateOrUpdate method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/createOrUpdatePrometheusRuleGroup.json
package main import ( "context" "log" "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/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewPrometheusRuleGroupsClient().CreateOrUpdate(ctx, "promResourceGroup", "myPrometheusRuleGroup", armalertsmanagement.PrometheusRuleGroupResource{ Location: to.Ptr("East US"), Properties: &armalertsmanagement.PrometheusRuleGroupProperties{ Description: to.Ptr("This is the description of the first rule group"), Rules: []*armalertsmanagement.PrometheusRule{ { Expression: to.Ptr("histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))"), Labels: map[string]*string{ "team": to.Ptr("prod"), }, Record: to.Ptr("job_type:billing_jobs_duration_seconds:99p5m"), }, { Actions: []*armalertsmanagement.PrometheusRuleGroupAction{ { ActionGroupID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/promResourceGroup/providers/microsoft.insights/actiongroups/group2"), ActionProperties: map[string]*string{ "key11": to.Ptr("value11"), "key12": to.Ptr("value12"), }, }}, Alert: to.Ptr("Billing_Processing_Very_Slow"), Annotations: map[string]*string{ "annotationName1": to.Ptr("annotationValue1"), }, Expression: to.Ptr("job_type:billing_jobs_duration_seconds:99p5m > 30"), For: to.Ptr("PT5M"), Labels: map[string]*string{ "team": to.Ptr("prod"), }, ResolveConfiguration: &armalertsmanagement.PrometheusRuleResolveConfiguration{ AutoResolved: to.Ptr(true), TimeToResolve: to.Ptr("PT10M"), }, Severity: to.Ptr[int32](2), }}, Scopes: []*string{ to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/promResourceGroup/providers/microsoft.monitor/accounts/myMonitoringAccount")}, }, }, 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.PrometheusRuleGroupResource = armalertsmanagement.PrometheusRuleGroupResource{ // Type: to.Ptr("Microsoft.AlertsManagement/prometheusRuleGroups"), // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/promResourceGroup/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup"), // SystemData: &armalertsmanagement.SystemData{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09.000Z"); return t}()), // CreatedBy: to.Ptr("abc@microsoft.com"), // CreatedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09.000Z"); return t}()), // LastModifiedBy: to.Ptr("xyz@microsoft.com"), // LastModifiedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // }, // Location: to.Ptr("East US"), // Properties: &armalertsmanagement.PrometheusRuleGroupProperties{ // Description: to.Ptr("This is the description of the first rule group"), // Interval: to.Ptr("PT5M"), // Rules: []*armalertsmanagement.PrometheusRule{ // { // Expression: to.Ptr("histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))"), // Labels: map[string]*string{ // "team": to.Ptr("prod"), // }, // Record: to.Ptr("job_type:billing_jobs_duration_seconds:99p5m"), // }, // { // Actions: []*armalertsmanagement.PrometheusRuleGroupAction{ // { // ActionGroupID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/promResourceGroup/providers/microsoft.insights/actiongroups/group2"), // ActionProperties: map[string]*string{ // "key11": to.Ptr("value11"), // "key12": to.Ptr("value12"), // }, // }}, // Alert: to.Ptr("Billing_Processing_Very_Slow"), // Annotations: map[string]*string{ // "annotationName1": to.Ptr("annotationValue1"), // }, // Expression: to.Ptr("job_type:billing_jobs_duration_seconds:99p5m > 30"), // For: to.Ptr("PT5M"), // Labels: map[string]*string{ // "team": to.Ptr("prod"), // }, // ResolveConfiguration: &armalertsmanagement.PrometheusRuleResolveConfiguration{ // AutoResolved: to.Ptr(true), // TimeToResolve: to.Ptr("PT10M"), // }, // Severity: to.Ptr[int32](2), // }}, // Scopes: []*string{ // to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/promResourceGroup/providers/microsoft.monitor/accounts/myMonitoringAccount")}, // }, // } }
Output:
func (*PrometheusRuleGroupsClient) Delete ¶ added in v0.10.0
func (client *PrometheusRuleGroupsClient) Delete(ctx context.Context, resourceGroupName string, ruleGroupName string, options *PrometheusRuleGroupsClientDeleteOptions) (PrometheusRuleGroupsClientDeleteResponse, error)
Delete - Delete a Prometheus rule group definition. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2021-07-22-preview
- resourceGroupName - The name of the resource group. The name is case insensitive.
- ruleGroupName - The name of the rule group.
- options - PrometheusRuleGroupsClientDeleteOptions contains the optional parameters for the PrometheusRuleGroupsClient.Delete method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/deletePrometheusRuleGroup.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } _, err = clientFactory.NewPrometheusRuleGroupsClient().Delete(ctx, "promResourceGroup", "myPrometheusRuleGroup", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } }
Output:
func (*PrometheusRuleGroupsClient) Get ¶ added in v0.10.0
func (client *PrometheusRuleGroupsClient) Get(ctx context.Context, resourceGroupName string, ruleGroupName string, options *PrometheusRuleGroupsClientGetOptions) (PrometheusRuleGroupsClientGetResponse, error)
Get - Retrieve a Prometheus rule group definition. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2021-07-22-preview
- resourceGroupName - The name of the resource group. The name is case insensitive.
- ruleGroupName - The name of the rule group.
- options - PrometheusRuleGroupsClientGetOptions contains the optional parameters for the PrometheusRuleGroupsClient.Get method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/getPrometheusRuleGroup.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewPrometheusRuleGroupsClient().Get(ctx, "promResourceGroup", "myPrometheusRuleGroup", 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.PrometheusRuleGroupResource = armalertsmanagement.PrometheusRuleGroupResource{ // Type: to.Ptr("Microsoft.AlertsManagement/prometheusRuleGroups"), // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/promResourceGroup/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup"), // SystemData: &armalertsmanagement.SystemData{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09.000Z"); return t}()), // CreatedBy: to.Ptr("abc@microsoft.com"), // CreatedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09.000Z"); return t}()), // LastModifiedBy: to.Ptr("xyz@microsoft.com"), // LastModifiedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // }, // Location: to.Ptr("global"), // Properties: &armalertsmanagement.PrometheusRuleGroupProperties{ // Description: to.Ptr("This is the description of the first rule group"), // Rules: []*armalertsmanagement.PrometheusRule{ // { // Expression: to.Ptr("histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))"), // Record: to.Ptr("job_type:billing_jobs_duration_seconds:99p5m"), // }, // { // Actions: []*armalertsmanagement.PrometheusRuleGroupAction{ // { // ActionGroupID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/promResourceGroup/providers/microsoft.insights/actiongroups/group2"), // ActionProperties: map[string]*string{ // "key11": to.Ptr("value11"), // "key12": to.Ptr("value12"), // }, // }}, // Alert: to.Ptr("Billing_Processing_Very_Slow"), // Expression: to.Ptr("job_type:billing_jobs_duration_seconds:99p5m > 30"), // For: to.Ptr("5m"), // Labels: map[string]*string{ // "team": to.Ptr("prod"), // }, // ResolveConfiguration: &armalertsmanagement.PrometheusRuleResolveConfiguration{ // AutoResolved: to.Ptr(true), // TimeToResolve: to.Ptr("10m"), // }, // Severity: to.Ptr[int32](2), // }}, // Scopes: []*string{ // to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/promResourceGroup/providers/microsoft.monitor/accounts/myMonitoringAccount")}, // }, // } }
Output:
func (*PrometheusRuleGroupsClient) NewListByResourceGroupPager ¶ added in v0.10.0
func (client *PrometheusRuleGroupsClient) NewListByResourceGroupPager(resourceGroupName string, options *PrometheusRuleGroupsClientListByResourceGroupOptions) *runtime.Pager[PrometheusRuleGroupsClientListByResourceGroupResponse]
NewListByResourceGroupPager - Retrieve Prometheus rule group definitions in a resource group.
Generated from API version 2021-07-22-preview
- resourceGroupName - The name of the resource group. The name is case insensitive.
- options - PrometheusRuleGroupsClientListByResourceGroupOptions contains the optional parameters for the PrometheusRuleGroupsClient.NewListByResourceGroupPager method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/listPrometheusRuleGroups.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewPrometheusRuleGroupsClient().NewListByResourceGroupPager("promResourceGroup", 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.PrometheusRuleGroupResourceCollection = armalertsmanagement.PrometheusRuleGroupResourceCollection{ // Value: []*armalertsmanagement.PrometheusRuleGroupResource{ // { // Type: to.Ptr("Microsoft.AlertsManagement/prometheusRuleGroups"), // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/promResourceGroup/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup"), // SystemData: &armalertsmanagement.SystemData{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09.000Z"); return t}()), // CreatedBy: to.Ptr("abc@microsoft.com"), // CreatedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09.000Z"); return t}()), // LastModifiedBy: to.Ptr("xyz@microsoft.com"), // LastModifiedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // }, // Location: to.Ptr("East US"), // Properties: &armalertsmanagement.PrometheusRuleGroupProperties{ // Description: to.Ptr("This is the description of the first rule group"), // Rules: []*armalertsmanagement.PrometheusRule{ // { // Expression: to.Ptr("histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))"), // Record: to.Ptr("job_type:billing_jobs_duration_seconds:99p5m"), // }, // { // Actions: []*armalertsmanagement.PrometheusRuleGroupAction{ // { // ActionGroupID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), // ActionProperties: map[string]*string{ // "key11": to.Ptr("value11"), // "key12": to.Ptr("value12"), // }, // }}, // Alert: to.Ptr("Billing_Processing_Very_Slow"), // Expression: to.Ptr("job_type:billing_jobs_duration_seconds:99p5m > 30"), // For: to.Ptr("5m"), // Labels: map[string]*string{ // "team": to.Ptr("prod"), // }, // ResolveConfiguration: &armalertsmanagement.PrometheusRuleResolveConfiguration{ // AutoResolved: to.Ptr(true), // TimeToResolve: to.Ptr("10m"), // }, // Severity: to.Ptr[int32](2), // }}, // Scopes: []*string{ // to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/promResourceGroup/providers/microsoft.monitor/accounts/myMonitoringAccount")}, // }, // }}, // } } }
Output:
func (*PrometheusRuleGroupsClient) NewListBySubscriptionPager ¶ added in v0.10.0
func (client *PrometheusRuleGroupsClient) NewListBySubscriptionPager(options *PrometheusRuleGroupsClientListBySubscriptionOptions) *runtime.Pager[PrometheusRuleGroupsClientListBySubscriptionResponse]
NewListBySubscriptionPager - Retrieve Prometheus rule group definitions in a subscription.
Generated from API version 2021-07-22-preview
- options - PrometheusRuleGroupsClientListBySubscriptionOptions contains the optional parameters for the PrometheusRuleGroupsClient.NewListBySubscriptionPager method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/listSubscriptionPrometheusRuleGroups.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewPrometheusRuleGroupsClient().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.PrometheusRuleGroupResourceCollection = armalertsmanagement.PrometheusRuleGroupResourceCollection{ // Value: []*armalertsmanagement.PrometheusRuleGroupResource{ // { // Type: to.Ptr("Microsoft.AlertsManagement/prometheusRuleGroups"), // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/promResourceGroup/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup"), // SystemData: &armalertsmanagement.SystemData{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09.000Z"); return t}()), // CreatedBy: to.Ptr("abc@microsoft.com"), // CreatedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09.000Z"); return t}()), // LastModifiedBy: to.Ptr("xyz@microsoft.com"), // LastModifiedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // }, // Location: to.Ptr("East US"), // Properties: &armalertsmanagement.PrometheusRuleGroupProperties{ // Description: to.Ptr("This is the description of the first rule group"), // Rules: []*armalertsmanagement.PrometheusRule{ // { // Expression: to.Ptr("histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))"), // Record: to.Ptr("job_type:billing_jobs_duration_seconds:99p5m"), // }, // { // Actions: []*armalertsmanagement.PrometheusRuleGroupAction{ // { // ActionGroupID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/promResourceGroup/providers/microsoft.insights/actiongroups/group2"), // ActionProperties: map[string]*string{ // "key11": to.Ptr("value11"), // "key12": to.Ptr("value12"), // }, // }}, // Alert: to.Ptr("Billing_Processing_Very_Slow"), // Expression: to.Ptr("job_type:billing_jobs_duration_seconds:99p5m > 30"), // For: to.Ptr("5m"), // Labels: map[string]*string{ // "team": to.Ptr("prod"), // }, // ResolveConfiguration: &armalertsmanagement.PrometheusRuleResolveConfiguration{ // AutoResolved: to.Ptr(true), // TimeToResolve: to.Ptr("10m"), // }, // Severity: to.Ptr[int32](2), // }}, // Scopes: []*string{ // to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/promResourceGroup/providers/microsoft.monitor/accounts/monitoringAcount/myMonitoringAccount")}, // }, // }, // { // Type: to.Ptr("Microsoft.AlertsManagement/prometheusRuleGroups"), // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/promResourceGroup/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup2"), // SystemData: &armalertsmanagement.SystemData{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:13.000Z"); return t}()), // CreatedBy: to.Ptr("abc@microsoft.com"), // CreatedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:13.000Z"); return t}()), // LastModifiedBy: to.Ptr("xyz@microsoft.com"), // LastModifiedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // }, // Location: to.Ptr("East US"), // Properties: &armalertsmanagement.PrometheusRuleGroupProperties{ // Description: to.Ptr("This is the description of the first rule group"), // Rules: []*armalertsmanagement.PrometheusRule{ // { // Expression: to.Ptr("histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))"), // Record: to.Ptr("job_type:billing_jobs_duration_seconds:99p5m"), // }, // { // Actions: []*armalertsmanagement.PrometheusRuleGroupAction{ // { // ActionGroupID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/promResourceGroup/providers/microsoft.insights/actiongroups/group2"), // ActionProperties: map[string]*string{ // "key11": to.Ptr("value11"), // "key12": to.Ptr("value12"), // }, // }}, // Alert: to.Ptr("Billing_Processing_Very_Slow"), // Expression: to.Ptr("job_type:billing_jobs_duration_seconds:99p5m > 30"), // For: to.Ptr("5m"), // Labels: map[string]*string{ // "team": to.Ptr("prod"), // }, // ResolveConfiguration: &armalertsmanagement.PrometheusRuleResolveConfiguration{ // AutoResolved: to.Ptr(true), // TimeToResolve: to.Ptr("10m"), // }, // Severity: to.Ptr[int32](2), // }}, // Scopes: []*string{ // to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/promResourceGroup/providers/microsoft.monitor/accounts/monitoringAcount/myMonitoringAccount")}, // }, // }}, // } } }
Output:
func (*PrometheusRuleGroupsClient) Update ¶ added in v0.10.0
func (client *PrometheusRuleGroupsClient) Update(ctx context.Context, resourceGroupName string, ruleGroupName string, parameters PrometheusRuleGroupResourcePatch, options *PrometheusRuleGroupsClientUpdateOptions) (PrometheusRuleGroupsClientUpdateResponse, error)
Update - Update an Prometheus rule group definition. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2021-07-22-preview
- resourceGroupName - The name of the resource group. The name is case insensitive.
- ruleGroupName - The name of the rule group.
- parameters - The parameters of the rule group to update.
- options - PrometheusRuleGroupsClientUpdateOptions contains the optional parameters for the PrometheusRuleGroupsClient.Update method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/patchPrometheusRuleGroup.json
package main import ( "context" "log" "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/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewPrometheusRuleGroupsClient().Update(ctx, "promResourceGroup", "myPrometheusRuleGroup", armalertsmanagement.PrometheusRuleGroupResourcePatch{ Properties: &armalertsmanagement.PrometheusRuleGroupResourcePatchProperties{ Enabled: to.Ptr(false), }, Tags: map[string]*string{ "tag1": to.Ptr("value1"), }, }, 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.PrometheusRuleGroupResource = armalertsmanagement.PrometheusRuleGroupResource{ // Type: to.Ptr("Microsoft.AlertsManagement/prometheusRuleGroups"), // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/promResourceGroup/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup"), // SystemData: &armalertsmanagement.SystemData{ // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09.000Z"); return t}()), // CreatedBy: to.Ptr("abc@microsoft.com"), // CreatedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T22:05:09.000Z"); return t}()), // LastModifiedBy: to.Ptr("xyz@microsoft.com"), // LastModifiedByType: to.Ptr(armalertsmanagement.CreatedByTypeUser), // }, // Location: to.Ptr("East US"), // Tags: map[string]*string{ // "tag1": to.Ptr("value1"), // }, // Properties: &armalertsmanagement.PrometheusRuleGroupProperties{ // Description: to.Ptr("This is the description of the first rule group"), // Enabled: to.Ptr(false), // Rules: []*armalertsmanagement.PrometheusRule{ // { // Expression: to.Ptr("histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))"), // Record: to.Ptr("job_type:billing_jobs_duration_seconds:99p5m"), // }, // { // Actions: []*armalertsmanagement.PrometheusRuleGroupAction{ // { // ActionGroupID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/promResourceGroup/providers/microsoft.insights/actiongroups/group2"), // ActionProperties: map[string]*string{ // "key11": to.Ptr("value11"), // "key12": to.Ptr("value12"), // }, // }}, // Alert: to.Ptr("Billing_Processing_Very_Slow"), // Expression: to.Ptr("job_type:billing_jobs_duration_seconds:99p5m > 30"), // For: to.Ptr("5m"), // Labels: map[string]*string{ // "team": to.Ptr("prod"), // }, // ResolveConfiguration: &armalertsmanagement.PrometheusRuleResolveConfiguration{ // AutoResolved: to.Ptr(true), // TimeToResolve: to.Ptr("10m"), // }, // Severity: to.Ptr[int32](2), // }}, // Scopes: []*string{ // to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/promResourceGroup/providers/microsoft.monitor/accounts/monitoringAcount/myMonitoringAccount")}, // }, // } }
Output:
type PrometheusRuleGroupsClientCreateOrUpdateOptions ¶ added in v0.10.0
type PrometheusRuleGroupsClientCreateOrUpdateOptions struct { }
PrometheusRuleGroupsClientCreateOrUpdateOptions contains the optional parameters for the PrometheusRuleGroupsClient.CreateOrUpdate method.
type PrometheusRuleGroupsClientCreateOrUpdateResponse ¶ added in v0.10.0
type PrometheusRuleGroupsClientCreateOrUpdateResponse struct { // The Prometheus rule group resource. PrometheusRuleGroupResource }
PrometheusRuleGroupsClientCreateOrUpdateResponse contains the response from method PrometheusRuleGroupsClient.CreateOrUpdate.
type PrometheusRuleGroupsClientDeleteOptions ¶ added in v0.10.0
type PrometheusRuleGroupsClientDeleteOptions struct { }
PrometheusRuleGroupsClientDeleteOptions contains the optional parameters for the PrometheusRuleGroupsClient.Delete method.
type PrometheusRuleGroupsClientDeleteResponse ¶ added in v0.10.0
type PrometheusRuleGroupsClientDeleteResponse struct { }
PrometheusRuleGroupsClientDeleteResponse contains the response from method PrometheusRuleGroupsClient.Delete.
type PrometheusRuleGroupsClientGetOptions ¶ added in v0.10.0
type PrometheusRuleGroupsClientGetOptions struct { }
PrometheusRuleGroupsClientGetOptions contains the optional parameters for the PrometheusRuleGroupsClient.Get method.
type PrometheusRuleGroupsClientGetResponse ¶ added in v0.10.0
type PrometheusRuleGroupsClientGetResponse struct { // The Prometheus rule group resource. PrometheusRuleGroupResource }
PrometheusRuleGroupsClientGetResponse contains the response from method PrometheusRuleGroupsClient.Get.
type PrometheusRuleGroupsClientListByResourceGroupOptions ¶ added in v0.10.0
type PrometheusRuleGroupsClientListByResourceGroupOptions struct { }
PrometheusRuleGroupsClientListByResourceGroupOptions contains the optional parameters for the PrometheusRuleGroupsClient.NewListByResourceGroupPager method.
type PrometheusRuleGroupsClientListByResourceGroupResponse ¶ added in v0.10.0
type PrometheusRuleGroupsClientListByResourceGroupResponse struct { // Represents a collection of alert rule resources. PrometheusRuleGroupResourceCollection }
PrometheusRuleGroupsClientListByResourceGroupResponse contains the response from method PrometheusRuleGroupsClient.NewListByResourceGroupPager.
type PrometheusRuleGroupsClientListBySubscriptionOptions ¶ added in v0.10.0
type PrometheusRuleGroupsClientListBySubscriptionOptions struct { }
PrometheusRuleGroupsClientListBySubscriptionOptions contains the optional parameters for the PrometheusRuleGroupsClient.NewListBySubscriptionPager method.
type PrometheusRuleGroupsClientListBySubscriptionResponse ¶ added in v0.10.0
type PrometheusRuleGroupsClientListBySubscriptionResponse struct { // Represents a collection of alert rule resources. PrometheusRuleGroupResourceCollection }
PrometheusRuleGroupsClientListBySubscriptionResponse contains the response from method PrometheusRuleGroupsClient.NewListBySubscriptionPager.
type PrometheusRuleGroupsClientUpdateOptions ¶ added in v0.10.0
type PrometheusRuleGroupsClientUpdateOptions struct { }
PrometheusRuleGroupsClientUpdateOptions contains the optional parameters for the PrometheusRuleGroupsClient.Update method.
type PrometheusRuleGroupsClientUpdateResponse ¶ added in v0.10.0
type PrometheusRuleGroupsClientUpdateResponse struct { // The Prometheus rule group resource. PrometheusRuleGroupResource }
PrometheusRuleGroupsClientUpdateResponse contains the response from method PrometheusRuleGroupsClient.Update.
type PrometheusRuleResolveConfiguration ¶ added in v0.10.0
type PrometheusRuleResolveConfiguration struct { // the flag that indicates whether or not to auto resolve a fired alert. AutoResolved *bool // the duration a rule must evaluate as healthy before the fired alert is automatically resolved represented in ISO 8601 duration // format. Should be between 1 and 15 minutes TimeToResolve *string }
PrometheusRuleResolveConfiguration - Specifies the Prometheus alert rule configuration.
func (PrometheusRuleResolveConfiguration) MarshalJSON ¶ added in v0.10.0
func (p PrometheusRuleResolveConfiguration) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type PrometheusRuleResolveConfiguration.
func (*PrometheusRuleResolveConfiguration) UnmarshalJSON ¶ added in v0.10.0
func (p *PrometheusRuleResolveConfiguration) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type PrometheusRuleResolveConfiguration.
type Recurrence ¶ added in v0.3.0
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 ¶ added in v0.3.0
func (r *Recurrence) GetRecurrence() *Recurrence
GetRecurrence implements the RecurrenceClassification interface for type Recurrence.
func (Recurrence) MarshalJSON ¶ added in v0.7.0
func (r Recurrence) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type Recurrence.
func (*Recurrence) UnmarshalJSON ¶ added in v0.7.0
func (r *Recurrence) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type Recurrence.
type RecurrenceClassification ¶ added in v0.3.0
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 ¶ added in v0.3.0
type RecurrenceType string
RecurrenceType - Specifies when the recurrence should be applied.
const ( RecurrenceTypeDaily RecurrenceType = "Daily" RecurrenceTypeMonthly RecurrenceType = "Monthly" RecurrenceTypeWeekly RecurrenceType = "Weekly" )
func PossibleRecurrenceTypeValues ¶ added in v0.3.0
func PossibleRecurrenceTypeValues() []RecurrenceType
PossibleRecurrenceTypeValues returns the possible values for the RecurrenceType const type.
type RemoveAllActionGroups ¶ added in v0.3.0
type RemoveAllActionGroups struct { // REQUIRED; Action that should be applied. ActionType *ActionType }
RemoveAllActionGroups - Indicates if all action groups should be removed.
func (*RemoveAllActionGroups) GetAction ¶ added in v0.3.0
func (r *RemoveAllActionGroups) GetAction() *Action
GetAction implements the ActionClassification interface for type RemoveAllActionGroups.
func (RemoveAllActionGroups) MarshalJSON ¶ added in v0.3.0
func (r RemoveAllActionGroups) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type RemoveAllActionGroups.
func (*RemoveAllActionGroups) UnmarshalJSON ¶ added in v0.3.0
func (r *RemoveAllActionGroups) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type RemoveAllActionGroups.
type RuleArmTemplate ¶ added in v0.10.0
type RuleArmTemplate struct { // REQUIRED; A 4 number format for the version number of this template file. For example, 1.0.0.0 ContentVersion *string // REQUIRED; Input parameter definitions Parameters any // REQUIRED; Alert rule resource definitions Resources []any // REQUIRED; JSON schema reference Schema *string // REQUIRED; Variable definitions Variables any }
RuleArmTemplate - A complete ARM template to deploy the alert rules.
func (RuleArmTemplate) MarshalJSON ¶ added in v0.10.0
func (r RuleArmTemplate) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type RuleArmTemplate.
func (*RuleArmTemplate) UnmarshalJSON ¶ added in v0.10.0
func (r *RuleArmTemplate) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type RuleArmTemplate.
type Schedule ¶ added in v0.3.0
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 ¶ added in v0.3.0
MarshalJSON implements the json.Marshaller interface for type Schedule.
func (*Schedule) UnmarshalJSON ¶ added in v0.3.0
UnmarshalJSON implements the json.Unmarshaller interface for type Schedule.
type Severity ¶
type Severity string
func PossibleSeverityValues ¶
func PossibleSeverityValues() []Severity
PossibleSeverityValues returns the possible values for the Severity const type.
type SignalType ¶
type SignalType string
SignalType - The type of signal the alert is based on, which could be metrics, logs or activity logs.
const ( SignalTypeLog SignalType = "Log" SignalTypeMetric SignalType = "Metric" SignalTypeUnknown SignalType = "Unknown" )
func PossibleSignalTypeValues ¶
func PossibleSignalTypeValues() []SignalType
PossibleSignalTypeValues returns the possible values for the SignalType const type.
type SmartGroup ¶
type SmartGroup struct { // Properties of smart group. Properties *SmartGroupProperties // READ-ONLY; Azure resource Id ID *string // READ-ONLY; Azure resource name Name *string // READ-ONLY; Azure resource type Type *string }
SmartGroup - Set of related alerts grouped together smartly by AMS.
func (SmartGroup) MarshalJSON ¶
func (s SmartGroup) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type SmartGroup.
func (*SmartGroup) UnmarshalJSON ¶
func (s *SmartGroup) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type SmartGroup.
type SmartGroupAggregatedProperty ¶
type SmartGroupAggregatedProperty struct { // Total number of items of type. Count *int64 // Name of the type. Name *string }
SmartGroupAggregatedProperty - Aggregated property of each type
func (SmartGroupAggregatedProperty) MarshalJSON ¶ added in v0.7.0
func (s SmartGroupAggregatedProperty) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type SmartGroupAggregatedProperty.
func (*SmartGroupAggregatedProperty) UnmarshalJSON ¶ added in v0.7.0
func (s *SmartGroupAggregatedProperty) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type SmartGroupAggregatedProperty.
type SmartGroupModification ¶
type SmartGroupModification struct { // Properties of the smartGroup modification item. Properties *SmartGroupModificationProperties // READ-ONLY; Azure resource Id ID *string // READ-ONLY; Azure resource name Name *string // READ-ONLY; Azure resource type Type *string }
SmartGroupModification - Alert Modification details
func (SmartGroupModification) MarshalJSON ¶
func (s SmartGroupModification) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type SmartGroupModification.
func (*SmartGroupModification) UnmarshalJSON ¶
func (s *SmartGroupModification) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type SmartGroupModification.
type SmartGroupModificationEvent ¶
type SmartGroupModificationEvent string
SmartGroupModificationEvent - Reason for the modification
const ( SmartGroupModificationEventAlertAdded SmartGroupModificationEvent = "AlertAdded" SmartGroupModificationEventAlertRemoved SmartGroupModificationEvent = "AlertRemoved" SmartGroupModificationEventSmartGroupCreated SmartGroupModificationEvent = "SmartGroupCreated" SmartGroupModificationEventStateChange SmartGroupModificationEvent = "StateChange" )
func PossibleSmartGroupModificationEventValues ¶
func PossibleSmartGroupModificationEventValues() []SmartGroupModificationEvent
PossibleSmartGroupModificationEventValues returns the possible values for the SmartGroupModificationEvent const type.
type SmartGroupModificationItem ¶
type SmartGroupModificationItem struct { // Modification comments Comments *string // Description of the modification Description *string // Reason for the modification ModificationEvent *SmartGroupModificationEvent // Modified date and time ModifiedAt *string // Modified user details (Principal client name) ModifiedBy *string // New value NewValue *string // Old value OldValue *string }
SmartGroupModificationItem - smartGroup modification item.
func (SmartGroupModificationItem) MarshalJSON ¶ added in v0.7.0
func (s SmartGroupModificationItem) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type SmartGroupModificationItem.
func (*SmartGroupModificationItem) UnmarshalJSON ¶ added in v0.7.0
func (s *SmartGroupModificationItem) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type SmartGroupModificationItem.
type SmartGroupModificationProperties ¶
type SmartGroupModificationProperties struct { // Modification details Modifications []*SmartGroupModificationItem // URL to fetch the next set of results. NextLink *string // READ-ONLY; Unique Id of the smartGroup for which the history is being retrieved SmartGroupID *string }
SmartGroupModificationProperties - Properties of the smartGroup modification item.
func (SmartGroupModificationProperties) MarshalJSON ¶
func (s SmartGroupModificationProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type SmartGroupModificationProperties.
func (*SmartGroupModificationProperties) UnmarshalJSON ¶ added in v0.7.0
func (s *SmartGroupModificationProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type SmartGroupModificationProperties.
type SmartGroupProperties ¶
type SmartGroupProperties struct { // Summary of alertSeverities in the smart group AlertSeverities []*SmartGroupAggregatedProperty // Summary of alertStates in the smart group AlertStates []*SmartGroupAggregatedProperty // Total number of alerts in smart group AlertsCount *int64 // Summary of monitorConditions in the smart group MonitorConditions []*SmartGroupAggregatedProperty // Summary of monitorServices in the smart group MonitorServices []*SmartGroupAggregatedProperty // The URI to fetch the next page of alerts. Call ListNext() with this URI to fetch the next page alerts. NextLink *string // Summary of target resource groups in the smart group ResourceGroups []*SmartGroupAggregatedProperty // Summary of target resource types in the smart group ResourceTypes []*SmartGroupAggregatedProperty // Summary of target resources in the smart group Resources []*SmartGroupAggregatedProperty // READ-ONLY; Last updated time of smart group. Date-Time in ISO-8601 format. LastModifiedDateTime *time.Time // READ-ONLY; Last modified by user name. LastModifiedUserName *string // READ-ONLY; Severity of smart group is the highest(Sev0 >… > Sev4) severity of all the alerts in the group. Severity *Severity // READ-ONLY; Smart group state SmartGroupState *State // READ-ONLY; Creation time of smart group. Date-Time in ISO-8601 format. StartDateTime *time.Time }
SmartGroupProperties - Properties of smart group.
func (SmartGroupProperties) MarshalJSON ¶
func (s SmartGroupProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type SmartGroupProperties.
func (*SmartGroupProperties) UnmarshalJSON ¶
func (s *SmartGroupProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type SmartGroupProperties.
type SmartGroupsClient ¶
type SmartGroupsClient struct {
// contains filtered or unexported fields
}
SmartGroupsClient contains the methods for the SmartGroups group. Don't use this type directly, use NewSmartGroupsClient() instead.
func NewSmartGroupsClient ¶
func NewSmartGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SmartGroupsClient, error)
NewSmartGroupsClient creates a new instance of SmartGroupsClient with the specified values.
- subscriptionID - The ID of the target subscription.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*SmartGroupsClient) ChangeState ¶
func (client *SmartGroupsClient) ChangeState(ctx context.Context, smartGroupID string, newState AlertState, options *SmartGroupsClientChangeStateOptions) (SmartGroupsClientChangeStateResponse, error)
ChangeState - Change the state of a Smart Group. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2019-05-05-preview
- smartGroupID - Smart group unique id.
- newState - New state of the alert.
- options - SmartGroupsClientChangeStateOptions contains the optional parameters for the SmartGroupsClient.ChangeState method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2019-05-05-preview/examples/SmartGroups_ChangeState.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewSmartGroupsClient().ChangeState(ctx, "a808445e-bb38-4751-85c2-1b109ccc1059", armalertsmanagement.AlertStateAcknowledged, 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.SmartGroup = armalertsmanagement.SmartGroup{ // Name: to.Ptr("cpu alert"), // Type: to.Ptr("Microsoft.AlertsManagement/smartGroups"), // ID: to.Ptr("/subscriptions/dd91de05-d791-4ceb-b6dc-988682dc7d72/providers/Microsoft.AlertsManagement/smartGroups/a808445e-bb38-4751-85c2-1b109ccc1059"), // Properties: &armalertsmanagement.SmartGroupProperties{ // AlertSeverities: []*armalertsmanagement.SmartGroupAggregatedProperty{ // { // Name: to.Ptr("Sev3"), // Count: to.Ptr[int64](1942), // }}, // AlertStates: []*armalertsmanagement.SmartGroupAggregatedProperty{ // { // Name: to.Ptr("New"), // Count: to.Ptr[int64](1941), // }, // { // Name: to.Ptr("Acknowledged"), // Count: to.Ptr[int64](1), // }}, // AlertsCount: to.Ptr[int64](1942), // LastModifiedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-13T06:30:09.000Z"); return t}()), // LastModifiedUserName: to.Ptr("System"), // MonitorConditions: []*armalertsmanagement.SmartGroupAggregatedProperty{ // { // Name: to.Ptr("Fired"), // Count: to.Ptr[int64](1942), // }}, // MonitorServices: []*armalertsmanagement.SmartGroupAggregatedProperty{ // { // Name: to.Ptr("Application Insights"), // Count: to.Ptr[int64](1942), // }}, // ResourceGroups: []*armalertsmanagement.SmartGroupAggregatedProperty{ // { // Name: to.Ptr("alertscorrelationrg"), // Count: to.Ptr[int64](1942), // }}, // ResourceTypes: []*armalertsmanagement.SmartGroupAggregatedProperty{ // { // Name: to.Ptr("components"), // Count: to.Ptr[int64](1942), // }}, // Resources: []*armalertsmanagement.SmartGroupAggregatedProperty{ // { // Name: to.Ptr("/subscriptions/dd91de05-d791-4ceb-b6dc-988682dc7d72/resourcegroups/alertscorrelationrg/providers/microsoft.insights/components/alertscorrelationworkerrole_int"), // Count: to.Ptr[int64](1942), // }}, // Severity: to.Ptr(armalertsmanagement.SeveritySev3), // SmartGroupState: to.Ptr(armalertsmanagement.StateAcknowledged), // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-06T12:35:09.000Z"); return t}()), // }, // } }
Output:
func (*SmartGroupsClient) GetByID ¶
func (client *SmartGroupsClient) GetByID(ctx context.Context, smartGroupID string, options *SmartGroupsClientGetByIDOptions) (SmartGroupsClientGetByIDResponse, error)
GetByID - Get information related to a specific Smart Group. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2019-05-05-preview
- smartGroupID - Smart group unique id.
- options - SmartGroupsClientGetByIDOptions contains the optional parameters for the SmartGroupsClient.GetByID method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2019-05-05-preview/examples/SmartGroups_GetById.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewSmartGroupsClient().GetByID(ctx, "603675da-9851-4b26-854a-49fc53d32715", 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.SmartGroup = armalertsmanagement.SmartGroup{ // Name: to.Ptr("cpu alert"), // Type: to.Ptr("Microsoft.AlertsManagement/smartGroups"), // ID: to.Ptr("/subscriptions/dd91de05-d791-4ceb-b6dc-988682dc7d72/providers/Microsoft.AlertsManagement/smartGroups/a808445e-bb38-4751-85c2-1b109ccc1059"), // Properties: &armalertsmanagement.SmartGroupProperties{ // AlertSeverities: []*armalertsmanagement.SmartGroupAggregatedProperty{ // { // Name: to.Ptr("Sev3"), // Count: to.Ptr[int64](1942), // }}, // AlertStates: []*armalertsmanagement.SmartGroupAggregatedProperty{ // { // Name: to.Ptr("New"), // Count: to.Ptr[int64](1941), // }, // { // Name: to.Ptr("Acknowledged"), // Count: to.Ptr[int64](1), // }}, // AlertsCount: to.Ptr[int64](1942), // LastModifiedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-13T06:30:09.000Z"); return t}()), // LastModifiedUserName: to.Ptr("System"), // MonitorConditions: []*armalertsmanagement.SmartGroupAggregatedProperty{ // { // Name: to.Ptr("Fired"), // Count: to.Ptr[int64](1942), // }}, // MonitorServices: []*armalertsmanagement.SmartGroupAggregatedProperty{ // { // Name: to.Ptr("Application Insights"), // Count: to.Ptr[int64](1942), // }}, // ResourceGroups: []*armalertsmanagement.SmartGroupAggregatedProperty{ // { // Name: to.Ptr("alertscorrelationrg"), // Count: to.Ptr[int64](1942), // }}, // ResourceTypes: []*armalertsmanagement.SmartGroupAggregatedProperty{ // { // Name: to.Ptr("components"), // Count: to.Ptr[int64](1942), // }}, // Resources: []*armalertsmanagement.SmartGroupAggregatedProperty{ // { // Name: to.Ptr("/subscriptions/dd91de05-d791-4ceb-b6dc-988682dc7d72/resourcegroups/alertscorrelationrg/providers/microsoft.insights/components/alertscorrelationworkerrole_int"), // Count: to.Ptr[int64](1942), // }}, // Severity: to.Ptr(armalertsmanagement.SeveritySev3), // SmartGroupState: to.Ptr(armalertsmanagement.StateNew), // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-06T12:35:09.000Z"); return t}()), // }, // } }
Output:
func (*SmartGroupsClient) GetHistory ¶
func (client *SmartGroupsClient) GetHistory(ctx context.Context, smartGroupID string, options *SmartGroupsClientGetHistoryOptions) (SmartGroupsClientGetHistoryResponse, error)
GetHistory - Get the history a smart group, which captures any Smart Group state changes (New/Acknowledged/Closed) . If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2019-05-05-preview
- smartGroupID - Smart group unique id.
- options - SmartGroupsClientGetHistoryOptions contains the optional parameters for the SmartGroupsClient.GetHistory method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2019-05-05-preview/examples/SmartGroups_History.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewSmartGroupsClient().GetHistory(ctx, "a808445e-bb38-4751-85c2-1b109ccc1059", 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.SmartGroupModification = armalertsmanagement.SmartGroupModification{ // Name: to.Ptr("cpu alert"), // Type: to.Ptr("Microsoft.AlertsManagement/alerts"), // ID: to.Ptr("/subscriptions/9e261de7-c804-4b9d-9ebf-6f50fe350a9a/providers/Microsoft.AlertsManagement/smartGroups/a808445e-bb38-4751-85c2-1b109ccc1059/history/default"), // Properties: &armalertsmanagement.SmartGroupModificationProperties{ // Modifications: []*armalertsmanagement.SmartGroupModificationItem{ // { // Description: to.Ptr("New Smart Group is created"), // Comments: to.Ptr(""), // ModificationEvent: to.Ptr(armalertsmanagement.SmartGroupModificationEventSmartGroupCreated), // ModifiedAt: to.Ptr("2018-06-06T12:35:09Z"), // ModifiedBy: to.Ptr("System"), // NewValue: to.Ptr(""), // OldValue: to.Ptr(""), // }}, // SmartGroupID: to.Ptr("a808445e-bb38-4751-85c2-1b109ccc1059"), // }, // } }
Output:
func (*SmartGroupsClient) NewGetAllPager ¶ added in v0.5.0
func (client *SmartGroupsClient) NewGetAllPager(options *SmartGroupsClientGetAllOptions) *runtime.Pager[SmartGroupsClientGetAllResponse]
NewGetAllPager - List all the Smart Groups within a specified subscription.
Generated from API version 2019-05-05-preview
- options - SmartGroupsClientGetAllOptions contains the optional parameters for the SmartGroupsClient.NewGetAllPager method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2019-05-05-preview/examples/SmartGroups_List.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewSmartGroupsClient().NewGetAllPager(&armalertsmanagement.SmartGroupsClientGetAllOptions{TargetResource: nil, TargetResourceGroup: nil, TargetResourceType: nil, MonitorService: nil, MonitorCondition: nil, Severity: nil, SmartGroupState: nil, TimeRange: nil, PageCount: nil, SortBy: nil, SortOrder: 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.SmartGroupsList = armalertsmanagement.SmartGroupsList{ // Value: []*armalertsmanagement.SmartGroup{ // { // Name: to.Ptr("cpu alert"), // Type: to.Ptr("Microsoft.AlertsManagement/smartGroups"), // ID: to.Ptr("/subscriptions/dd91de05-d791-4ceb-b6dc-988682dc7d72/providers/Microsoft.AlertsManagement/smartGroups/a808445e-bb38-4751-85c2-1b109ccc1059"), // Properties: &armalertsmanagement.SmartGroupProperties{ // AlertSeverities: []*armalertsmanagement.SmartGroupAggregatedProperty{ // { // Name: to.Ptr("Sev3"), // Count: to.Ptr[int64](1942), // }}, // AlertStates: []*armalertsmanagement.SmartGroupAggregatedProperty{ // { // Name: to.Ptr("New"), // Count: to.Ptr[int64](1941), // }, // { // Name: to.Ptr("Acknowledged"), // Count: to.Ptr[int64](1), // }}, // AlertsCount: to.Ptr[int64](1942), // LastModifiedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-13T06:30:09.000Z"); return t}()), // LastModifiedUserName: to.Ptr("System"), // MonitorConditions: []*armalertsmanagement.SmartGroupAggregatedProperty{ // { // Name: to.Ptr("Fired"), // Count: to.Ptr[int64](1942), // }}, // MonitorServices: []*armalertsmanagement.SmartGroupAggregatedProperty{ // { // Name: to.Ptr("Application Insights"), // Count: to.Ptr[int64](1942), // }}, // ResourceGroups: []*armalertsmanagement.SmartGroupAggregatedProperty{ // { // Name: to.Ptr("alertscorrelationrg"), // Count: to.Ptr[int64](1942), // }}, // ResourceTypes: []*armalertsmanagement.SmartGroupAggregatedProperty{ // { // Name: to.Ptr("components"), // Count: to.Ptr[int64](1942), // }}, // Resources: []*armalertsmanagement.SmartGroupAggregatedProperty{ // { // Name: to.Ptr("/subscriptions/dd91de05-d791-4ceb-b6dc-988682dc7d72/resourcegroups/alertscorrelationrg/providers/microsoft.insights/components/alertscorrelationworkerrole_int"), // Count: to.Ptr[int64](1942), // }}, // Severity: to.Ptr(armalertsmanagement.SeveritySev3), // SmartGroupState: to.Ptr(armalertsmanagement.StateNew), // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-06T12:35:09.000Z"); return t}()), // }, // }, // { // Name: to.Ptr("CPU Alert"), // Type: to.Ptr("Microsoft.AlertsManagement/smartGroups"), // ID: to.Ptr("/subscriptions/dd91de05-d791-4ceb-b6dc-988682dc7d72/providers/Microsoft.AlertsManagement/smartGroups/01114c7c-769f-4fd4-b6fa-ab77693b83cd"), // Properties: &armalertsmanagement.SmartGroupProperties{ // AlertSeverities: []*armalertsmanagement.SmartGroupAggregatedProperty{ // { // Name: to.Ptr("Sev0"), // Count: to.Ptr[int64](6984), // }, // { // Name: to.Ptr("Sev1"), // Count: to.Ptr[int64](6927), // }}, // AlertStates: []*armalertsmanagement.SmartGroupAggregatedProperty{ // { // Name: to.Ptr("New"), // Count: to.Ptr[int64](15358), // }, // { // Name: to.Ptr("Acknowledged"), // Count: to.Ptr[int64](12), // }, // { // Name: to.Ptr("Closed"), // Count: to.Ptr[int64](4), // }}, // AlertsCount: to.Ptr[int64](15374), // LastModifiedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-13T06:29:01.000Z"); return t}()), // LastModifiedUserName: to.Ptr("System"), // MonitorConditions: []*armalertsmanagement.SmartGroupAggregatedProperty{ // { // Name: to.Ptr("Fired"), // Count: to.Ptr[int64](15374), // }}, // MonitorServices: []*armalertsmanagement.SmartGroupAggregatedProperty{ // { // Name: to.Ptr("Log Analytics"), // Count: to.Ptr[int64](13911), // }}, // ResourceGroups: []*armalertsmanagement.SmartGroupAggregatedProperty{ // { // Name: to.Ptr("mms-eus"), // Count: to.Ptr[int64](15374), // }}, // ResourceTypes: []*armalertsmanagement.SmartGroupAggregatedProperty{ // { // Name: to.Ptr("microsoft.operationalinsights/workspaces"), // Count: to.Ptr[int64](6912), // }, // { // Name: to.Ptr("workspaces"), // Count: to.Ptr[int64](8462), // }}, // Resources: []*armalertsmanagement.SmartGroupAggregatedProperty{ // { // Name: to.Ptr("/subscriptions/dd91de05-d791-4ceb-b6dc-988682dc7d72/resourcegroups/mms-eus/providers/microsoft.operationalinsights/workspaces/alertsint"), // Count: to.Ptr[int64](15374), // }}, // Severity: to.Ptr(armalertsmanagement.SeveritySev0), // SmartGroupState: to.Ptr(armalertsmanagement.StateAcknowledged), // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-17T10:18:44.202Z"); return t}()), // }, // }}, // } } }
Output:
type SmartGroupsClientChangeStateOptions ¶ added in v0.3.0
type SmartGroupsClientChangeStateOptions struct { }
SmartGroupsClientChangeStateOptions contains the optional parameters for the SmartGroupsClient.ChangeState method.
type SmartGroupsClientChangeStateResponse ¶ added in v0.3.0
type SmartGroupsClientChangeStateResponse struct { // Set of related alerts grouped together smartly by AMS. SmartGroup // XMSRequestID contains the information returned from the x-ms-request-id header response. XMSRequestID *string }
SmartGroupsClientChangeStateResponse contains the response from method SmartGroupsClient.ChangeState.
type SmartGroupsClientGetAllOptions ¶ added in v0.3.0
type SmartGroupsClientGetAllOptions struct { // Filter by monitor condition which is either 'Fired' or 'Resolved'. Default value is to select all. MonitorCondition *MonitorCondition // Filter by monitor service which generates the alert instance. Default value is select all. MonitorService *MonitorService // Determines number of alerts returned per page in response. Permissible value is between 1 to 250. When the "includeContent" // filter is selected, maximum value allowed is 25. Default value is 25. PageCount *int64 // Filter by severity. Default value is select all. Severity *Severity // Filter by state of the smart group. Default value is to select all. SmartGroupState *AlertState // Sort the query results by input field. Default value is sort by 'lastModifiedDateTime'. SortBy *SmartGroupsSortByFields // Sort the query results order in either ascending or descending. Default value is 'desc' for time fields and 'asc' for others. SortOrder *SortOrder // Filter by target resource( which is full ARM ID) Default value is select all. TargetResource *string // Filter by target resource group name. Default value is select all. TargetResourceGroup *string // Filter by target resource type. Default value is select all. TargetResourceType *string // Filter by time range by below listed values. Default value is 1 day. TimeRange *TimeRange }
SmartGroupsClientGetAllOptions contains the optional parameters for the SmartGroupsClient.NewGetAllPager method.
type SmartGroupsClientGetAllResponse ¶ added in v0.3.0
type SmartGroupsClientGetAllResponse struct { // List the alerts. SmartGroupsList }
SmartGroupsClientGetAllResponse contains the response from method SmartGroupsClient.NewGetAllPager.
type SmartGroupsClientGetByIDOptions ¶ added in v0.3.0
type SmartGroupsClientGetByIDOptions struct { }
SmartGroupsClientGetByIDOptions contains the optional parameters for the SmartGroupsClient.GetByID method.
type SmartGroupsClientGetByIDResponse ¶ added in v0.3.0
type SmartGroupsClientGetByIDResponse struct { // Set of related alerts grouped together smartly by AMS. SmartGroup // XMSRequestID contains the information returned from the x-ms-request-id header response. XMSRequestID *string }
SmartGroupsClientGetByIDResponse contains the response from method SmartGroupsClient.GetByID.
type SmartGroupsClientGetHistoryOptions ¶ added in v0.3.0
type SmartGroupsClientGetHistoryOptions struct { }
SmartGroupsClientGetHistoryOptions contains the optional parameters for the SmartGroupsClient.GetHistory method.
type SmartGroupsClientGetHistoryResponse ¶ added in v0.3.0
type SmartGroupsClientGetHistoryResponse struct { // Alert Modification details SmartGroupModification }
SmartGroupsClientGetHistoryResponse contains the response from method SmartGroupsClient.GetHistory.
type SmartGroupsList ¶
type SmartGroupsList struct { // URL to fetch the next set of alerts. NextLink *string // List of alerts Value []*SmartGroup }
SmartGroupsList - List the alerts.
func (SmartGroupsList) MarshalJSON ¶
func (s SmartGroupsList) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type SmartGroupsList.
func (*SmartGroupsList) UnmarshalJSON ¶ added in v0.7.0
func (s *SmartGroupsList) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type SmartGroupsList.
type SmartGroupsSortByFields ¶
type SmartGroupsSortByFields string
const ( SmartGroupsSortByFieldsAlertsCount SmartGroupsSortByFields = "alertsCount" SmartGroupsSortByFieldsLastModifiedDateTime SmartGroupsSortByFields = "lastModifiedDateTime" SmartGroupsSortByFieldsSeverity SmartGroupsSortByFields = "severity" SmartGroupsSortByFieldsStartDateTime SmartGroupsSortByFields = "startDateTime" SmartGroupsSortByFieldsState SmartGroupsSortByFields = "state" )
func PossibleSmartGroupsSortByFieldsValues ¶
func PossibleSmartGroupsSortByFieldsValues() []SmartGroupsSortByFields
PossibleSmartGroupsSortByFieldsValues returns the possible values for the SmartGroupsSortByFields const type.
type SortOrder ¶ added in v0.3.0
type SortOrder string
func PossibleSortOrderValues ¶ added in v0.3.0
func PossibleSortOrderValues() []SortOrder
PossibleSortOrderValues returns the possible values for the SortOrder const type.
type State ¶
type State string
State - Smart group state
func PossibleStateValues ¶
func PossibleStateValues() []State
PossibleStateValues returns the possible values for the State const type.
type SystemData ¶ added in v0.3.0
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 ¶ added in v0.3.0
func (s SystemData) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type SystemData.
func (*SystemData) UnmarshalJSON ¶ added in v0.3.0
func (s *SystemData) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type SystemData.
type TenantActivityLogAlertResource ¶ added in v0.10.0
type TenantActivityLogAlertResource struct { // REQUIRED; The Activity Log Alert rule properties of the resource. Properties *AlertRuleProperties // The location of the resource. Since Azure Activity Log Alerts is a global service, the location of the rules should always // be 'global'. Location *string // The tags of the resource. Tags map[string]*string // READ-ONLY; The resource Id. ID *string // READ-ONLY; The name of the resource. Name *string // READ-ONLY; The type of the resource. Type *string }
TenantActivityLogAlertResource - A Tenant Activity Log Alert rule resource.
func (TenantActivityLogAlertResource) MarshalJSON ¶ added in v0.10.0
func (t TenantActivityLogAlertResource) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type TenantActivityLogAlertResource.
func (*TenantActivityLogAlertResource) UnmarshalJSON ¶ added in v0.10.0
func (t *TenantActivityLogAlertResource) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type TenantActivityLogAlertResource.
type TenantActivityLogAlertsClient ¶ added in v0.10.0
type TenantActivityLogAlertsClient struct {
// contains filtered or unexported fields
}
TenantActivityLogAlertsClient contains the methods for the TenantActivityLogAlerts group. Don't use this type directly, use NewTenantActivityLogAlertsClient() instead.
func NewTenantActivityLogAlertsClient ¶ added in v0.10.0
func NewTenantActivityLogAlertsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*TenantActivityLogAlertsClient, error)
NewTenantActivityLogAlertsClient creates a new instance of TenantActivityLogAlertsClient with the specified values.
- credential - used to authorize requests. Usually a credential from azidentity.
- options - pass nil to accept the default values.
func (*TenantActivityLogAlertsClient) CreateOrUpdate ¶ added in v0.10.0
func (client *TenantActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, managementGroupName string, alertRuleName string, tenantActivityLogAlertRule TenantActivityLogAlertResource, options *TenantActivityLogAlertsClientCreateOrUpdateOptions) (TenantActivityLogAlertsClientCreateOrUpdateResponse, 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 name of the management group. The name is case insensitive.
- 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 - TenantActivityLogAlertsClientCreateOrUpdateOptions contains the optional parameters for the TenantActivityLogAlertsClient.CreateOrUpdate method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2023-04-01-preview/examples/TenantActivityLogAlertRule_CreateOrUpdate.json
package main import ( "context" "log" "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/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewTenantActivityLogAlertsClient().CreateOrUpdate(ctx, "72f988bf-86f1-41af-91ab-2d7cd011db47", "SampleActivityLogAlertSHRuleOnTenantLevel", armalertsmanagement.TenantActivityLogAlertResource{ Location: to.Ptr("Global"), Tags: map[string]*string{}, Properties: &armalertsmanagement.AlertRuleProperties{ Description: to.Ptr("Description of sample Activity Log Alert service health rule on tenant level events."), Actions: &armalertsmanagement.ActionList{ ActionGroups: []*armalertsmanagement.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: &armalertsmanagement.AlertRuleAllOfCondition{ AllOf: []*armalertsmanagement.AlertRuleAnyOfOrLeafCondition{ { Equals: to.Ptr("ServiceHealth"), Field: to.Ptr("category"), }}, }, Enabled: to.Ptr(true), TenantScope: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), }, }, 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.TenantActivityLogAlertResource = armalertsmanagement.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"), // Tags: map[string]*string{ // }, // Properties: &armalertsmanagement.AlertRuleProperties{ // Description: to.Ptr("Description of sample Activity Log Alert service health rule on tenant level events."), // Actions: &armalertsmanagement.ActionList{ // ActionGroups: []*armalertsmanagement.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: &armalertsmanagement.AlertRuleAllOfCondition{ // AllOf: []*armalertsmanagement.AlertRuleAnyOfOrLeafCondition{ // { // Equals: to.Ptr("ServiceHealth"), // Field: to.Ptr("category"), // }}, // }, // Enabled: to.Ptr(true), // TenantScope: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), // }, // } }
Output:
func (*TenantActivityLogAlertsClient) Delete ¶ added in v0.10.0
func (client *TenantActivityLogAlertsClient) Delete(ctx context.Context, managementGroupName string, alertRuleName string, options *TenantActivityLogAlertsClientDeleteOptions) (TenantActivityLogAlertsClientDeleteResponse, 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 name of the management group. The name is case insensitive.
- alertRuleName - The name of the Tenant Activity Log Alert rule.
- options - TenantActivityLogAlertsClientDeleteOptions contains the optional parameters for the TenantActivityLogAlertsClient.Delete method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2023-04-01-preview/examples/TenantActivityLogAlertRule_DeleteRule.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } _, err = clientFactory.NewTenantActivityLogAlertsClient().Delete(ctx, "72f988bf-86f1-41af-91ab-2d7cd011db47", "SampleActivityLogAlertSHRuleOnTenantLevel", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } }
Output:
func (*TenantActivityLogAlertsClient) Get ¶ added in v0.10.0
func (client *TenantActivityLogAlertsClient) Get(ctx context.Context, managementGroupName string, alertRuleName string, options *TenantActivityLogAlertsClientGetOptions) (TenantActivityLogAlertsClientGetResponse, 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 name of the management group. The name is case insensitive.
- alertRuleName - The name of the Tenant Activity Log Alert rule.
- options - TenantActivityLogAlertsClientGetOptions contains the optional parameters for the TenantActivityLogAlertsClient.Get method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2023-04-01-preview/examples/TenantActivityLogAlertRule_GetRule.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewTenantActivityLogAlertsClient().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.TenantActivityLogAlertResource = armalertsmanagement.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"), // Tags: map[string]*string{ // }, // Properties: &armalertsmanagement.AlertRuleProperties{ // Description: to.Ptr("Description of sample Activity Log Alert service health rule on tenant level events."), // Actions: &armalertsmanagement.ActionList{ // ActionGroups: []*armalertsmanagement.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: &armalertsmanagement.AlertRuleAllOfCondition{ // AllOf: []*armalertsmanagement.AlertRuleAnyOfOrLeafCondition{ // { // Equals: to.Ptr("ServiceHealth"), // Field: to.Ptr("category"), // }}, // }, // Enabled: to.Ptr(true), // TenantScope: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), // }, // } }
Output:
func (*TenantActivityLogAlertsClient) NewListByManagementGroupPager ¶ added in v0.10.0
func (client *TenantActivityLogAlertsClient) NewListByManagementGroupPager(managementGroupName string, options *TenantActivityLogAlertsClientListByManagementGroupOptions) *runtime.Pager[TenantActivityLogAlertsClientListByManagementGroupResponse]
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 name of the management group. The name is case insensitive.
- options - TenantActivityLogAlertsClientListByManagementGroupOptions contains the optional parameters for the TenantActivityLogAlertsClient.NewListByManagementGroupPager method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2023-04-01-preview/examples/TenantActivityLogAlertRule_ListByManagementGroup.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewTenantActivityLogAlertsClient().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.TenantAlertRuleList = armalertsmanagement.TenantAlertRuleList{ // Value: []*armalertsmanagement.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"), // Tags: map[string]*string{ // }, // Properties: &armalertsmanagement.AlertRuleProperties{ // Description: to.Ptr("Description of sample Activity Log Alert service health rule on tenant level events."), // Actions: &armalertsmanagement.ActionList{ // ActionGroups: []*armalertsmanagement.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: &armalertsmanagement.AlertRuleAllOfCondition{ // AllOf: []*armalertsmanagement.AlertRuleAnyOfOrLeafCondition{ // { // Equals: to.Ptr("ServiceHealth"), // Field: to.Ptr("category"), // }}, // }, // Enabled: to.Ptr(true), // TenantScope: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), // }, // }}, // } } }
Output:
func (*TenantActivityLogAlertsClient) NewListByTenantPager ¶ added in v0.10.0
func (client *TenantActivityLogAlertsClient) NewListByTenantPager(options *TenantActivityLogAlertsClientListByTenantOptions) *runtime.Pager[TenantActivityLogAlertsClientListByTenantResponse]
NewListByTenantPager - Get a list of all Tenant Activity Log Alert rules in the tenant.
Generated from API version 2023-04-01-preview
- options - TenantActivityLogAlertsClientListByTenantOptions contains the optional parameters for the TenantActivityLogAlertsClient.NewListByTenantPager method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2023-04-01-preview/examples/TenantActivityLogAlertRule_ListByTenant.json
package main import ( "context" "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } pager := clientFactory.NewTenantActivityLogAlertsClient().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.TenantAlertRuleList = armalertsmanagement.TenantAlertRuleList{ // Value: []*armalertsmanagement.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"), // Tags: map[string]*string{ // }, // Properties: &armalertsmanagement.AlertRuleProperties{ // Description: to.Ptr("Description of sample Activity Log Alert service health rule on tenant level events."), // Actions: &armalertsmanagement.ActionList{ // ActionGroups: []*armalertsmanagement.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: &armalertsmanagement.AlertRuleAllOfCondition{ // AllOf: []*armalertsmanagement.AlertRuleAnyOfOrLeafCondition{ // { // Equals: to.Ptr("ServiceHealth"), // Field: to.Ptr("category"), // }}, // }, // Enabled: to.Ptr(true), // TenantScope: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), // }, // }, // { // Name: to.Ptr("SampleActivityLogAlertSHRuleOnTenantLevel"), // Type: to.Ptr("Microsoft.AlertsManagement/TenantActivityLogAlerts"), // ID: to.Ptr("/providers/Microsoft.Management/ManagementGroups/MyManagementGroup/providers/Microsoft.AlertsManagement/TenantActivityLogAlerts/SampleActivityLogAlertSHRuleOnTenantLevel"), // Location: to.Ptr("Global"), // Tags: map[string]*string{ // }, // Properties: &armalertsmanagement.AlertRuleProperties{ // Description: to.Ptr("Description of sample Activity Log Alert service health rule on tenant level events."), // Actions: &armalertsmanagement.ActionList{ // ActionGroups: []*armalertsmanagement.ActionGroup{ // { // ActionGroupID: to.Ptr("/providers/Microsoft.Management/ManagementGroups/MyManagementGroup/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: &armalertsmanagement.AlertRuleAllOfCondition{ // AllOf: []*armalertsmanagement.AlertRuleAnyOfOrLeafCondition{ // { // Equals: to.Ptr("ServiceHealth"), // Field: to.Ptr("category"), // }}, // }, // Enabled: to.Ptr(true), // TenantScope: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), // }, // }}, // } } }
Output:
func (*TenantActivityLogAlertsClient) Update ¶ added in v0.10.0
func (client *TenantActivityLogAlertsClient) Update(ctx context.Context, managementGroupName string, alertRuleName string, tenantActivityLogAlertRulePatch TenantAlertRulePatchObject, options *TenantActivityLogAlertsClientUpdateOptions) (TenantActivityLogAlertsClientUpdateResponse, 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 name of the management group. The name is case insensitive.
- alertRuleName - The name of the Tenant Activity Log Alert rule.
- tenantActivityLogAlertRulePatch - Parameters supplied to the operation.
- options - TenantActivityLogAlertsClientUpdateOptions contains the optional parameters for the TenantActivityLogAlertsClient.Update method.
Example ¶
Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2023-04-01-preview/examples/TenantActivityLogAlertRule_UpdateRule.json
package main import ( "context" "log" "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/alertsmanagement/armalertsmanagement" ) func main() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewTenantActivityLogAlertsClient().Update(ctx, "72f988bf-86f1-41af-91ab-2d7cd011db47", "SampleActivityLogAlertSHRuleOnTenantLevel", armalertsmanagement.TenantAlertRulePatchObject{ Properties: &armalertsmanagement.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.TenantActivityLogAlertResource = armalertsmanagement.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"), // Tags: map[string]*string{ // "key1": to.Ptr("value1"), // "key2": to.Ptr("value2"), // }, // Properties: &armalertsmanagement.AlertRuleProperties{ // Description: to.Ptr("Description of sample Activity Log Alert service health rule on tenant level events."), // Actions: &armalertsmanagement.ActionList{ // ActionGroups: []*armalertsmanagement.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: &armalertsmanagement.AlertRuleAllOfCondition{ // AllOf: []*armalertsmanagement.AlertRuleAnyOfOrLeafCondition{ // { // Equals: to.Ptr("ServiceHealth"), // Field: to.Ptr("category"), // }}, // }, // Enabled: to.Ptr(false), // TenantScope: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), // }, // } }
Output:
type TenantActivityLogAlertsClientCreateOrUpdateOptions ¶ added in v0.10.0
type TenantActivityLogAlertsClientCreateOrUpdateOptions struct { }
TenantActivityLogAlertsClientCreateOrUpdateOptions contains the optional parameters for the TenantActivityLogAlertsClient.CreateOrUpdate method.
type TenantActivityLogAlertsClientCreateOrUpdateResponse ¶ added in v0.10.0
type TenantActivityLogAlertsClientCreateOrUpdateResponse struct { // A Tenant Activity Log Alert rule resource. TenantActivityLogAlertResource }
TenantActivityLogAlertsClientCreateOrUpdateResponse contains the response from method TenantActivityLogAlertsClient.CreateOrUpdate.
type TenantActivityLogAlertsClientDeleteOptions ¶ added in v0.10.0
type TenantActivityLogAlertsClientDeleteOptions struct { }
TenantActivityLogAlertsClientDeleteOptions contains the optional parameters for the TenantActivityLogAlertsClient.Delete method.
type TenantActivityLogAlertsClientDeleteResponse ¶ added in v0.10.0
type TenantActivityLogAlertsClientDeleteResponse struct { }
TenantActivityLogAlertsClientDeleteResponse contains the response from method TenantActivityLogAlertsClient.Delete.
type TenantActivityLogAlertsClientGetOptions ¶ added in v0.10.0
type TenantActivityLogAlertsClientGetOptions struct { }
TenantActivityLogAlertsClientGetOptions contains the optional parameters for the TenantActivityLogAlertsClient.Get method.
type TenantActivityLogAlertsClientGetResponse ¶ added in v0.10.0
type TenantActivityLogAlertsClientGetResponse struct { // A Tenant Activity Log Alert rule resource. TenantActivityLogAlertResource }
TenantActivityLogAlertsClientGetResponse contains the response from method TenantActivityLogAlertsClient.Get.
type TenantActivityLogAlertsClientListByManagementGroupOptions ¶ added in v0.10.0
type TenantActivityLogAlertsClientListByManagementGroupOptions struct { }
TenantActivityLogAlertsClientListByManagementGroupOptions contains the optional parameters for the TenantActivityLogAlertsClient.NewListByManagementGroupPager method.
type TenantActivityLogAlertsClientListByManagementGroupResponse ¶ added in v0.10.0
type TenantActivityLogAlertsClientListByManagementGroupResponse struct { // A list of Tenant Activity Log Alert rules. TenantAlertRuleList }
TenantActivityLogAlertsClientListByManagementGroupResponse contains the response from method TenantActivityLogAlertsClient.NewListByManagementGroupPager.
type TenantActivityLogAlertsClientListByTenantOptions ¶ added in v0.10.0
type TenantActivityLogAlertsClientListByTenantOptions struct { }
TenantActivityLogAlertsClientListByTenantOptions contains the optional parameters for the TenantActivityLogAlertsClient.NewListByTenantPager method.
type TenantActivityLogAlertsClientListByTenantResponse ¶ added in v0.10.0
type TenantActivityLogAlertsClientListByTenantResponse struct { // A list of Tenant Activity Log Alert rules. TenantAlertRuleList }
TenantActivityLogAlertsClientListByTenantResponse contains the response from method TenantActivityLogAlertsClient.NewListByTenantPager.
type TenantActivityLogAlertsClientUpdateOptions ¶ added in v0.10.0
type TenantActivityLogAlertsClientUpdateOptions struct { }
TenantActivityLogAlertsClientUpdateOptions contains the optional parameters for the TenantActivityLogAlertsClient.Update method.
type TenantActivityLogAlertsClientUpdateResponse ¶ added in v0.10.0
type TenantActivityLogAlertsClientUpdateResponse struct { // A Tenant Activity Log Alert rule resource. TenantActivityLogAlertResource }
TenantActivityLogAlertsClientUpdateResponse contains the response from method TenantActivityLogAlertsClient.Update.
type TenantAlertRuleList ¶ added in v0.10.0
type TenantAlertRuleList struct { // Provides the link to retrieve the next set of elements. NextLink *string // The list of Tenant Activity Log Alert rules. Value []*TenantActivityLogAlertResource }
TenantAlertRuleList - A list of Tenant Activity Log Alert rules.
func (TenantAlertRuleList) MarshalJSON ¶ added in v0.10.0
func (t TenantAlertRuleList) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type TenantAlertRuleList.
func (*TenantAlertRuleList) UnmarshalJSON ¶ added in v0.10.0
func (t *TenantAlertRuleList) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type TenantAlertRuleList.
type TenantAlertRulePatchObject ¶ added in v0.10.0
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 ¶ added in v0.10.0
func (t TenantAlertRulePatchObject) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type TenantAlertRulePatchObject.
func (*TenantAlertRulePatchObject) UnmarshalJSON ¶ added in v0.10.0
func (t *TenantAlertRulePatchObject) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type TenantAlertRulePatchObject.
type TenantAlertRulePatchProperties ¶ added in v0.10.0
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 ¶ added in v0.10.0
func (t TenantAlertRulePatchProperties) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type TenantAlertRulePatchProperties.
func (*TenantAlertRulePatchProperties) UnmarshalJSON ¶ added in v0.10.0
func (t *TenantAlertRulePatchProperties) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type TenantAlertRulePatchProperties.
type TimeRange ¶
type TimeRange string
func PossibleTimeRangeValues ¶
func PossibleTimeRangeValues() []TimeRange
PossibleTimeRangeValues returns the possible values for the TimeRange const type.
type WeeklyRecurrence ¶ added in v0.3.0
type WeeklyRecurrence struct { // REQUIRED; Specifies the values for weekly recurrence pattern. DaysOfWeek []*DaysOfWeek // REQUIRED; Specifies when the recurrence should be applied. RecurrenceType *RecurrenceType // End time for recurrence. EndTime *string // Start time for recurrence. StartTime *string }
WeeklyRecurrence - Weekly recurrence object.
func (*WeeklyRecurrence) GetRecurrence ¶ added in v0.3.0
func (w *WeeklyRecurrence) GetRecurrence() *Recurrence
GetRecurrence implements the RecurrenceClassification interface for type WeeklyRecurrence.
func (WeeklyRecurrence) MarshalJSON ¶ added in v0.3.0
func (w WeeklyRecurrence) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type WeeklyRecurrence.
func (*WeeklyRecurrence) UnmarshalJSON ¶ added in v0.3.0
func (w *WeeklyRecurrence) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type WeeklyRecurrence.
Source Files ¶
- alertprocessingrules_client.go
- alertrulerecommendations_client.go
- alerts_client.go
- build.go
- client_factory.go
- constants.go
- interfaces.go
- models.go
- models_serde.go
- operations_client.go
- options.go
- polymorphic_helpers.go
- prometheusrulegroups_client.go
- responses.go
- smartgroups_client.go
- tenantactivitylogalerts_client.go
- time_rfc3339.go