swagger: "2.0"
schemes:
  - https
host: management.azure.com
info:
  title: MonitorManagementClient
  version: 2016-03-01
  x-apisguru-categories:
    - cloud
  x-logo:
    url: https://api.apis.guru/v2/cache/logo/https_assets.onestore.ms_cdnfiles_onestorerolling-1606-01000_shell_v3_images_logo_microsoft.png
  x-ms-code-generation-settings:
    name: MonitorManagementClient
  x-origin:
    - format: swagger
      url: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/alertRules_API.json
      version: "2.0"
  x-providerName: azure.com
  x-serviceName: monitor-alertRules_API
  x-tags:
    - Azure
    - Microsoft
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  azure_auth:
    authorizationUrl: https://login.microsoftonline.com/common/oauth2/authorize
    description: Azure Active Directory OAuth2 Flow
    flow: implicit
    scopes:
      user_impersonation: impersonate your user account
    type: oauth2
security:
  - azure_auth:
      - user_impersonation
parameters:
  ApiVersionParameter:
    description: Client Api Version.
    in: query
    name: api-version
    required: true
    type: string
  ResourceGroupNameParameter:
    description: The name of the resource group.
    in: path
    name: resourceGroupName
    required: true
    type: string
    x-ms-parameter-location: method
  RuleNameParameter:
    description: The name of the rule.
    in: path
    name: ruleName
    required: true
    type: string
    x-ms-parameter-location: method
  SubscriptionIdParameter:
    description: The Azure subscription Id.
    in: path
    name: subscriptionId
    required: true
    type: string
