swagger: "2.0"
schemes:
  - https
host: management.azure.com
info:
  title: MonitorManagementClient
  version: 2019-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/2019-03-01/metricBaselines_API.json
      version: "2.0"
  x-providerName: azure.com
  x-serviceName: monitor-metricBaselines_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:
  AggregationsParameter:
    description: The list of aggregation types (comma separated) to retrieve.
    in: query
    name: aggregation
    required: false
    type: string
    x-ms-parameter-location: method
  ApiVersionParameter:
    description: Client Api Version.
    in: query
    name: api-version
    required: true
    type: string
  BaselineResultTypeParameter:
    description: Allows retrieving only metadata of the baseline. On data request all information is retrieved.
    enum:
      - Data
      - Metadata
    in: query
    name: resultType
    required: false
    type: string
    x-ms-enum:
      modelAsString: false
      name: ResultType
    x-ms-parameter-location: method
  IntervalParameter:
    description: The interval (i.e. timegrain) of the query.
    format: duration
    in: query
    name: interval
    required: false
    type: string
    x-ms-parameter-location: method
  MetricNamesParameter:
    description: The names of the metrics (comma separated) to retrieve.
    in: query
    name: metricnames
    required: false
    type: string
    x-ms-parameter-location: method
  MetricNamespaceParameter:
    description: Metric namespace to query metric definitions for.
    in: query
    name: metricnamespace
    required: false
    type: string
    x-ms-parameter-location: method
  ResourceUriParameter:
    description: The identifier of the resource.
    in: path
    name: resourceUri
    required: true
    type: string
    x-ms-parameter-location: method
    x-ms-skip-url-encoding: true
  SensitivitiesParameter:
    description: The list of sensitivities (comma separated) to retrieve.
    in: query
    name: sensitivities
    required: false
    type: string
    x-ms-parameter-location: method
  TimespanParameter:
    description: The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'.
    in: query
    name: timespan
    required: false
    type: string
    x-ms-parameter-location: method
paths:
  "/{resourceUri}/providers/microsoft.insights/metricBaselines":
    get:
      description: "**Lists the metric baseline values for a resource**."
      operationId: Baselines_List
      parameters:
        - $ref: "#/parameters/ResourceUriParameter"
        - $ref: "#/parameters/MetricNamesParameter"
        - $ref: "#/parameters/MetricNamespaceParameter"
        - $ref: "#/parameters/TimespanParameter"
        - $ref: "#/parameters/IntervalParameter"
        - $ref: "#/parameters/AggregationsParameter"
        - $ref: "#/parameters/SensitivitiesParameter"
        - description: The **$filter** is used to reduce the set of metric data returned.<br>Example:<br>Metric contains metadata A, B and C.<br>- Return all time series of C where A = a1 and B = b1 or b2<br>**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**<br>- Invalid variant:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**<br>This is invalid because the logical or operator cannot separate two different metadata names.<br>- Return all time series where A = a1, B = b1 and C = c1:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**<br>- Return all time series where A = a1<br>**$filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**.
          in: query
          name: $filter
          required: false
          type: string
        - $ref: "#/parameters/BaselineResultTypeParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successful request to get the list of metric baseline values.
          schema:
            $ref: "#/definitions/MetricBaselinesResponse"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - Baseline
        - Metric
      x-ms-examples:
        Get metric baselines:
          parameters:
            aggregation: average
            api-version: 2019-03-01
            interval: PT1H
            metricName: Percentage Cpu
            resourceUri: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1
            sensitivities: Low,Medium
            timespan: 2019-03-12T11:00:00.000Z/2019-03-12T12:00:00.000Z
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/11aeb0ed-456b-4ca0-8df5-b9fbdc63d0d3/resourceGroups/SmartAnalytics-DEV-VM/providers/Microsoft.Compute/virtualMachines/DemoVM1/providers/microsoft.insights/metricBaselines/Percentage CPU
                    name: Percentage CPU
                    properties:
                      baselines:
                        - aggregation: average
                          data:
                            - highThresholds:
                                - 90.3453
                                - 91.3453
                              lowThresholds:
                                - 30
                                - 31.1
                              sensitivity: Low
                            - highThresholds:
                                - 70.3453
                                - 71.3453
                              lowThresholds:
                                - 50
                                - 51.1
                              sensitivity: Medium
                          dimensions: []
                          metadata:
                            - name: ErrorType
                              value: TooManyAnomalies
                            - name: SeasonalityFrequency
                              value: "288"
                          timestamps:
                            - 2019-03-12T11:00:00.000Z
                            - 2019-03-12T12:00:00.000Z
                      interval: PT1H
                      namespace: microsoft.compute/virtualmachines
                      timespan: 2019-03-12T11:00:00.000Z/2019-03-12T12:00:00.000Z
                    type: microsoft.insights/metricBaselines
      x-ms-pageable:
        nextLinkName: null
