armprometheusrulegroups

package module
v0.1.0 Latest Latest
Warning

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

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

README

Azure Prometheus Rule Groups Module for Go

The armprometheusrulegroups module provides operations for working with Azure Prometheus Rule Groups.

Source code

Getting started

Prerequisites

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

Install the package

This project uses Go modules for versioning and dependency management.

Install the Azure Prometheus Rule Groups module:

go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/prometheusrulegroups/armprometheusrulegroups

Authorization

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

cred, err := azidentity.NewDefaultAzureCredential(nil)

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

Client Factory

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

clientFactory, err := armprometheusrulegroups.NewClientFactory(<subscription ID>, cred, nil)

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

options := arm.ClientOptions {
    ClientOptions: azcore.ClientOptions {
        Cloud: cloud.AzureChina,
    },
}
clientFactory, err := armprometheusrulegroups.NewClientFactory(<subscription ID>, cred, &options)

Clients

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

client := clientFactory.NewClient()

Fakes

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

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

Provide Feedback

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

Contributing

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

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

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

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

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

func NewClient

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

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

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

func (*Client) CreateOrUpdate

func (client *Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleGroupName string, parameters PrometheusRuleGroupResource, options *ClientCreateOrUpdateOptions) (ClientCreateOrUpdateResponse, error)

CreateOrUpdate - Create or update a Prometheus rule group definition. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2023-03-01

  • 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 - ClientCreateOrUpdateOptions contains the optional parameters for the Client.CreateOrUpdate method.
Example (CreateOrUpdateAClusterCentricPrometheusRuleGroup)

Generated from example definition: 2023-03-01/createOrUpdateClusterCentricRuleGroup.json

