From baae1f6f62797b1d71a5b4252ef1b1fba4dc3de3 Mon Sep 17 00:00:00 2001 From: Moshe Malka Date: Wed, 15 Mar 2023 09:27:05 +0200 Subject: [PATCH] [Hub Generated] Review request for Microsoft.AlertsManagement to add version stable/2023-03-01 (#22284) * Adds base for updating Microsoft.AlertsManagement from version preview/2021-07-22-preview to version 2023-03-01 * Updates readme * Updates API version in new specs and examples * adding PrometheusRuleGroups stable api-version * rename example titles * improve descriptions * improve examples * fix lintdiff errors * add pattern to rule name * fix pattern * remove validations * add recomandations * change actions * change to last acions property version * run prettier * fix PR review comments --------- Co-authored-by: Moshe Malka --- .../2023-03-01/PrometheusRuleGroups.json | 505 ++++++++++++++++++ .../createOrUpdatePrometheusRuleGroup.json | 182 +++++++ .../examples/deletePrometheusRuleGroup.json | 12 + .../examples/getPrometheusRuleGroup.json | 69 +++ .../examples/listPrometheusRuleGroups.json | 128 +++++ .../listSubscriptionPrometheusRuleGroups.json | 128 +++++ .../examples/patchPrometheusRuleGroup.json | 80 +++ .../resource-manager/readme.md | 15 +- 8 files changed, 1118 insertions(+), 1 deletion(-) create mode 100644 specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json create mode 100644 specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/createOrUpdatePrometheusRuleGroup.json create mode 100644 specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/deletePrometheusRuleGroup.json create mode 100644 specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/getPrometheusRuleGroup.json create mode 100644 specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listPrometheusRuleGroups.json create mode 100644 specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listSubscriptionPrometheusRuleGroups.json create mode 100644 specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/patchPrometheusRuleGroup.json diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json new file mode 100644 index 000000000000..eaa743e0060f --- /dev/null +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json @@ -0,0 +1,505 @@ +{ + "swagger": "2.0", + "info": { + "version": "2023-03-01", + "title": "Azure Alerts Management Service Resource Provider", + "description": "Azure Alerts Management Service provides a single pane of glass of alerts across Azure Monitor." + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "paths": { + "/subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/prometheusRuleGroups": { + "get": { + "tags": [ + "PrometheusRuleGroups" + ], + "description": "Retrieve Prometheus all rule group definitions in a subscription.", + "operationId": "PrometheusRuleGroups_ListBySubscription", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Successful request for a list of Prometheus rule groups", + "schema": { + "$ref": "#/definitions/PrometheusRuleGroupResourceCollection" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": null + }, + "x-ms-examples": { + "List Subscription Resource PrometheusRuleGroups": { + "$ref": "./examples/listSubscriptionPrometheusRuleGroups.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AlertsManagement/prometheusRuleGroups": { + "get": { + "tags": [ + "PrometheusRuleGroups" + ], + "description": "Retrieve Prometheus rule group definitions in a resource group.", + "operationId": "PrometheusRuleGroups_ListByResourceGroup", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Successful request for a list of Prometheus rule groups", + "schema": { + "$ref": "#/definitions/PrometheusRuleGroupResourceCollection" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": null + }, + "x-ms-examples": { + "List Resource group PrometheusRuleGroups": { + "$ref": "./examples/listPrometheusRuleGroups.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AlertsManagement/prometheusRuleGroups/{ruleGroupName}": { + "get": { + "tags": [ + "PrometheusRuleGroups" + ], + "description": "Retrieve a Prometheus rule group definition.", + "operationId": "PrometheusRuleGroups_Get", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/RuleGroupNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Successful request for a list of Prometheus rule groups", + "schema": { + "$ref": "#/definitions/PrometheusRuleGroupResource" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Get a PrometheusRuleGroup": { + "$ref": "./examples/getPrometheusRuleGroup.json" + } + } + }, + "put": { + "tags": [ + "PrometheusRuleGroups" + ], + "description": "Create or update a Prometheus rule group definition.", + "operationId": "PrometheusRuleGroups_CreateOrUpdate", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/RuleGroupNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "name": "parameters", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PrometheusRuleGroupResource" + }, + "description": "The parameters of the rule group to create or update." + } + ], + "responses": { + "200": { + "description": "OK (Updated).", + "schema": { + "$ref": "#/definitions/PrometheusRuleGroupResource" + } + }, + "201": { + "description": "Created (New Alert rule was created).", + "schema": { + "$ref": "#/definitions/PrometheusRuleGroupResource" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Create or Update a PrometheusRuleGroup": { + "$ref": "./examples/createOrUpdatePrometheusRuleGroup.json" + } + } + }, + "patch": { + "tags": [ + "PrometheusRuleGroups" + ], + "description": "Update an Prometheus rule group definition.", + "operationId": "PrometheusRuleGroups_Update", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/RuleGroupNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "name": "parameters", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PrometheusRuleGroupResourcePatchParameters" + }, + "description": "The parameters of the rule group to update." + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/PrometheusRuleGroupResource" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Patch a PrometheusRuleGroup": { + "$ref": "./examples/patchPrometheusRuleGroup.json" + } + } + }, + "delete": { + "tags": [ + "PrometheusRuleGroups" + ], + "description": "Delete a Prometheus rule group definition.", + "operationId": "PrometheusRuleGroups_Delete", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/RuleGroupNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Successful request to delete a Prometheus rule group" + }, + "204": { + "description": "No content: the request was successful, but the response is empty" + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Delete a PrometheusRuleGroup": { + "$ref": "./examples/deletePrometheusRuleGroup.json" + } + } + } + } + }, + "definitions": { + "PrometheusRuleGroupResource": { + "type": "object", + "allOf": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/TrackedResource" + } + ], + "required": [ + "properties" + ], + "properties": { + "properties": { + "x-ms-client-flatten": true, + "$ref": "#/definitions/PrometheusRuleGroupProperties", + "description": "The Prometheus rule group properties of the resource." + } + }, + "description": "The Prometheus rule group resource." + }, + "PrometheusRuleGroupResourcePatchParameters": { + "type": "object", + "properties": { + "tags": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Resource tags" + }, + "properties": { + "type": "object", + "x-ms-client-flatten": true, + "properties": { + "enabled": { + "type": "boolean", + "description": "the flag that indicates whether the Prometheus rule group is enabled." + } + } + } + }, + "description": "The Prometheus rule group resource for patch operations." + }, + "PrometheusRuleGroupResourceCollection": { + "type": "object", + "properties": { + "value": { + "type": "array", + "items": { + "$ref": "#/definitions/PrometheusRuleGroupResource" + }, + "description": "the values for the alert rule resources." + } + }, + "description": "Represents a collection of alert rule resources." + }, + "PrometheusRuleGroupProperties": { + "description": "An Azure Prometheus rule group.", + "type": "object", + "required": [ + "scopes", + "rules" + ], + "properties": { + "description": { + "type": "string", + "description": "Rule group description." + }, + "enabled": { + "type": "boolean", + "description": "Enable/disable rule group." + }, + "clusterName": { + "type": "string", + "description": "Apply rule to data from a specific cluster." + }, + "scopes": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Target Azure Monitor workspaces resource ids. This api-version is currently limited to creating with one scope. This may change in future." + }, + "interval": { + "type": "string", + "description": "The interval in which to run the Prometheus rule group represented in ISO 8601 duration format. Should be between 1 and 15 minutes", + "format": "duration" + }, + "rules": { + "type": "array", + "items": { + "$ref": "#/definitions/PrometheusRule" + }, + "description": "Defines the rules in the Prometheus rule group.", + "x-ms-identifiers": [] + } + } + }, + "PrometheusRule": { + "type": "object", + "description": "An Azure Prometheus alerting or recording rule.", + "required": [ + "expression" + ], + "properties": { + "record": { + "description": "Recorded metrics name.", + "type": "string" + }, + "alert": { + "description": "Alert rule name.", + "type": "string" + }, + "enabled": { + "type": "boolean", + "description": "Enable/disable rule." + }, + "expression": { + "description": "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'.", + "type": "string" + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Labels to add or overwrite before storing the result." + }, + "severity": { + "type": "integer", + "format": "int32", + "description": "The severity of the alerts fired by the rule. Must be between 0 and 4." + }, + "for": { + "type": "string", + "description": "The amount of time alert must be active before firing.", + "format": "duration" + }, + "annotations": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "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." + }, + "actions": { + "$ref": "#/definitions/PrometheusRuleGroupActions", + "description": "Actions that are performed when the alert rule becomes active, and when an alert condition is resolved." + }, + "resolveConfiguration": { + "$ref": "#/definitions/PrometheusRuleResolveConfiguration", + "description": "Defines the configuration for resolving fired alerts. Only relevant for alerts." + } + } + }, + "PrometheusRuleGroupActions": { + "type": "array", + "items": { + "$ref": "#/definitions/PrometheusRuleGroupAction" + }, + "x-ms-identifiers": [], + "description": "The array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. Only relevant for alerts." + }, + "PrometheusRuleGroupAction": { + "type": "object", + "description": "An alert action. Only relevant for alerts.", + "properties": { + "actionGroupId": { + "type": "string", + "description": "The resource id of the action group to use." + }, + "actionProperties": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "The properties of an action group object." + } + } + }, + "PrometheusRuleResolveConfiguration": { + "type": "object", + "description": "Specifies the Prometheus alert rule configuration.", + "properties": { + "autoResolved": { + "type": "boolean", + "description": "Enable alert auto-resolution." + }, + "timeToResolve": { + "type": "string", + "description": "Alert auto-resolution timeout.", + "format": "duration" + } + } + } + }, + "parameters": { + "RuleGroupNameParameter": { + "name": "ruleGroupName", + "in": "path", + "required": true, + "type": "string", + "description": "The name of the rule group.", + "x-ms-parameter-location": "method", + "pattern": "^[^:@/#{}%&+*<>?]+$" + } + } +} diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/createOrUpdatePrometheusRuleGroup.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/createOrUpdatePrometheusRuleGroup.json new file mode 100644 index 000000000000..c590ca51d7b9 --- /dev/null +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/createOrUpdatePrometheusRuleGroup.json @@ -0,0 +1,182 @@ +{ + "parameters": { + "subscriptionId": "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", + "resourceGroupName": "promResourceGroup", + "ruleGroupName": "myPrometheusRuleGroup", + "api-version": "2023-03-01", + "parameters": { + "location": "East US", + "properties": { + "description": "This is the description of the following rule group", + "enabled": true, + "interval": "PT10M", + "clusterName": "myClusterName", + "scopes": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace" + ], + "rules": [ + { + "record": "job_type:billing_jobs_duration_seconds:99p5m", + "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))", + "labels": { + "team": "prod" + } + }, + { + "alert": "Billing_Processing_Very_Slow", + "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "enabled": true, + "severity": 2, + "for": "PT5M", + "labels": { + "team": "prod" + }, + "annotations": { + "annotationName1": "annotationValue1" + }, + "resolveConfiguration": { + "autoResolved": true, + "timeToResolve": "PT10M" + }, + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + }, + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup", + "actionProperties": { + "key21": "value21", + "key22": "value22" + } + } + ] + } + ] + } + } + }, + "responses": { + "200": { + "headers": {}, + "body": { + "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/promResourceGroup/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup", + "type": "Microsoft.AlertsManagement/prometheusRuleGroups", + "location": "East US", + "properties": { + "description": "This is the description of the following rule group", + "enabled": true, + "interval": "PT10M", + "clusterName": "myClusterName", + "scopes": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace" + ], + "rules": [ + { + "record": "job_type:billing_jobs_duration_seconds:99p5m", + "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))", + "labels": { + "team": "prod" + } + }, + { + "alert": "Billing_Processing_Very_Slow", + "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "enabled": true, + "severity": 2, + "for": "PT5M", + "labels": { + "team": "prod" + }, + "annotations": { + "annotationName1": "annotationValue1" + }, + "resolveConfiguration": { + "autoResolved": true, + "timeToResolve": "PT10M" + }, + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + }, + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup", + "actionProperties": { + "key21": "value21", + "key22": "value22" + } + } + ] + } + ] + } + } + }, + "201": { + "headers": {}, + "body": { + "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/promResourceGroup/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup", + "type": "Microsoft.AlertsManagement/prometheusRuleGroups", + "location": "East US", + "properties": { + "description": "This is the description of the following rule group", + "enabled": true, + "interval": "PT10M", + "clusterName": "myClusterName", + "scopes": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace" + ], + "rules": [ + { + "record": "job_type:billing_jobs_duration_seconds:99p5m", + "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))", + "labels": { + "team": "prod" + } + }, + { + "alert": "Billing_Processing_Very_Slow", + "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "enabled": true, + "severity": 2, + "for": "PT5M", + "labels": { + "team": "prod" + }, + "annotations": { + "annotationName1": "annotationValue1" + }, + "resolveConfiguration": { + "autoResolved": true, + "timeToResolve": "PT10M" + }, + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + }, + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup", + "actionProperties": { + "key21": "value21", + "key22": "value22" + } + } + ] + } + ] + } + } + } + } +} diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/deletePrometheusRuleGroup.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/deletePrometheusRuleGroup.json new file mode 100644 index 000000000000..53fd889f677f --- /dev/null +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/deletePrometheusRuleGroup.json @@ -0,0 +1,12 @@ +{ + "parameters": { + "subscriptionId": "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", + "resourceGroupName": "promResourceGroup", + "ruleGroupName": "myPrometheusRuleGroup", + "api-version": "2023-03-01" + }, + "responses": { + "200": {}, + "204": {} + } +} diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/getPrometheusRuleGroup.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/getPrometheusRuleGroup.json new file mode 100644 index 000000000000..0c70fb15b7c2 --- /dev/null +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/getPrometheusRuleGroup.json @@ -0,0 +1,69 @@ +{ + "parameters": { + "subscriptionId": "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", + "resourceGroupName": "promResourceGroup", + "ruleGroupName": "myPrometheusRuleGroup", + "api-version": "2023-03-01" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/promResourceGroup/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup", + "type": "Microsoft.AlertsManagement/prometheusRuleGroups", + "location": "East US", + "properties": { + "description": "This is the description of the following rule group", + "enabled": true, + "interval": "PT10M", + "clusterName": "myClusterName", + "scopes": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace" + ], + "rules": [ + { + "record": "job_type:billing_jobs_duration_seconds:99p5m", + "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))", + "labels": { + "team": "prod" + } + }, + { + "alert": "Billing_Processing_Very_Slow", + "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "enabled": true, + "severity": 2, + "for": "PT5M", + "labels": { + "team": "prod" + }, + "annotations": { + "annotationName1": "annotationValue1" + }, + "resolveConfiguration": { + "autoResolved": true, + "timeToResolve": "PT10M" + }, + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + }, + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup", + "actionProperties": { + "key21": "value21", + "key22": "value22" + } + } + ] + } + ] + } + } + } + } +} diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listPrometheusRuleGroups.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listPrometheusRuleGroups.json new file mode 100644 index 000000000000..0db60181773a --- /dev/null +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listPrometheusRuleGroups.json @@ -0,0 +1,128 @@ +{ + "parameters": { + "subscriptionId": "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", + "resourceGroupName": "promResourceGroup", + "api-version": "2023-03-01" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "value": [ + { + "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/promResourceGroup/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/ruleGroupName1", + "type": "Microsoft.AlertsManagement/prometheusRuleGroups", + "location": "East US", + "properties": { + "description": "This is the description of the following rule group", + "enabled": true, + "interval": "PT10M", + "clusterName": "myClusterName", + "scopes": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace" + ], + "rules": [ + { + "record": "job_type:billing_jobs_duration_seconds:99p5m", + "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))", + "labels": { + "team": "prod" + } + }, + { + "alert": "Billing_Processing_Very_Slow", + "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "enabled": true, + "severity": 2, + "for": "PT5M", + "labels": { + "team": "prod" + }, + "annotations": { + "annotationName1": "annotationValue1" + }, + "resolveConfiguration": { + "autoResolved": true, + "timeToResolve": "PT10M" + }, + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + }, + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup", + "actionProperties": { + "key21": "value21", + "key22": "value22" + } + } + ] + } + ] + } + }, + { + "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/promResourceGroup/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/ruleGroupName2", + "type": "Microsoft.AlertsManagement/prometheusRuleGroups", + "location": "East US", + "properties": { + "description": "This is the description of the following rule group", + "enabled": true, + "interval": "PT10M", + "clusterName": "myClusterName", + "scopes": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace" + ], + "rules": [ + { + "record": "job_type:billing_jobs_duration_seconds:99p5m", + "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))", + "labels": { + "team": "prod" + } + }, + { + "alert": "Billing_Processing_Very_Slow", + "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "enabled": true, + "severity": 2, + "for": "PT5M", + "labels": { + "team": "prod" + }, + "annotations": { + "annotationName1": "annotationValue1" + }, + "resolveConfiguration": { + "autoResolved": true, + "timeToResolve": "PT10M" + }, + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + }, + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup", + "actionProperties": { + "key21": "value21", + "key22": "value22" + } + } + ] + } + ] + } + } + ] + } + } + } +} diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listSubscriptionPrometheusRuleGroups.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listSubscriptionPrometheusRuleGroups.json new file mode 100644 index 000000000000..4642625c364c --- /dev/null +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listSubscriptionPrometheusRuleGroups.json @@ -0,0 +1,128 @@ +{ + "parameters": { + "subscriptionId": "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", + "resourceGroupName": "promResourceGroup", + "api-version": "2023-03-01" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "value": [ + { + "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/resourceGroupName1/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup", + "type": "Microsoft.AlertsManagement/prometheusRuleGroups", + "location": "East US", + "properties": { + "description": "This is the description of the following rule group", + "enabled": true, + "interval": "PT10M", + "clusterName": "myClusterName", + "scopes": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace" + ], + "rules": [ + { + "record": "job_type:billing_jobs_duration_seconds:99p5m", + "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))", + "labels": { + "team": "prod" + } + }, + { + "alert": "Billing_Processing_Very_Slow", + "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "enabled": true, + "severity": 2, + "for": "PT5M", + "labels": { + "team": "prod" + }, + "annotations": { + "annotationName1": "annotationValue1" + }, + "resolveConfiguration": { + "autoResolved": true, + "timeToResolve": "PT10M" + }, + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + }, + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup", + "actionProperties": { + "key21": "value21", + "key22": "value22" + } + } + ] + } + ] + } + }, + { + "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/resourceGroupName2/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup", + "type": "Microsoft.AlertsManagement/prometheusRuleGroups", + "location": "East US", + "properties": { + "description": "This is the description of the following rule group", + "enabled": true, + "interval": "PT10M", + "clusterName": "myClusterName", + "scopes": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace" + ], + "rules": [ + { + "record": "job_type:billing_jobs_duration_seconds:99p5m", + "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))", + "labels": { + "team": "prod" + } + }, + { + "alert": "Billing_Processing_Very_Slow", + "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "enabled": true, + "severity": 2, + "for": "PT5M", + "labels": { + "team": "prod" + }, + "annotations": { + "annotationName1": "annotationValue1" + }, + "resolveConfiguration": { + "autoResolved": true, + "timeToResolve": "PT10M" + }, + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + }, + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup", + "actionProperties": { + "key21": "value21", + "key22": "value22" + } + } + ] + } + ] + } + } + ] + } + } + } +} diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/patchPrometheusRuleGroup.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/patchPrometheusRuleGroup.json new file mode 100644 index 000000000000..4fe7a73ef948 --- /dev/null +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/patchPrometheusRuleGroup.json @@ -0,0 +1,80 @@ +{ + "parameters": { + "subscriptionId": "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", + "resourceGroupName": "promResourceGroup", + "ruleGroupName": "myPrometheusRuleGroup", + "api-version": "2023-03-01", + "parameters": { + "tags": { + "tag1": "tagValueFromPatch" + }, + "properties": { + "enabled": false + } + } + }, + "responses": { + "200": { + "headers": {}, + "body": { + "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/promResourceGroup/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup", + "type": "Microsoft.AlertsManagement/prometheusRuleGroups", + "location": "East US", + "properties": { + "description": "This is the description of the following rule group", + "enabled": false, + "interval": "PT10M", + "clusterName": "myClusterName", + "scopes": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace" + ], + "rules": [ + { + "record": "job_type:billing_jobs_duration_seconds:99p5m", + "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))", + "labels": { + "team": "prod" + } + }, + { + "alert": "Billing_Processing_Very_Slow", + "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "enabled": true, + "severity": 2, + "for": "PT5M", + "labels": { + "team": "prod" + }, + "annotations": { + "annotationName1": "annotationValue1" + }, + "resolveConfiguration": { + "autoResolved": true, + "timeToResolve": "PT10M" + }, + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + }, + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup", + "actionProperties": { + "key21": "value21", + "key22": "value22" + } + } + ] + } + ] + }, + "tags": { + "tag1": "tagValueFromPatch" + } + } + } + } +} diff --git a/specification/alertsmanagement/resource-manager/readme.md b/specification/alertsmanagement/resource-manager/readme.md index 503d91c2d214..7000c75d270c 100644 --- a/specification/alertsmanagement/resource-manager/readme.md +++ b/specification/alertsmanagement/resource-manager/readme.md @@ -41,7 +41,7 @@ directive: title: AlertsManagementClient description: AlertsManagement Client openapi-type: arm -tag: package-2021-08 +tag: package-2023-03 ``` ### Tag: package-preview-2023-01 @@ -53,6 +53,19 @@ input-file: - Microsoft.AlertsManagement/preview/2023-01-01-preview/AlertRuleRecommendations.json ``` + +### Tag: package-2023-03 + +These settings apply only when `--tag=package-2023-03` is specified on the command line. + +```yaml $(tag) == 'package-2023-03' +input-file: + - Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json + - Microsoft.AlertsManagement/stable/2021-08-08/AlertProcessingRules.json + - Microsoft.AlertsManagement/preview/2019-05-05-preview/AlertsManagement.json + - Microsoft.AlertsManagement/preview/2019-05-05-preview/SmartGroups.json + - Microsoft.AlertsManagement/preview/2023-01-01-preview/AlertRuleRecommendations.json +``` ### Tag: package-2021-08 These settings apply only when `--tag=package-2021-08` is specified on the command line.