From 1bcc20d7c3523dfddc34a44881048824f3b86d1c Mon Sep 17 00:00:00 2001 From: Mark Cowlishaw Date: Wed, 21 Aug 2019 19:39:12 -0700 Subject: [PATCH 1/6] Add blockchain to latest profile --- profiles/definitions/latest-2019-04-30.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/profiles/definitions/latest-2019-04-30.md b/profiles/definitions/latest-2019-04-30.md index d232011ad030..c011a4cc041a 100644 --- a/profiles/definitions/latest-2019-04-30.md +++ b/profiles/definitions/latest-2019-04-30.md @@ -41,6 +41,15 @@ profiles: - managedClusters/accessProfiles '2017-07-01': - containerServices + microsoft.blockchain: + '2018-06-01-preview': + - blockchainMembers + - blockchainMembers/consortiumMembers + - blockchainMembers/transactionNodes + - locations + - locations/blockchainMemberOperationResults + - operations + - skus microsoft.capacity: '2019-04-01': - appliedReservations From 7b4609776da798ad54384cbaccd1221f096b275b Mon Sep 17 00:00:00 2001 From: Mark Cowlishaw Date: Wed, 21 Aug 2019 19:52:35 -0700 Subject: [PATCH 2/6] Add additional types --- profiles/definitions/latest-2019-04-30.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/profiles/definitions/latest-2019-04-30.md b/profiles/definitions/latest-2019-04-30.md index c011a4cc041a..5a4f50360390 100644 --- a/profiles/definitions/latest-2019-04-30.md +++ b/profiles/definitions/latest-2019-04-30.md @@ -45,9 +45,15 @@ profiles: '2018-06-01-preview': - blockchainMembers - blockchainMembers/consortiumMembers + - blockchainMembers/listApiKeys + - lockchainMembers/regenerateApiKeys - blockchainMembers/transactionNodes + - blockchainMembers/transactionNodes/listApiKeys + - blockchainMembers/transactionNodes/regenerateApiKeys - locations - locations/blockchainMemberOperationResults + - locations/checkNameAvailability + - locations/listConsortiums - operations - skus microsoft.capacity: From f2a8965c59590ae7a38512b29008d7ebc0509cdc Mon Sep 17 00:00:00 2001 From: giladsu <43436811+giladsu@users.noreply.github.com> Date: Fri, 19 Nov 2021 03:37:23 +0200 Subject: [PATCH 3/6] Added new Prometheus Rule Groups type (#16613) * Added new Prometheus Rule Groups type * Added list example * Added missing brackets * Added to readme * Fixed readme * Added delete example * Added get example * Added create example * Added patch example * Test * Fixes * Added missing brace * Added rule group name * Fixed * Pretier * Tool fix * Update readme * Another prettier fix * More * Added system data * Removed referenced file * Removed system data * Added location to patch * Added back systemdata * Fixed systemdata * Changes * Fixed issue * Added operations * CR fixes * Using common parameters * Last CR fixes --- .../PrometheusRuleGroups.json | 550 ++++++++++++++++++ .../createOrUpdatePrometheusRuleGroup.json | 104 ++++ .../examples/deletePrometheusRuleGroup.json | 12 + .../examples/getPrometheusRuleGroup.json | 60 ++ .../examples/listPrometheusRuleGroups.json | 63 ++ .../examples/patchPrometheusRuleGroup.json | 97 +++ .../resource-manager/readme.md | 10 +- 7 files changed, 895 insertions(+), 1 deletion(-) create mode 100644 specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/PrometheusRuleGroups.json create mode 100644 specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/createOrUpdatePrometheusRuleGroup.json create mode 100644 specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/deletePrometheusRuleGroup.json create mode 100644 specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/getPrometheusRuleGroup.json create mode 100644 specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/listPrometheusRuleGroups.json create mode 100644 specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/patchPrometheusRuleGroup.json diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/PrometheusRuleGroups.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/PrometheusRuleGroups.json new file mode 100644 index 000000000000..335b022cf0a2 --- /dev/null +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/PrometheusRuleGroups.json @@ -0,0 +1,550 @@ +{ + "swagger": "2.0", + "info": { + "version": "2021-07-22-preview", + "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 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": { + "ListResourcePrometheusRuleGroups": { + "$ref": "./examples/listPrometheusRuleGroups.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": { + "ListResourcePrometheusRuleGroups": { + "$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": { + "GetPrometheusRuleGroup": { + "$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", + "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": { + "CreatePrometheusRuleGroup": { + "$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/PrometheusRuleGroupResourcePatch" + }, + "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": { + "PatchPrometheusRuleGroup": { + "$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": { + "DeletePrometheusRuleGroup": { + "$ref": "./examples/deletePrometheusRuleGroup.json" + } + } + } + }, + "/providers/Microsoft.AlertsManagement/operations": { + "get": { + "description": "Returns list of operations for Microsoft.DeviceUpdate resource provider.", + "operationId": "Operations_List", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Operation details.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/OperationListResult" + } + }, + "default": { + "description": "Error response describing the reason for operation failure.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "deprecated": false, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + } + }, + "definitions": { + "Resource": { + "type": "object", + "properties": { + "id": { + "type": "string", + "readOnly": true, + "description": "Azure resource Id" + }, + "name": { + "type": "string", + "readOnly": true, + "description": "Azure resource name" + }, + "type": { + "type": "string", + "readOnly": true, + "description": "Azure resource type" + }, + "location": { + "type": "string", + "description": "Resource location", + "x-ms-mutability": [ + "create", + "read" + ] + }, + "tags": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Resource tags" + } + }, + "required": [ + "location" + ], + "x-ms-azure-resource": true, + "description": "An azure resource object" + }, + "PrometheusRuleGroupAction": { + "type": "object", + "description": "An alert action.", + "properties": { + "actionGroupId": { + "type": "string", + "description": "the id of the action group to use." + }, + "actionProperties": { + "type": "object", + "additionalProperties": { + "type": "string", + "description": "The dictionary of custom properties for the action." + }, + "description": "The properties of an action group object." + } + } + }, + "PrometheusRuleGroupProperties": { + "type": "object", + "required": [ + "scopes", + "rules" + ], + "properties": { + "description": { + "type": "string", + "description": "the description of the Prometheus rule group that will be included in the alert email." + }, + "scopes": { + "type": "array", + "items": { + "type": "string" + }, + "description": "the list of resource id's that this rule group is scoped to." + }, + "interval": { + "type": "string", + "description": "the interval in which to run the Prometheus rule group represented in ISO 8601 duration format." + }, + "rules": { + "type": "array", + "items": { + "$ref": "#/definitions/PrometheusRule" + }, + "description": "defines the rules in the Prometheus rule group." + } + }, + "description": "An alert rule." + }, + "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." + }, + "systemData": { + "description": "Action rule system data", + "$ref": "../../../../../common-types/resource-management/v2/types.json#/definitions/systemData" + } + }, + "description": "The Prometheus rule group resource." + }, + "PrometheusRuleGroupResourcePatch": { + "type": "object", + "properties": { + "tags": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Resource tags" + }, + "location": { + "type": "string", + "description": "Resource location", + "x-ms-mutability": [ + "create", + "read" + ] + }, + "properties": { + "x-ms-client-flatten": true, + "$ref": "#/definitions/PrometheusRuleGroupProperties", + "description": "The alert rule properties of the resource." + } + }, + "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." + }, + "PrometheusRule": { + "type": "object", + "properties": { + "record": { + "type": "string", + "description": "the name of the recording rule." + }, + "alert": { + "type": "string", + "description": "the name of the alert rule." + }, + "expression": { + "type": "string", + "description": "the expression to run for the rule." + }, + "severity": { + "type": "integer", + "format": "int32", + "description": "the severity of the alerts fired by the rule." + }, + "for": { + "type": "string", + "description": "the amount of time alert must be active before firing." + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "labels for rule group" + }, + "annotations": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "annotations for rule group" + }, + "actions": { + "type": "array", + "items": { + "$ref": "#/definitions/PrometheusRuleGroupAction" + }, + "description": "the array of 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." + } + } + }, + "PrometheusRuleResolveConfiguration": { + "type": "object", + "properties": { + "autoResolved": { + "type": "boolean", + "description": "the flag that indicates whether or not to auto resolve a fired alert." + }, + "timeToResolve": { + "type": "string", + "description": "the duration a rule must evaluate as healthy before the fired alert is automatically resolved represented in ISO 8601 duration format." + } + }, + "description": "Specifies the Prometheus alert rule configuration." + } + }, + "parameters": { + "RuleGroupNameParameter": { + "name": "ruleGroupName", + "in": "path", + "required": true, + "type": "string", + "description": "The name of the rule group.", + "x-ms-parameter-location": "method" + } + } +} diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/createOrUpdatePrometheusRuleGroup.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/createOrUpdatePrometheusRuleGroup.json new file mode 100644 index 000000000000..75e1b9490d9f --- /dev/null +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/createOrUpdatePrometheusRuleGroup.json @@ -0,0 +1,104 @@ +{ + "parameters": { + "subscriptionId": "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", + "resourceGroupName": "giladstest", + "ruleGroupName": "myPrometheusRuleGroup", + "api-version": "2021-07-22-preview", + "parameters": { + "location": "East US", + "properties": { + "description": "This is the description of the first rule group", + "scopes": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/Microsoft.Observability/monitoringAcount/myMonitoringAccount" + ], + "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))" + }, + { + "alert": "Billing_Processing_Very_Slow", + "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "severity": 2, + "for": "PT5M", + "labels": { + "team": "prod" + }, + "annotations": { + "annotationName1": "annotationValue1" + }, + "resolveConfiguration": { + "autoResolved": true, + "timeToResolve": "PT10M" + }, + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/giladstest/providers/microsoft.insights/notificationgroups/group2", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + } + ] + } + ] + } + } + }, + "responses": { + "200": { + "headers": {}, + "body": { + "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup", + "type": "Microsoft.AlertsManagement/prometheusRuleGroups", + "location": "East US", + "properties": { + "description": "This is the description of the first rule group", + "scopes": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/Microsoft.Observability/monitoringAcount/myMonitoringAccount" + ], + "interval": "PT5M", + "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))" + }, + { + "alert": "Billing_Processing_Very_Slow", + "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "severity": 2, + "for": "PT5M", + "labels": { + "team": "prod" + }, + "annotations": { + "annotationName1": "annotationValue1" + }, + "resolveConfiguration": { + "autoResolved": true, + "timeToResolve": "PT10M" + }, + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/giladstest/providers/microsoft.insights/notificationgroups/group2", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + } + ] + } + ] + }, + "systemData": { + "createdBy": "abc@microsoft.com", + "createdByType": "User", + "createdAt": "2018-06-12T22:05:09Z", + "lastModifiedBy": "xyz@microsoft.com", + "lastModifiedByType": "User", + "lastModifiedAt": "2018-06-12T22:05:09Z" + } + } + } + } +} diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/deletePrometheusRuleGroup.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/deletePrometheusRuleGroup.json new file mode 100644 index 000000000000..5c08be786219 --- /dev/null +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/deletePrometheusRuleGroup.json @@ -0,0 +1,12 @@ +{ + "parameters": { + "subscriptionId": "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", + "resourceGroupName": "giladsteset", + "ruleGroupName": "myPrometheusRuleGroup", + "api-version": "2021-07-22-preview" + }, + "responses": { + "200": {}, + "204": {} + } +} diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/getPrometheusRuleGroup.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/getPrometheusRuleGroup.json new file mode 100644 index 000000000000..f9d0ce5de0de --- /dev/null +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/getPrometheusRuleGroup.json @@ -0,0 +1,60 @@ +{ + "parameters": { + "subscriptionId": "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", + "resourceGroupName": "giladstest", + "ruleGroupName": "myPrometheusRuleGroup", + "api-version": "2021-07-22-preview" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup", + "type": "Microsoft.AlertsManagement/prometheusRuleGroups", + "location": "global", + "properties": { + "description": "This is the description of the first rule group", + "scopes": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/Microsoft.Observability/monitoringAcount/myMonitoringAccount" + ], + "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))" + }, + { + "alert": "Billing_Processing_Very_Slow", + "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "severity": 2, + "for": "5m", + "labels": { + "team": "prod" + }, + "resolveConfiguration": { + "autoResolved": true, + "timeToResolve": "10m" + }, + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/giladstest/providers/microsoft.insights/notificationgroups/group2", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + } + ] + } + ] + }, + "systemData": { + "createdBy": "abc@microsoft.com", + "createdByType": "User", + "createdAt": "2018-06-12T22:05:09Z", + "lastModifiedBy": "xyz@microsoft.com", + "lastModifiedByType": "User", + "lastModifiedAt": "2018-06-12T22:05:09Z" + } + } + } + } +} diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/listPrometheusRuleGroups.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/listPrometheusRuleGroups.json new file mode 100644 index 000000000000..e67d474e1c44 --- /dev/null +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/listPrometheusRuleGroups.json @@ -0,0 +1,63 @@ +{ + "parameters": { + "subscriptionId": "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", + "resourceGroupName": "giladstest", + "api-version": "2021-07-22-preview" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "value": [ + { + "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup", + "type": "Microsoft.AlertsManagement/prometheusRuleGroups", + "location": "East US", + "properties": { + "description": "This is the description of the first rule group", + "scopes": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/Microsoft.Observability/monitoringAcount/myMonitoringAccount" + ], + "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))" + }, + { + "alert": "Billing_Processing_Very_Slow", + "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "severity": 2, + "for": "5m", + "labels": { + "team": "prod" + }, + "resolveConfiguration": { + "autoResolved": true, + "timeToResolve": "10m" + }, + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + } + ] + } + ] + }, + "systemData": { + "createdBy": "abc@microsoft.com", + "createdByType": "User", + "createdAt": "2018-06-12T22:05:09Z", + "lastModifiedBy": "xyz@microsoft.com", + "lastModifiedByType": "User", + "lastModifiedAt": "2018-06-12T22:05:09Z" + } + } + ] + } + } + } +} diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/patchPrometheusRuleGroup.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/patchPrometheusRuleGroup.json new file mode 100644 index 000000000000..1e42a9b00791 --- /dev/null +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/patchPrometheusRuleGroup.json @@ -0,0 +1,97 @@ +{ + "parameters": { + "subscriptionId": "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", + "resourceGroupName": "giladstest", + "ruleGroupName": "myPrometheusRuleGroup", + "api-version": "2021-07-22-preview", + "parameters": { + "location": "East US", + "properties": { + "description": "This is the description of the first rule group", + "scopes": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/Microsoft.Observability/monitoringAcount/myMonitoringAccount" + ], + "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))" + }, + { + "alert": "Billing_Processing_Very_Slow", + "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "severity": 2, + "for": "5m", + "labels": { + "team": "prod" + }, + "resolveConfiguration": { + "autoResolved": true, + "timeToResolve": "10m" + }, + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/giladstest/providers/microsoft.insights/notificationgroups/group2", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + } + ] + } + ] + } + } + }, + "responses": { + "200": { + "headers": {}, + "body": { + "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup", + "type": "Microsoft.AlertsManagement/prometheusRuleGroups", + "location": "East US", + "properties": { + "description": "This is the description of the first rule group", + "scopes": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/Microsoft.Observability/monitoringAcount/myMonitoringAccount" + ], + "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))" + }, + { + "alert": "Billing_Processing_Very_Slow", + "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "severity": 2, + "for": "5m", + "labels": { + "team": "prod" + }, + "resolveConfiguration": { + "autoResolved": true, + "timeToResolve": "10m" + }, + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/giladstest/providers/microsoft.insights/notificationgroups/group2", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + } + ] + } + ] + }, + "systemData": { + "createdBy": "abc@microsoft.com", + "createdByType": "User", + "createdAt": "2018-06-12T22:05:09Z", + "lastModifiedBy": "xyz@microsoft.com", + "lastModifiedByType": "User", + "lastModifiedAt": "2018-06-12T22:05:09Z" + } + } + } + } +} diff --git a/specification/alertsmanagement/resource-manager/readme.md b/specification/alertsmanagement/resource-manager/readme.md index 4cd35a1e52da..9fe51789fd56 100644 --- a/specification/alertsmanagement/resource-manager/readme.md +++ b/specification/alertsmanagement/resource-manager/readme.md @@ -158,7 +158,15 @@ input-file: - Microsoft.AlertsManagement/preview/2020-08-04-preview/ResourceHealthAlertRules.json ``` ---- +### Tag: package-2021-07-22-preview + + +These settings apply only when `--tag=package-2021-07-22` is specified on the command line. + +``` yaml $(tag) == 'package-2021-07-22-preview' +input-file: +- Microsoft.AlertsManagement/preview/2021-07-22-preview/PrometheusRuleGroups.json +``` # Code Generation From a693aefe727ee89985b3b5ed17041f7ee3294e5d Mon Sep 17 00:00:00 2001 From: giladsu <43436811+giladsu@users.noreply.github.com> Date: Thu, 13 Jan 2022 16:06:56 +0200 Subject: [PATCH 4/6] Updated descriptions --- .../2021-07-22-preview/PrometheusRuleGroups.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/PrometheusRuleGroups.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/PrometheusRuleGroups.json index 335b022cf0a2..75e69d9f8206 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/PrometheusRuleGroups.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/PrometheusRuleGroups.json @@ -361,7 +361,7 @@ }, "PrometheusRuleGroupAction": { "type": "object", - "description": "An alert action.", + "description": "An alert action. Only relevant for alerts.", "properties": { "actionGroupId": { "type": "string", @@ -489,36 +489,36 @@ "severity": { "type": "integer", "format": "int32", - "description": "the severity of the alerts fired by the rule." + "description": "the severity of the alerts fired by the rule. Only relevant for alerts." }, "for": { "type": "string", - "description": "the amount of time alert must be active before firing." + "description": "the amount of time alert must be active before firing. Only relevant for alerts." }, "labels": { "type": "object", "additionalProperties": { "type": "string" }, - "description": "labels for rule group" + "description": "labels for rule group. Only relevant for alerts." }, "annotations": { "type": "object", "additionalProperties": { "type": "string" }, - "description": "annotations for rule group" + "description": "annotations for rule group. Only relevant for alerts." }, "actions": { "type": "array", "items": { "$ref": "#/definitions/PrometheusRuleGroupAction" }, - "description": "the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved." + "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." }, "resolveConfiguration": { "$ref": "#/definitions/PrometheusRuleResolveConfiguration", - "description": "defines the configuration for resolving fired alerts." + "description": "defines the configuration for resolving fired alerts. Only relevant for alerts." } } }, From 69570924e3df25a5a65ada01daa6e487856ea8be Mon Sep 17 00:00:00 2001 From: giladsu <43436811+giladsu@users.noreply.github.com> Date: Thu, 13 Jan 2022 16:27:22 +0200 Subject: [PATCH 5/6] Fixed validations --- .../PrometheusRuleGroups.json | 8 ++++ .../listOperationsPrometheusRuleGroup.json | 43 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/listOperationsPrometheusRuleGroup.json diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/PrometheusRuleGroups.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/PrometheusRuleGroups.json index 75e69d9f8206..36a379d1d87b 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/PrometheusRuleGroups.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/PrometheusRuleGroups.json @@ -311,6 +311,11 @@ } } }, + "x-ms-examples": { + "DeletePrometheusRuleGroup": { + "$ref": "./examples/listOperationsPrometheusRuleGroup.json" + } + }, "deprecated": false, "x-ms-pageable": { "nextLinkName": "nextLink" @@ -393,6 +398,7 @@ "items": { "type": "string" }, + "x-ms-identifiers": [], "description": "the list of resource id's that this rule group is scoped to." }, "interval": { @@ -404,6 +410,7 @@ "items": { "$ref": "#/definitions/PrometheusRule" }, + "x-ms-identifiers": [], "description": "defines the rules in the Prometheus rule group." } }, @@ -514,6 +521,7 @@ "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." }, "resolveConfiguration": { diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/listOperationsPrometheusRuleGroup.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/listOperationsPrometheusRuleGroup.json new file mode 100644 index 000000000000..3926ac4793e4 --- /dev/null +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/listOperationsPrometheusRuleGroup.json @@ -0,0 +1,43 @@ +{ + "parameters": { + "api-version": "2021-07-22-preview" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "name": "Microsoft.AlertsManagement/prometheusRuleGroups/Write", + "isDataAction": false, + "display": { + "provider": "Microsoft.AlertsManagement", + "resource": "prometheusRuleGroups", + "operation": "Creates or updates the prometheusRuleGroups", + "description": "Set prometheusRuleGroups" + } + }, + { + "name": "Microsoft.AlertsManagement/prometheusRuleGroups/Delete", + "isDataAction": false, + "display": { + "provider": "Microsoft.AlertsManagement", + "resource": "prometheusRuleGroups", + "operation": "Deletes the prometheusRuleGroups", + "description": "Delete prometheusRuleGroups" + } + }, + { + "name": "Microsoft.AlertsManagement/prometheusRuleGroups/Read", + "isDataAction": false, + "display": { + "provider": "Microsoft.AlertsManagement", + "resource": "prometheusRuleGroups", + "operation": "Reads the prometheusRuleGroups", + "description": "Read prometheusRuleGroups" + } + } + ] + } + } + } +} From ac8a4df35c24b954bf25cc84aa3f5550d4c657df Mon Sep 17 00:00:00 2001 From: giladsu <43436811+giladsu@users.noreply.github.com> Date: Thu, 27 Jan 2022 12:58:37 +0200 Subject: [PATCH 6/6] Updated patch and added expression as required --- .../PrometheusRuleGroups.json | 8 ++-- .../examples/patchPrometheusRuleGroup.json | 40 ++++--------------- 2 files changed, 10 insertions(+), 38 deletions(-) diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/PrometheusRuleGroups.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/PrometheusRuleGroups.json index 36a379d1d87b..53c399ebd97a 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/PrometheusRuleGroups.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/PrometheusRuleGroups.json @@ -456,11 +456,6 @@ "create", "read" ] - }, - "properties": { - "x-ms-client-flatten": true, - "$ref": "#/definitions/PrometheusRuleGroupProperties", - "description": "The alert rule properties of the resource." } }, "description": "The Prometheus rule group resource for patch operations." @@ -480,6 +475,9 @@ }, "PrometheusRule": { "type": "object", + "required": [ + "expression" + ], "properties": { "record": { "type": "string", diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/patchPrometheusRuleGroup.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/patchPrometheusRuleGroup.json index 1e42a9b00791..403be22a2e4c 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/patchPrometheusRuleGroup.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2021-07-22-preview/examples/patchPrometheusRuleGroup.json @@ -6,39 +6,9 @@ "api-version": "2021-07-22-preview", "parameters": { "location": "East US", - "properties": { - "description": "This is the description of the first rule group", - "scopes": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/Microsoft.Observability/monitoringAcount/myMonitoringAccount" - ], - "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))" - }, - { - "alert": "Billing_Processing_Very_Slow", - "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", - "severity": 2, - "for": "5m", - "labels": { - "team": "prod" - }, - "resolveConfiguration": { - "autoResolved": true, - "timeToResolve": "10m" - }, - "actions": [ - { - "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/giladstest/providers/microsoft.insights/notificationgroups/group2", - "actionProperties": { - "key11": "value11", - "key12": "value12" - } - } - ] - } - ] + "tags": { + "key1": "value1", + "key2": "value2" } } }, @@ -49,6 +19,10 @@ "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup", "type": "Microsoft.AlertsManagement/prometheusRuleGroups", "location": "East US", + "tags": { + "key1": "value1", + "key2": "value2" + }, "properties": { "description": "This is the description of the first rule group", "scopes": [