paths:
  "/subscriptions/{subscriptionId}/providers/microsoft.insights/alertrules":
    get:
      description: List the alert rules within a subscription.
      operationId: AlertRules_ListBySubscription
      parameters:
        - $ref: "#/parameters/ApiVersionParameter"
        - $ref: "#/parameters/SubscriptionIdParameter"
      responses:
        "200":
          description: Successful request for a list of alert rules
          schema:
            $ref: "#/definitions/AlertRuleResourceCollection"
      tags:
        - AlertRules
      x-ms-examples:
        List alert rules:
          parameters:
            api-version: 2016-03-01
            subscriptionId: b67f7fec-69fc-4974-9099-a26bd6ffeda3
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/myRuleName
                    location: West US
                    name: myRuleName
                    properties:
                      actions:
                        - customEmails:
                            - gu@ms.com
                            - su@ms.net
                          odata.type: Microsoft.Azure.Management.Insights.Models.RuleEmailAction
                          sendToServiceOwners: true
                      condition:
                        dataSource:
                          metricName: Requests
                          odata.type: Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource
                          resourceUri: /subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest
                        odata.type: Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition
                        operator: GreaterThan
                        threshold: 2
                        timeAggregation: Total
                        windowSize: PT5M
                      description: Pura Vida
                      isEnabled: true
                      lastUpdatedTime: 2016-11-10T21:04:39.0005255Z
                      name: myRuleName
                    tags:
                      $type: Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, Microsoft.WindowsAzure.Management.Common.Storage
                      hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest: Resource
                    type: Microsoft.Insights/alertRules
                  - id: /subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/chiricutin0
                    location: West US
                    name: chiricutin0
                    properties:
                      actions: []
                      condition:
                        dataSource:
                          metricName: Requests
                          odata.type: Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource
                          resourceUri: /subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest
                        odata.type: Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition
                        operator: GreaterThan
                        threshold: 2
                        timeAggregation: Total
                        windowSize: PT5M
                      description: Pura Vida 0
                      isEnabled: true
                      lastUpdatedTime: 2016-11-10T21:04:39.1082596Z
                      name: chiricutin0
                    tags:
                      $type: Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, Microsoft.WindowsAzure.Management.Common.Storage
                      hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest: Resource
                    type: Microsoft.Insights/alertRules
              headers: {}
      x-ms-pageable:
        nextLinkName: null
  "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules":
    get:
      description: List the alert rules within a resource group.
      operationId: AlertRules_ListByResourceGroup
      parameters:
        - $ref: "#/parameters/ResourceGroupNameParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - $ref: "#/parameters/SubscriptionIdParameter"
      responses:
        "200":
          description: Successful request for a list of alert rules
          schema:
            $ref: "#/definitions/AlertRuleResourceCollection"
      tags:
        - AlertRules
      x-ms-examples:
        List alert rules:
          parameters:
            api-version: 2016-03-01
            resourceGroupName: Rac46PostSwapRG
            subscriptionId: b67f7fec-69fc-4974-9099-a26bd6ffeda3
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/myRuleName
                    location: West US
                    name: myRuleName
                    properties:
                      actions:
                        - customEmails:
                            - gu@ms.com
                            - su@ms.net
                          odata.type: Microsoft.Azure.Management.Insights.Models.RuleEmailAction
                          sendToServiceOwners: true
                      condition:
                        dataSource:
                          metricName: Requests
                          odata.type: Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource
                          resourceUri: /subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest
                        odata.type: Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition
                        operator: GreaterThan
                        threshold: 2
                        timeAggregation: Total
                        windowSize: PT5M
                      description: Pura Vida
                      isEnabled: true
                      lastUpdatedTime: 2016-11-10T21:04:39.0005255Z
                      name: myRuleName
                    tags:
                      $type: Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, Microsoft.WindowsAzure.Management.Common.Storage
                      hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest: Resource
                    type: Microsoft.Insights/alertRules
                  - id: /subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/chiricutin0
                    location: West US
                    name: chiricutin0
                    properties:
                      actions: []
                      condition:
                        dataSource:
                          metricName: Requests
                          odata.type: Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource
                          resourceUri: /subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest
                        odata.type: Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition
                        operator: GreaterThan
                        threshold: 2
                        timeAggregation: Total
                        windowSize: PT5M
                      description: Pura Vida 0
                      isEnabled: true
                      lastUpdatedTime: 2016-11-10T21:04:39.1082596Z
                      name: chiricutin0
                    tags:
                      $type: Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, Microsoft.WindowsAzure.Management.Common.Storage
                      hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest: Resource
                    type: Microsoft.Insights/alertRules
              headers: {}
      x-ms-pageable:
        nextLinkName: null
  "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}":
    delete:
      description: Deletes an alert rule
      operationId: AlertRules_Delete
      parameters:
        - $ref: "#/parameters/ResourceGroupNameParameter"
        - $ref: "#/parameters/RuleNameParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - $ref: "#/parameters/SubscriptionIdParameter"
      responses:
        "200":
          description: Successful request to delete an alert rule
        "204":
          description: "No content: the request was successful, but the response is empty"
      tags:
        - AlertRules
      x-ms-examples:
        Delete an alert rule:
          parameters:
            api-version: 2016-03-01
            resourceGroupName: Rac46PostSwapRG
            ruleName: chiricutin
            subscriptionId: b67f7fec-69fc-4974-9099-a26bd6ffeda3
          responses:
            "200": {}
            "204": {}
    get:
      description: Gets an alert rule
      operationId: AlertRules_Get
      parameters:
        - $ref: "#/parameters/ResourceGroupNameParameter"
        - $ref: "#/parameters/RuleNameParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - $ref: "#/parameters/SubscriptionIdParameter"
      responses:
        "200":
          description: Successful request to get an alert rule
          schema:
            $ref: "#/definitions/AlertRuleResource"
      tags:
        - AlertRules
      x-ms-examples:
        Get an alert rule:
          parameters:
            api-version: 2016-03-01
            resourceGroupName: Rac46PostSwapRG
            ruleName: chiricutin
            subscriptionId: b67f7fec-69fc-4974-9099-a26bd6ffeda3
          responses:
            "200":
              body:
                id: /subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/chiricutin
                location: West US
                name: chiricutin
                properties:
                  actions: []
                  condition:
                    dataSource:
                      metricName: Requests
                      odata.type: Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource
                      resourceUri: /subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest
                    odata.type: Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition
                    operator: GreaterThan
                    threshold: 3
                    timeAggregation: Total
                    windowSize: PT5M
                  description: Pura Vida
                  isEnabled: true
                  lastUpdatedTime: 2016-11-23T21:23:52.0221265Z
                  name: chiricutin
                tags:
                  $type: Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, Microsoft.WindowsAzure.Management.Common.Storage
                  hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest: Resource
                type: Microsoft.Insights/alertRules
              headers: {}
    patch:
      description: Updates an existing AlertRuleResource. To update other fields use the CreateOrUpdate method.
      operationId: AlertRules_Update
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ResourceGroupNameParameter"
        - $ref: "#/parameters/RuleNameParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - description: Parameters supplied to the operation.
          in: body
          name: alertRulesResource
          required: true
          schema:
            $ref: "#/definitions/AlertRuleResourcePatch"
      responses:
        "200":
          description: Successful request to update an alert rule
          schema:
            $ref: "#/definitions/AlertRuleResource"
        "201":
          description: Successful request to update an alert rule that resulted in a creation of the alert rule
          schema:
            $ref: "#/definitions/AlertRuleResource"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      x-ms-examples:
        Patch an alert rule:
          parameters:
            alertRulesResource:
              properties:
                actions: []
                condition:
                  dataSource:
                    metricName: Requests
                    odata.type: Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource
                    resourceUri: /subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest
                  odata.type: Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition
                  operator: GreaterThan
                  threshold: 3
                  timeAggregation: Total
                  windowSize: PT5M
                description: Pura Vida
                isEnabled: true
                lastUpdatedTime: 2016-11-23T21:23:52.0221265Z
                name: chiricutin
              tags:
                $type: Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary
            api-version: 2016-03-01
            resourceGroupName: Rac46PostSwapRG
            ruleName: chiricutin
            subscriptionId: b67f7fec-69fc-4974-9099-a26bd6ffeda3
          responses:
            "200":
              body:
                id: /subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/chiricutin
                location: West US
                name: chiricutin
                properties:
                  actions: []
                  condition:
                    dataSource:
                      metricName: Requests
                      odata.type: Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource
                      resourceUri: /subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest
                    odata.type: Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition
                    operator: GreaterThan
                    threshold: 3
                    timeAggregation: Total
                    windowSize: PT5M
                  description: Pura Vida
                  isEnabled: true
                  lastUpdatedTime: 2016-11-23T21:23:52.0221265Z
                  name: chiricutin
                tags:
                  $type: Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary
                type: Microsoft.Insights/alertRules
              headers: {}
            "201":
              body:
                id: /subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/chiricutin
                location: West US
                name: chiricutin
                properties:
                  actions: []
                  condition:
                    dataSource:
                      metricName: Requests
                      odata.type: Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource
                      resourceUri: /subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest
                    odata.type: Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition
                    operator: GreaterThan
                    threshold: 3
                    timeAggregation: Total
                    windowSize: PT5M
                  description: Pura Vida
                  isEnabled: true
                  lastUpdatedTime: 2016-11-23T21:23:52.0221265Z
                  name: chiricutin
                tags:
                  $type: Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary
                type: Microsoft.Insights/alertRules
              headers: {}
    put:
      description: Creates or updates an alert rule.
      operationId: AlertRules_CreateOrUpdate
      parameters:
        - $ref: "#/parameters/ResourceGroupNameParameter"
        - $ref: "#/parameters/RuleNameParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - description: The parameters of the rule to create or update.
          in: body
          name: parameters
          required: true
          schema:
            $ref: "#/definitions/AlertRuleResource"
        - $ref: "#/parameters/SubscriptionIdParameter"
      responses:
        "200":
          description: Successful request to update an alert rule
          schema:
            $ref: "#/definitions/AlertRuleResource"
        "201":
          description: Created alert rule
          schema:
            $ref: "#/definitions/AlertRuleResource"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - AlertRules
      x-ms-examples:
        Create or update an alert rule:
          parameters:
            api-version: 2016-03-01
            parameters:
              location: West US
              properties:
                actions: []
                condition:
                  dataSource:
                    metricName: Requests
                    odata.type: Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource
                    resourceUri: /subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest
                  odata.type: Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition
                  operator: GreaterThan
                  threshold: 3
                  timeAggregation: Total
                  windowSize: PT5M
                description: Pura Vida
                isEnabled: true
                lastUpdatedTime: 2016-11-23T21:23:52.0221265Z
                name: chiricutin
              tags: {}
            resourceGroupName: Rac46PostSwapRG
            ruleName: chiricutin
            subscriptionId: b67f7fec-69fc-4974-9099-a26bd6ffeda3
          responses:
            "200":
              body:
                id: /subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/chiricutin
                location: West US
                name: chiricutin
                properties:
                  actions: []
                  condition:
                    dataSource:
                      metricName: Requests
                      odata.type: Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource
                      resourceUri: /subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest
                    odata.type: Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition
                    operator: GreaterThan
                    threshold: 3
                    timeAggregation: Total
                    windowSize: PT5M
                  description: Pura Vida
                  isEnabled: true
                  lastUpdatedTime: 2016-11-23T21:23:52.0221265Z
                  name: chiricutin
                tags:
                  $type: Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, Microsoft.WindowsAzure.Management.Common.Storage
                  hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest: Resource
                type: Microsoft.Insights/alertRules
              headers: {}
            "201":
              body:
                id: /subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/chiricutin
                location: West US
                name: chiricutin
                properties:
                  actions: []
                  condition:
                    dataSource:
                      metricName: Requests
                      odata.type: Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource
                      resourceUri: /subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest
                    odata.type: Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition
                    operator: GreaterThan
                    threshold: 3
                    timeAggregation: Total
                    windowSize: PT5M
                  description: Pura Vida
                  isEnabled: true
                  lastUpdatedTime: 2016-11-23T21:23:52.0221265Z
                  name: chiricutin
                tags:
                  $type: Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, Microsoft.WindowsAzure.Management.Common.Storage
                  hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest: Resource
                type: Microsoft.Insights/alertRules
              headers: {}