definitions:
  BaselineMetadata:
    description: Represents a baseline metadata value.
    properties:
      name:
        description: Name of the baseline metadata.
        type: string
      value:
        description: Value of the baseline metadata.
        type: string
    required:
      - name
      - value
  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
  MetricBaselinesProperties:
    description: The response to a metric baselines query.
    properties:
      baselines:
        description: The baseline for each time series that was queried.
        items:
          $ref: "#/definitions/TimeSeriesBaseline"
        type: array
      interval:
        description: The interval (window size) for which the metric data was returned in.  This may be adjusted in the future and returned back from what was originally requested.  This is not present if a metadata request was made.
        format: duration
        type: string
      namespace:
        description: The namespace of the metrics been queried.
        type: string
      timespan:
        description: The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'.  This may be adjusted in the future and returned back from what was originally requested.
        type: string
    required:
      - timespan
      - interval
      - baselines
    type: object
  MetricBaselinesResponse:
    description: A list of metric baselines.
    properties:
      value:
        description: The list of metric baselines.
        items:
          $ref: "#/definitions/SingleMetricBaseline"
        type: array
  MetricSingleDimension:
    description: The metric dimension name and value.
    properties:
      name:
        description: Name of the dimension.
        type: string
      value:
        description: Value of the dimension.
        type: string
    required:
      - name
      - value
    type: object
  SingleBaseline:
    description: The baseline values for a single sensitivity value.
    properties:
      highThresholds:
        description: The high thresholds of the baseline.
        items:
          description: A single high threshold value.
          format: double
          type: number
        type: array
      lowThresholds:
        description: The low thresholds of the baseline.
        items:
          description: A single low threshold value.
          format: double
          type: number
        type: array
      sensitivity:
        description: the sensitivity of the baseline.
        enum:
          - Low
          - Medium
          - High
        type: string
        x-ms-enum:
          modelAsString: true
          name: BaselineSensitivity
    required:
      - sensitivity
      - lowThresholds
      - highThresholds
    type: object
  SingleMetricBaseline:
    description: The baseline results of a single metric.
    properties:
      id:
        description: The metric baseline Id.
        type: string
      name:
        description: The name of the metric for which the baselines were retrieved.
        type: string
      properties:
        $ref: "#/definitions/MetricBaselinesProperties"
        description: The metric baseline properties of the metric.
        x-ms-client-flatten: true
      type:
        description: The resource type of the metric baseline resource.
        type: string
    required:
      - id
      - type
      - name
      - properties
  TimeSeriesBaseline:
    description: The baseline values for a single time series.
    properties:
      aggregation:
        description: The aggregation type of the metric.
        type: string
      data:
        description: The baseline values for each sensitivity.
        items:
          $ref: "#/definitions/SingleBaseline"
        type: array
      dimensions:
        description: The dimensions of this time series.
        items:
          $ref: "#/definitions/MetricSingleDimension"
        type: array
      metadata:
        description: The baseline metadata values.
        items:
          $ref: "#/definitions/BaselineMetadata"
        type: array
      timestamps:
        description: The list of timestamps of the baselines.
        items:
          description: The timestamp for the baseline value in ISO 8601 format.
          format: date-time
          type: string
        type: array
    required:
      - aggregation
      - timestamps
      - data