package main

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

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armprometheusrulegroups.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().CreateOrUpdate(ctx, "promResourceGroup", "myPrometheusRuleGroup", armprometheusrulegroups.PrometheusRuleGroupResource{
		Location: to.Ptr("East US"),
		Properties: &armprometheusrulegroups.PrometheusRuleGroupProperties{
			Description: to.Ptr("This is a rule group with culster centric configuration"),
			ClusterName: to.Ptr("myClusterName"),
			Interval:    to.Ptr("PT10M"),
			Rules: []*armprometheusrulegroups.PrometheusRule{
				{
					Actions: []*armprometheusrulegroups.PrometheusRuleGroupAction{},
					Alert:   to.Ptr("Billing_Processing_Very_Slow"),
					Annotations: map[string]*string{
						"annotationName1": to.Ptr("annotationValue1"),
					},
					Enabled:    to.Ptr(true),
					Expression: to.Ptr("job_type:billing_jobs_duration_seconds:99p5m > 30"),
					For:        to.Ptr("PT5M"),
					Labels: map[string]*string{
						"team": to.Ptr("prod"),
					},
					ResolveConfiguration: &armprometheusrulegroups.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/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"),
				to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/myResourceGroup/providers/Microsoft.ContainerService/managedClusters/myClusterName"),
			},
		},
	}, 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 = armprometheusrulegroups.ClientCreateOrUpdateResponse{
	// 	PrometheusRuleGroupResource: &armprometheusrulegroups.PrometheusRuleGroupResource{
	// 		Type: to.Ptr("Microsoft.AlertsManagement/prometheusRuleGroups"),
	// 		ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/promResourceGroup/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup"),
	// 		Location: to.Ptr("East US"),
	// 		Properties: &armprometheusrulegroups.PrometheusRuleGroupProperties{
	// 			Description: to.Ptr("This is a rule group with culster centric configuration"),
	// 			ClusterName: to.Ptr("myClusterName"),
	// 			Interval: to.Ptr("PT10M"),
	// 			Rules: []*armprometheusrulegroups.PrometheusRule{
	// 				{
	// 					Actions: []*armprometheusrulegroups.PrometheusRuleGroupAction{
	// 					},
	// 					Alert: to.Ptr("Billing_Processing_Very_Slow"),
	// 					Annotations: map[string]*string{
	// 						"annotationName1": to.Ptr("annotationValue1"),
	// 					},
	// 					Enabled: to.Ptr(true),
	// 					Expression: to.Ptr("job_type:billing_jobs_duration_seconds:99p5m > 30"),
	// 					For: to.Ptr("PT5M"),
	// 					Labels: map[string]*string{
	// 						"team": to.Ptr("prod"),
	// 					},
	// 					ResolveConfiguration: &armprometheusrulegroups.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/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"),
	// 				to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/myResourceGroup/providers/Microsoft.ContainerService/managedClusters/myClusterName"),
	// 			},
	// 		},
	// 	},
	// }
}
Example (CreateOrUpdateAPrometheusRuleGroup)

Generated from example definition: 2023-03-01/createOrUpdatePrometheusRuleGroup.json

package main

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

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armprometheusrulegroups.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().CreateOrUpdate(ctx, "promResourceGroup", "myPrometheusRuleGroup", armprometheusrulegroups.PrometheusRuleGroupResource{
		Location: to.Ptr("East US"),
		Properties: &armprometheusrulegroups.PrometheusRuleGroupProperties{
			Description: to.Ptr("This is the description of the following rule group"),
			ClusterName: to.Ptr("myClusterName"),
			Enabled:     to.Ptr(true),
			Interval:    to.Ptr("PT10M"),
			Rules: []*armprometheusrulegroups.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: []*armprometheusrulegroups.PrometheusRuleGroupAction{
						{
							ActionGroupID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup"),
							ActionProperties: map[string]*string{
								"key11": to.Ptr("value11"),
								"key12": to.Ptr("value12"),
							},
						},
						{
							ActionGroupID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup"),
							ActionProperties: map[string]*string{
								"key21": to.Ptr("value21"),
								"key22": to.Ptr("value22"),
							},
						},
					},
					Alert: to.Ptr("Billing_Processing_Very_Slow"),
					Annotations: map[string]*string{
						"annotationName1": to.Ptr("annotationValue1"),
					},
					Enabled:    to.Ptr(true),
					Expression: to.Ptr("job_type:billing_jobs_duration_seconds:99p5m > 30"),
					For:        to.Ptr("PT5M"),
					Labels: map[string]*string{
						"team": to.Ptr("prod"),
					},
					ResolveConfiguration: &armprometheusrulegroups.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/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"),
			},
		},
	}, 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 = armprometheusrulegroups.ClientCreateOrUpdateResponse{
	// 	PrometheusRuleGroupResource: &armprometheusrulegroups.PrometheusRuleGroupResource{
	// 		Type: to.Ptr("Microsoft.AlertsManagement/prometheusRuleGroups"),
	// 		ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/promResourceGroup/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup"),
	// 		Location: to.Ptr("East US"),
	// 		Properties: &armprometheusrulegroups.PrometheusRuleGroupProperties{
	// 			Description: to.Ptr("This is the description of the following rule group"),
	// 			ClusterName: to.Ptr("myClusterName"),
	// 			Enabled: to.Ptr(true),
	// 			Interval: to.Ptr("PT10M"),
	// 			Rules: []*armprometheusrulegroups.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: []*armprometheusrulegroups.PrometheusRuleGroupAction{
	// 						{
	// 							ActionGroupID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup"),
	// 							ActionProperties: map[string]*string{
	// 								"key11": to.Ptr("value11"),
	// 								"key12": to.Ptr("value12"),
	// 							},
	// 						},
	// 						{
	// 							ActionGroupID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup"),
	// 							ActionProperties: map[string]*string{
	// 								"key21": to.Ptr("value21"),
	// 								"key22": to.Ptr("value22"),
	// 							},
	// 						},
	// 					},
	// 					Alert: to.Ptr("Billing_Processing_Very_Slow"),
	// 					Annotations: map[string]*string{
	// 						"annotationName1": to.Ptr("annotationValue1"),
	// 					},
	// 					Enabled: to.Ptr(true),
	// 					Expression: to.Ptr("job_type:billing_jobs_duration_seconds:99p5m > 30"),
	// 					For: to.Ptr("PT5M"),
	// 					Labels: map[string]*string{
	// 						"team": to.Ptr("prod"),
	// 					},
	// 					ResolveConfiguration: &armprometheusrulegroups.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/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"),
	// 			},
	// 		},
	// 	},
	// }
}

func (*Client) Delete

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

Delete - Delete a Prometheus rule group definition. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2023-03-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • ruleGroupName - The name of the rule group.
  • options - ClientDeleteOptions contains the optional parameters for the Client.Delete method.
Example

Generated from example definition: 2023-03-01/deletePrometheusRuleGroup.json

package main

import (
	"context"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/prometheusrulegroups/armprometheusrulegroups"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armprometheusrulegroups.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().Delete(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 = armprometheusrulegroups.ClientDeleteResponse{
	// }
}

func (*Client) Get

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

Get - Retrieve a Prometheus rule group definition. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2023-03-01

  • resourceGroupName - The name of the resource group. The name is case insensitive.
  • ruleGroupName - The name of the rule group.
  • options - ClientGetOptions contains the optional parameters for the Client.Get method.
Example

Generated from example definition: 2023-03-01/getPrometheusRuleGroup.json

package main

import (
	"context"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/prometheusrulegroups/armprometheusrulegroups"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armprometheusrulegroups.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().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 = armprometheusrulegroups.ClientGetResponse{
	// 	PrometheusRuleGroupResource: &armprometheusrulegroups.PrometheusRuleGroupResource{
	// 		Type: to.Ptr("Microsoft.AlertsManagement/prometheusRuleGroups"),
	// 		ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/promResourceGroup/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup"),
	// 		Location: to.Ptr("East US"),
	// 		Properties: &armprometheusrulegroups.PrometheusRuleGroupProperties{
	// 			Description: to.Ptr("This is the description of the following rule group"),
	// 			ClusterName: to.Ptr("myClusterName"),
	// 			Enabled: to.Ptr(true),
	// 			Interval: to.Ptr("PT10M"),
	// 			Rules: []*armprometheusrulegroups.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: []*armprometheusrulegroups.PrometheusRuleGroupAction{
	// 						{
	// 							ActionGroupID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup"),
	// 							ActionProperties: map[string]*string{
	// 								"key11": to.Ptr("value11"),
	// 								"key12": to.Ptr("value12"),
	// 							},
	// 						},
	// 						{
	// 							ActionGroupID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup"),
	// 							ActionProperties: map[string]*string{
	// 								"key21": to.Ptr("value21"),
	// 								"key22": to.Ptr("value22"),
	// 							},
	// 						},
	// 					},
	// 					Alert: to.Ptr("Billing_Processing_Very_Slow"),
	// 					Annotations: map[string]*string{
	// 						"annotationName1": to.Ptr("annotationValue1"),
	// 					},
	// 					Enabled: to.Ptr(true),
	// 					Expression: to.Ptr("job_type:billing_jobs_duration_seconds:99p5m > 30"),
	// 					For: to.Ptr("PT5M"),
	// 					Labels: map[string]*string{
	// 						"team": to.Ptr("prod"),
	// 					},
	// 					ResolveConfiguration: &armprometheusrulegroups.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/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"),
	// 			},
	// 		},
	// 	},
	// }
}

func (*Client) NewListByResourceGroupPager

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

NewListByResourceGroupPager - Retrieve Prometheus rule group definitions in a resource group.

Generated from API version 2023-03-01

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

Generated from example definition: 2023-03-01/listPrometheusRuleGroups.json

package main

import (
	"context"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/prometheusrulegroups/armprometheusrulegroups"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armprometheusrulegroups.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewClient().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 = armprometheusrulegroups.ClientListByResourceGroupResponse{
		// 	PrometheusRuleGroupResourceCollection: armprometheusrulegroups.PrometheusRuleGroupResourceCollection{
		// 		Value: []*armprometheusrulegroups.PrometheusRuleGroupResource{
		// 			{
		// 				Type: to.Ptr("Microsoft.AlertsManagement/prometheusRuleGroups"),
		// 				ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/promResourceGroup/providers/Microsoft.AlertsManagement/prometheusRuleGroups/ruleGroupName1"),
		// 				Location: to.Ptr("East US"),
		// 				Properties: &armprometheusrulegroups.PrometheusRuleGroupProperties{
		// 					Description: to.Ptr("This is the description of the following rule group"),
		// 					ClusterName: to.Ptr("myClusterName"),
		// 					Enabled: to.Ptr(true),
		// 					Interval: to.Ptr("PT10M"),
		// 					Rules: []*armprometheusrulegroups.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: []*armprometheusrulegroups.PrometheusRuleGroupAction{
		// 								{
		// 									ActionGroupID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup"),
		// 									ActionProperties: map[string]*string{
		// 										"key11": to.Ptr("value11"),
		// 										"key12": to.Ptr("value12"),
		// 									},
		// 								},
		// 								{
		// 									ActionGroupID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup"),
		// 									ActionProperties: map[string]*string{
		// 										"key21": to.Ptr("value21"),
		// 										"key22": to.Ptr("value22"),
		// 									},
		// 								},
		// 							},
		// 							Alert: to.Ptr("Billing_Processing_Very_Slow"),
		// 							Annotations: map[string]*string{
		// 								"annotationName1": to.Ptr("annotationValue1"),
		// 							},
		// 							Enabled: to.Ptr(true),
		// 							Expression: to.Ptr("job_type:billing_jobs_duration_seconds:99p5m > 30"),
		// 							For: to.Ptr("PT5M"),
		// 							Labels: map[string]*string{
		// 								"team": to.Ptr("prod"),
		// 							},
		// 							ResolveConfiguration: &armprometheusrulegroups.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/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"),
		// 					},
		// 				},
		// 			},
		// 			{
		// 				Type: to.Ptr("Microsoft.AlertsManagement/prometheusRuleGroups"),
		// 				ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/promResourceGroup/providers/Microsoft.AlertsManagement/prometheusRuleGroups/ruleGroupName2"),
		// 				Location: to.Ptr("East US"),
		// 				Properties: &armprometheusrulegroups.PrometheusRuleGroupProperties{
		// 					Description: to.Ptr("This is the description of the following rule group"),
		// 					ClusterName: to.Ptr("myClusterName"),
		// 					Enabled: to.Ptr(true),
		// 					Interval: to.Ptr("PT10M"),
		// 					Rules: []*armprometheusrulegroups.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: []*armprometheusrulegroups.PrometheusRuleGroupAction{
		// 								{
		// 									ActionGroupID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup"),
		// 									ActionProperties: map[string]*string{
		// 										"key11": to.Ptr("value11"),
		// 										"key12": to.Ptr("value12"),
		// 									},
		// 								},
		// 								{
		// 									ActionGroupID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup"),
		// 									ActionProperties: map[string]*string{
		// 										"key21": to.Ptr("value21"),
		// 										"key22": to.Ptr("value22"),
		// 									},
		// 								},
		// 							},
		// 							Alert: to.Ptr("Billing_Processing_Very_Slow"),
		// 							Annotations: map[string]*string{
		// 								"annotationName1": to.Ptr("annotationValue1"),
		// 							},
		// 							Enabled: to.Ptr(true),
		// 							Expression: to.Ptr("job_type:billing_jobs_duration_seconds:99p5m > 30"),
		// 							For: to.Ptr("PT5M"),
		// 							Labels: map[string]*string{
		// 								"team": to.Ptr("prod"),
		// 							},
		// 							ResolveConfiguration: &armprometheusrulegroups.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/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"),
		// 					},
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}

func (*Client) NewListBySubscriptionPager

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

NewListBySubscriptionPager - Retrieve Prometheus all rule group definitions in a subscription.

Generated from API version 2023-03-01

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

Generated from example definition: 2023-03-01/listSubscriptionPrometheusRuleGroups.json

package main

import (
	"context"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/prometheusrulegroups/armprometheusrulegroups"
	"log"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armprometheusrulegroups.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewClient().NewListBySubscriptionPager(nil)
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page = armprometheusrulegroups.ClientListBySubscriptionResponse{
		// 	PrometheusRuleGroupResourceCollection: armprometheusrulegroups.PrometheusRuleGroupResourceCollection{
		// 		Value: []*armprometheusrulegroups.PrometheusRuleGroupResource{
		// 			{
		// 				Type: to.Ptr("Microsoft.AlertsManagement/prometheusRuleGroups"),
		// 				ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/resourceGroupName1/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup"),
		// 				Location: to.Ptr("East US"),
		// 				Properties: &armprometheusrulegroups.PrometheusRuleGroupProperties{
		// 					Description: to.Ptr("This is the description of the following rule group"),
		// 					ClusterName: to.Ptr("myClusterName"),
		// 					Enabled: to.Ptr(true),
		// 					Interval: to.Ptr("PT10M"),
		// 					Rules: []*armprometheusrulegroups.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: []*armprometheusrulegroups.PrometheusRuleGroupAction{
		// 								{
		// 									ActionGroupID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup"),
		// 									ActionProperties: map[string]*string{
		// 										"key11": to.Ptr("value11"),
		// 										"key12": to.Ptr("value12"),
		// 									},
		// 								},
		// 								{
		// 									ActionGroupID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup"),
		// 									ActionProperties: map[string]*string{
		// 										"key21": to.Ptr("value21"),
		// 										"key22": to.Ptr("value22"),
		// 									},
		// 								},
		// 							},
		// 							Alert: to.Ptr("Billing_Processing_Very_Slow"),
		// 							Annotations: map[string]*string{
		// 								"annotationName1": to.Ptr("annotationValue1"),
		// 							},
		// 							Enabled: to.Ptr(true),
		// 							Expression: to.Ptr("job_type:billing_jobs_duration_seconds:99p5m > 30"),
		// 							For: to.Ptr("PT5M"),
		// 							Labels: map[string]*string{
		// 								"team": to.Ptr("prod"),
		// 							},
		// 							ResolveConfiguration: &armprometheusrulegroups.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/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"),
		// 					},
		// 				},
		// 			},
		// 			{
		// 				Type: to.Ptr("Microsoft.AlertsManagement/prometheusRuleGroups"),
		// 				ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/resourceGroupName2/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup"),
		// 				Location: to.Ptr("East US"),
		// 				Properties: &armprometheusrulegroups.PrometheusRuleGroupProperties{
		// 					Description: to.Ptr("This is the description of the following rule group"),
		// 					ClusterName: to.Ptr("myClusterName"),
		// 					Enabled: to.Ptr(true),
		// 					Interval: to.Ptr("PT10M"),
		// 					Rules: []*armprometheusrulegroups.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: []*armprometheusrulegroups.PrometheusRuleGroupAction{
		// 								{
		// 									ActionGroupID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup"),
		// 									ActionProperties: map[string]*string{
		// 										"key11": to.Ptr("value11"),
		// 										"key12": to.Ptr("value12"),
		// 									},
		// 								},
		// 								{
		// 									ActionGroupID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup"),
		// 									ActionProperties: map[string]*string{
		// 										"key21": to.Ptr("value21"),
		// 										"key22": to.Ptr("value22"),
		// 									},
		// 								},
		// 							},
		// 							Alert: to.Ptr("Billing_Processing_Very_Slow"),
		// 							Annotations: map[string]*string{
		// 								"annotationName1": to.Ptr("annotationValue1"),
		// 							},
		// 							Enabled: to.Ptr(true),
		// 							Expression: to.Ptr("job_type:billing_jobs_duration_seconds:99p5m > 30"),
		// 							For: to.Ptr("PT5M"),
		// 							Labels: map[string]*string{
		// 								"team": to.Ptr("prod"),
		// 							},
		// 							ResolveConfiguration: &armprometheusrulegroups.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/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"),
		// 					},
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}

func (*Client) Update

func (client *Client) Update(ctx context.Context, resourceGroupName string, ruleGroupName string, parameters PrometheusRuleGroupResourcePatchParameters, options *ClientUpdateOptions) (ClientUpdateResponse, error)

Update - Update an Prometheus rule group definition. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2023-03-01

  • 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 - ClientUpdateOptions contains the optional parameters for the Client.Update method.
Example

Generated from example definition: 2023-03-01/patchPrometheusRuleGroup.json

package main

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

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armprometheusrulegroups.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().Update(ctx, "promResourceGroup", "myPrometheusRuleGroup", armprometheusrulegroups.PrometheusRuleGroupResourcePatchParameters{
		Properties: &armprometheusrulegroups.PrometheusRuleGroupResourcePatchParametersProperties{
			Enabled: to.Ptr(false),
		},
		Tags: map[string]*string{
			"tag1": to.Ptr("tagValueFromPatch"),
		},
	}, 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 = armprometheusrulegroups.ClientUpdateResponse{
	// 	PrometheusRuleGroupResource: &armprometheusrulegroups.PrometheusRuleGroupResource{
	// 		Type: to.Ptr("Microsoft.AlertsManagement/prometheusRuleGroups"),
	// 		ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/promResourceGroup/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup"),
	// 		Location: to.Ptr("East US"),
	// 		Properties: &armprometheusrulegroups.PrometheusRuleGroupProperties{
	// 			Description: to.Ptr("This is the description of the following rule group"),
	// 			ClusterName: to.Ptr("myClusterName"),
	// 			Enabled: to.Ptr(false),
	// 			Interval: to.Ptr("PT10M"),
	// 			Rules: []*armprometheusrulegroups.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: []*armprometheusrulegroups.PrometheusRuleGroupAction{
	// 						{
	// 							ActionGroupID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup"),
	// 							ActionProperties: map[string]*string{
	// 								"key11": to.Ptr("value11"),
	// 								"key12": to.Ptr("value12"),
	// 							},
	// 						},
	// 						{
	// 							ActionGroupID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup"),
	// 							ActionProperties: map[string]*string{
	// 								"key21": to.Ptr("value21"),
	// 								"key22": to.Ptr("value22"),
	// 							},
	// 						},
	// 					},
	// 					Alert: to.Ptr("Billing_Processing_Very_Slow"),
	// 					Annotations: map[string]*string{
	// 						"annotationName1": to.Ptr("annotationValue1"),
	// 					},
	// 					Enabled: to.Ptr(true),
	// 					Expression: to.Ptr("job_type:billing_jobs_duration_seconds:99p5m > 30"),
	// 					For: to.Ptr("PT5M"),
	// 					Labels: map[string]*string{
	// 						"team": to.Ptr("prod"),
	// 					},
	// 					ResolveConfiguration: &armprometheusrulegroups.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/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"),
	// 			},
	// 		},
	// 		Tags: map[string]*string{
	// 			"tag1": to.Ptr("tagValueFromPatch"),
	// 		},
	// 	},
	// }
}

type ClientCreateOrUpdateOptions

type ClientCreateOrUpdateOptions struct {
}

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

type ClientCreateOrUpdateResponse

type ClientCreateOrUpdateResponse struct {
	// The Prometheus rule group resource.
	PrometheusRuleGroupResource
}

ClientCreateOrUpdateResponse contains the response from method Client.CreateOrUpdate.

type ClientDeleteOptions

type ClientDeleteOptions struct {
}

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

type ClientDeleteResponse

type ClientDeleteResponse struct {
}

ClientDeleteResponse contains the response from method Client.Delete.

type ClientFactory

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

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

func NewClientFactory

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

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

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

func (*ClientFactory) NewClient

func (c *ClientFactory) NewClient() *Client

NewClient creates a new instance of Client.

type ClientGetOptions

type ClientGetOptions struct {
}

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

type ClientGetResponse

type ClientGetResponse struct {
	// The Prometheus rule group resource.
	PrometheusRuleGroupResource
}

ClientGetResponse contains the response from method Client.Get.

type ClientListByResourceGroupOptions

type ClientListByResourceGroupOptions struct {
}

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

type ClientListByResourceGroupResponse

type ClientListByResourceGroupResponse struct {
	// Represents a collection of alert rule resources.
	PrometheusRuleGroupResourceCollection
}

ClientListByResourceGroupResponse contains the response from method Client.NewListByResourceGroupPager.

type ClientListBySubscriptionOptions

type ClientListBySubscriptionOptions struct {
}

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

type ClientListBySubscriptionResponse

type ClientListBySubscriptionResponse struct {
	// Represents a collection of alert rule resources.
	PrometheusRuleGroupResourceCollection
}

ClientListBySubscriptionResponse contains the response from method Client.NewListBySubscriptionPager.

type ClientUpdateOptions

type ClientUpdateOptions struct {
}

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

type ClientUpdateResponse

type ClientUpdateResponse struct {
	// The Prometheus rule group resource.
	PrometheusRuleGroupResource
}

ClientUpdateResponse contains the response from method Client.Update.

type CreatedByType

type CreatedByType string

CreatedByType - The kind of entity that created the resource.

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

func PossibleCreatedByTypeValues

func PossibleCreatedByTypeValues() []CreatedByType

PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type.

type PrometheusRule

type PrometheusRule struct {
	// REQUIRED; The PromQL expression to evaluate. https://prometheus.io/docs/prometheus/latest/querying/basics/. Evaluated periodically
	// as given by 'interval', and the result recorded as a new set of time series with the metric name as given by 'record'.
	Expression *string

	// Actions that are performed when the alert rule becomes active, and when an alert condition is resolved.
	Actions []*PrometheusRuleGroupAction

	// Alert rule name.
	Alert *string

	// The annotations clause specifies a set of informational labels that can be used to store longer additional information
	// such as alert descriptions or runbook links. The annotation values can be templated.
	Annotations map[string]*string

	// Enable/disable rule.
	Enabled *bool

	// The amount of time alert must be active before firing.
	For *string

	// Labels to add or overwrite before storing the result.
	Labels map[string]*string

	// Recorded metrics name.
	Record *string

	// Defines the configuration for resolving fired alerts. Only relevant for alerts.
	ResolveConfiguration *PrometheusRuleResolveConfiguration

	// The severity of the alerts fired by the rule. Must be between 0 and 4.
	Severity *int32
}

PrometheusRule - An Azure Prometheus alerting or recording rule.

func (PrometheusRule) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type PrometheusRule.

func (*PrometheusRule) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type PrometheusRule.

type PrometheusRuleGroupAction

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

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

MarshalJSON implements the json.Marshaller interface for type PrometheusRuleGroupAction.

func (*PrometheusRuleGroupAction) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type PrometheusRuleGroupAction.

type PrometheusRuleGroupProperties

type PrometheusRuleGroupProperties struct {
	// REQUIRED; Defines the rules in the Prometheus rule group.
	Rules []*PrometheusRule

	// REQUIRED; Target Azure Monitor workspaces resource ids. This api-version is currently limited to creating with one scope.
	// This may change in future.
	Scopes []*string

	// Apply rule to data from a specific cluster.
	ClusterName *string

	// Rule group description.
	Description *string

	// Enable/disable rule group.
	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 Azure Prometheus rule group.

func (PrometheusRuleGroupProperties) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type PrometheusRuleGroupProperties.

func (*PrometheusRuleGroupProperties) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type PrometheusRuleGroupProperties.

type PrometheusRuleGroupResource

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

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

MarshalJSON implements the json.Marshaller interface for type PrometheusRuleGroupResource.

func (*PrometheusRuleGroupResource) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type PrometheusRuleGroupResource.

type PrometheusRuleGroupResourceCollection

type PrometheusRuleGroupResourceCollection struct {
	NextLink *string

	// the values for the alert rule resources.
	Value []*PrometheusRuleGroupResource
}

PrometheusRuleGroupResourceCollection - Represents a collection of alert rule resources.

func (PrometheusRuleGroupResourceCollection) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type PrometheusRuleGroupResourceCollection.

func (*PrometheusRuleGroupResourceCollection) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type PrometheusRuleGroupResourceCollection.

type PrometheusRuleGroupResourcePatchParameters

type PrometheusRuleGroupResourcePatchParameters struct {
	Properties *PrometheusRuleGroupResourcePatchParametersProperties

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

PrometheusRuleGroupResourcePatchParameters - The Prometheus rule group resource for patch operations.

func (PrometheusRuleGroupResourcePatchParameters) MarshalJSON

MarshalJSON implements the json.Marshaller interface for type PrometheusRuleGroupResourcePatchParameters.

func (*PrometheusRuleGroupResourcePatchParameters) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type PrometheusRuleGroupResourcePatchParameters.

type PrometheusRuleGroupResourcePatchParametersProperties

type PrometheusRuleGroupResourcePatchParametersProperties struct {
	// the flag that indicates whether the Prometheus rule group is enabled.
	Enabled *bool
}

func (PrometheusRuleGroupResourcePatchParametersProperties) MarshalJSON

MarshalJSON implements the json.Marshaller interface for type PrometheusRuleGroupResourcePatchParametersProperties.

func (*PrometheusRuleGroupResourcePatchParametersProperties) UnmarshalJSON

UnmarshalJSON implements the json.Unmarshaller interface for type PrometheusRuleGroupResourcePatchParametersProperties.

type PrometheusRuleResolveConfiguration

type PrometheusRuleResolveConfiguration struct {
	// Enable alert auto-resolution.
	AutoResolved *bool

	// Alert auto-resolution timeout.
	TimeToResolve *string
}

PrometheusRuleResolveConfiguration - Specifies the Prometheus alert rule configuration.

func (PrometheusRuleResolveConfiguration) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type PrometheusRuleResolveConfiguration.

func (*PrometheusRuleResolveConfiguration) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type PrometheusRuleResolveConfiguration.

type SystemData

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

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

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

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

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

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

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

func (SystemData) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type SystemData.

func (*SystemData) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type SystemData.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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