definitions:
  AlertRule:
    description: An alert rule.
    properties:
      actions:
        description: the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved.
        items:
          $ref: "#/definitions/RuleAction"
        type: array
      condition:
        $ref: "#/definitions/RuleCondition"
        description: the condition that results in the alert rule being activated.
      description:
        description: the description of the alert rule that will be included in the alert email.
        type: string
      isEnabled:
        description: the flag that indicates whether the alert rule is enabled.
        type: boolean
      lastUpdatedTime:
        description: Last time the rule was updated in ISO8601 format.
        format: date-time
        readOnly: true
        type: string
      name:
        description: the name of the alert rule.
        type: string
    required:
      - name
      - isEnabled
      - condition
  AlertRuleResource:
    allOf:
      - $ref: "#/definitions/Resource"
    description: The alert rule resource.
    properties:
      properties:
        $ref: "#/definitions/AlertRule"
        description: The alert rule properties of the resource.
        x-ms-client-flatten: true
    required:
      - properties
    type: object
  AlertRuleResourceCollection:
    description: Represents a collection of alert rule resources.
    properties:
      value:
        description: the values for the alert rule resources.
        items:
          $ref: "#/definitions/AlertRuleResource"
        type: array
  AlertRuleResourcePatch:
    description: The alert rule object for patch operations.
    properties:
      properties:
        $ref: "#/definitions/AlertRule"
        description: The properties of an alert rule.
        x-ms-client-flatten: true
      tags:
        additionalProperties:
          type: string
        description: Resource tags
  ConditionOperator:
    description: Operators allowed in the rule condition.
    enum:
      - GreaterThan
      - GreaterThanOrEqual
      - LessThan
      - LessThanOrEqual
    type: string
    x-ms-enum:
      modelAsString: false
      name: ConditionOperator
  ErrorResponse:
    description: Describes the format of Error response.
    properties:
      code:
        description: Error code
        type: string
      message:
        description: Error message indicating why the operation failed.
        type: string
    type: object
  LocationThresholdRuleCondition:
    allOf:
      - $ref: "#/definitions/RuleCondition"
    description: A rule condition based on a certain number of locations failing.
    example: "{\r

      \t\"odata.type\": \"Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition\",\r

      \t\"dataSource\": {\r

      \t\t\"odata.type\": \"Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource\",\r

      \t\t\"resourceUri\": \"/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourcegroups/Default-Web-CentralUS/providers/microsoft.insights/webtests/homepagetest-newrelapp2\",r

      \t\t\"metricName\": \"GSMT_AvRaW\"\r

      \t},\r

      \t\"windowSize\": \"PT5M\",\r

      \t\"failedLocationCount\": 1\r

      }"
    properties:
      failedLocationCount:
        description: the number of locations that must fail to activate the alert.
        format: int32
        minimum: 0
        type: integer
      windowSize:
        description: the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day.
        format: duration
        type: string
    required:
      - failedLocationCount
    type: object
    x-ms-discriminator-value: Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition
  ManagementEventAggregationCondition:
    description: How the data that is collected should be combined over time.
    properties:
      operator:
        $ref: "#/definitions/ConditionOperator"
        description: the condition operator.
      threshold:
        description: The threshold value that activates the alert.
        format: double
        type: number
      windowSize:
        description: the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day.
        format: duration
        type: string
  ManagementEventRuleCondition:
    allOf:
      - $ref: "#/definitions/RuleCondition"
    description: A management event rule condition.
    example: "{\r

      \t\"odata.type\": \"Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition\",\r

      \t\"dataSource\": {\r

      \t\t\"odata.type\": \"Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource\",\r

      \t\t\"operationName\": \"\",\r

      \t\t\"resourceUri\": \"/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/Default-Web-CentralUS/providers/Microsoft.Web/sites/TestLatestWebsite\",\r

      \t\t\"status\": \"failed\",\r

      \t\t\"claims\": { }\r

      \t},\r

      \t\"aggregation\": {\r

      \t\t\"threshold\": 1,\r

      \t\t\"windowSize\": \"PT5M\"\r

      \t}\r

      }"
    properties:
      aggregation:
        $ref: "#/definitions/ManagementEventAggregationCondition"
        description: How the data that is collected should be combined over time and when the alert is activated. Note that for management event alerts aggregation is optional – if it is not provided then any event will cause the alert to activate.
    type: object
    x-ms-discriminator-value: Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition
  Resource:
    description: An azure resource object
    properties:
      id:
        description: Azure resource Id
        readOnly: true
        type: string
      location:
        description: Resource location
        type: string
        x-ms-mutability:
          - create
          - read
      name:
        description: Azure resource name
        readOnly: true
        type: string
      tags:
        additionalProperties:
          type: string
        description: Resource tags
      type:
        description: Azure resource type
        readOnly: true
        type: string
    required:
      - location
    x-ms-azure-resource: true
  RuleAction:
    description: The action that is performed when the alert rule becomes active, and when an alert condition is resolved.
    discriminator: odata.type
    properties:
      odata.type:
        description: "specifies the type of the action. There are two types of actions: RuleEmailAction and RuleWebhookAction."
        type: string
    required:
      - odata.type
    type: object
  RuleCondition:
    description: The condition that results in the alert rule being activated.
    discriminator: odata.type
    properties:
      dataSource:
        $ref: "#/definitions/RuleDataSource"
        description: the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource.
      odata.type:
        description: "specifies the type of condition. This can be one of three types: ManagementEventRuleCondition (occurrences of management events), LocationThresholdRuleCondition (based on the number of failures of a web test), and ThresholdRuleCondition (based on the threshold of a metric)."
        type: string
    required:
      - odata.type
    type: object
  RuleDataSource:
    description: The resource from which the rule collects its data.
    discriminator: odata.type
    properties:
      odata.type:
        description: "specifies the type of data source. There are two types of rule data sources: RuleMetricDataSource and RuleManagementEventDataSource"
        type: string
      resourceUri:
        description: "the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule."
        type: string
    required:
      - odata.type
    type: object
  RuleEmailAction:
    allOf:
      - $ref: "#/definitions/RuleAction"
    description: Specifies the action to send email when the rule condition is evaluated. The discriminator is always RuleEmailAction in this case.
    example: "{\r

      \t\"odata.type\": \"Microsoft.Azure.Management.Insights.Models.RuleEmailAction\",\r

      \t\"sendToServiceOwners\": true,\r

      \t\"customEmails\": [\"email1@contoso.com\",\"email2@contoso.com\" ]\r

      }"
    properties:
      customEmails:
        description: the list of administrator's custom email addresses to notify of the activation of the alert.
        items:
          type: string
        type: array
      sendToServiceOwners:
        description: Whether the administrators (service and co-administrators) of the service should be notified when the alert is activated.
        type: boolean
    type: object
    x-ms-discriminator-value: Microsoft.Azure.Management.Insights.Models.RuleEmailAction
  RuleManagementEventClaimsDataSource:
    description: The claims for a rule management event data source.
    properties:
      emailAddress:
        description: the email address.
        type: string
  RuleManagementEventDataSource:
    allOf:
      - $ref: "#/definitions/RuleDataSource"
    description: A rule management event data source. The discriminator fields is always RuleManagementEventDataSource in this case.
    properties:
      claims:
        $ref: "#/definitions/RuleManagementEventClaimsDataSource"
        description: the claims.
      eventName:
        description: the event name.
        type: string
      eventSource:
        description: the event source.
        type: string
      level:
        description: the level.
        type: string
      operationName:
        description: The name of the operation that should be checked for. If no name is provided, any operation will match.
        type: string
      resourceGroupName:
        description: the resource group name.
        type: string
      resourceProviderName:
        description: the resource provider name.
        type: string
      status:
        description: The status of the operation that should be checked for. If no status is provided, any status will match.
        type: string
      subStatus:
        description: the substatus.
        type: string
    type: object
    x-ms-discriminator-value: Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource
  RuleMetricDataSource:
    allOf:
      - $ref: "#/definitions/RuleDataSource"
    description: A rule metric data source. The discriminator value is always RuleMetricDataSource in this case.
    properties:
      metricName:
        description: the name of the metric that defines what the rule monitors.
        type: string
    type: object
    x-ms-discriminator-value: Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource
  RuleWebhookAction:
    allOf:
      - $ref: "#/definitions/RuleAction"
    description: Specifies the action to post to service when the rule condition is evaluated. The discriminator is always RuleWebhookAction in this case.
    example: "{\r

      \t\"odata.type\": \"Microsoft.Azure.Management.Insights.Models.RuleWebhookAction\",\r

      \t\"serviceUri\": \"http://contoso.com/\",\r

      \t\"properties\": { }\r

      }"
    properties:
      properties:
        additionalProperties:
          type: string
        description: the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload.
        type: object
      serviceUri:
        description: the service uri to Post the notification when the alert activates or resolves.
        type: string
    type: object
    x-ms-discriminator-value: Microsoft.Azure.Management.Insights.Models.RuleWebhookAction
  ThresholdRuleCondition:
    allOf:
      - $ref: "#/definitions/RuleCondition"
    description: A rule condition based on a metric crossing a threshold.
    example: "\"condition\": {\r

      \t\"odata.type\": \"Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition\",\r

      \t\"dataSource\": {\r

      \t\"odata.type\": \"Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource\",\r

      \t\"resourceUri\":\r

      \t\"/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/Default-Storage-NorthCentralUS/providers/Microsoft.Web/serverfarms/Plan\",\r

      \t\"metricName\": \"CpuPercentage\",\r

      \t\"operator\": \"GreaterThan\"\r

      \t},\r

      \t\"threshold\": 90,\r

      \t\"windowSize\": \"PT15M\",\r

      \t\"timeAggregation\": \"Average\"}"
    properties:
      operator:
        $ref: "#/definitions/ConditionOperator"
        description: the operator used to compare the data and the threshold.
      threshold:
        description: the threshold value that activates the alert.
        format: double
        type: number
      timeAggregation:
        $ref: "#/definitions/TimeAggregationOperator"
        description: the time aggregation operator. How the data that are collected should be combined over time. The default value is the PrimaryAggregationType of the Metric.
      windowSize:
        description: the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day.
        format: duration
        type: string
    required:
      - threshold
      - operator
    type: object
    x-ms-discriminator-value: Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition
  TimeAggregationOperator:
    description: Aggregation operators allowed in a rule.
    enum:
      - Average
      - Minimum
      - Maximum
      - Total
      - Last
    type: string
    x-ms-enum:
      modelAsString: false
      name: TimeAggregationOperator
