components:
  schemas:
    ErrorDetail:
      additionalProperties: false
      properties:
        location:
          description: Where the error occurred, e.g. 'body.items[3].tags' or
            'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: The value at the given location
      type: object
    ErrorModel:
      additionalProperties: false
      properties:
        detail:
          description: A human-readable explanation specific to this occurrence of the
            problem.
          examples:
            - Property foo is required but is missing.
          type: string
        errors:
          description: Optional list of individual error details
          items:
            $ref: "#/components/schemas/ErrorDetail"
          type:
            - array
            - "null"
        instance:
          description: A URI reference that identifies the specific occurrence of the
            problem.
          examples:
            - https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          examples:
            - 400
          format: int64
          type: integer
        title:
          description: A short, human-readable summary of the problem type. This value
            should not change between occurrences of the error.
          examples:
            - Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          examples:
            - https://example.com/errors/example
          format: uri
          type: string
      type: object
    Filter:
      additionalProperties: false
      properties:
        project_ids:
          items:
            type: string
          maxItems: 1000
          type:
            - array
            - "null"
        regions:
          items:
            type: string
          maxItems: 1000
          type:
            - array
            - "null"
        services:
          items:
            enum:
              - compute
              - volume
              - image
              - object
            type: string
          maxItems: 1000
          type:
            - array
            - "null"
        usage_types:
          items:
            type: string
          maxItems: 1000
          type:
            - array
            - "null"
      type: object
    ForecastRequest:
      additionalProperties: false
      properties:
        allow_partial:
          description: When a region does not answer, forecast from the regions that did
            and list the rest in missing_regions, instead of failing the
            forecast.
          type: boolean
        filter:
          $ref: "#/components/schemas/Filter"
        granularity:
          enum:
            - daily
            - monthly
          type: string
        lookback_days:
          default: 7
          format: int64
          maximum: 90
          minimum: 1
          type: integer
        metric:
          enum:
            - cost
          type: string
        time_period:
          $ref: "#/components/schemas/TimePeriod"
      required:
        - time_period
        - granularity
      type: object
    ForecastResponse:
      additionalProperties: false
      properties:
        as_of:
          format: date-time
          type: string
        estimated:
          type: boolean
        forecast_results_by_time:
          items:
            $ref: "#/components/schemas/ForecastResult"
          type:
            - array
            - "null"
        history_period:
          $ref: "#/components/schemas/TimePeriod"
        missing_regions:
          description: Regions left out of an allow_partial forecast because they did not
            answer.
          items:
            type: string
          type:
            - array
            - "null"
        model:
          type: string
        regions:
          description: The regions the history covers and how far each one's data is
            complete.
          items:
            $ref: "#/components/schemas/RegionStatus"
          type:
            - array
            - "null"
        total:
          $ref: "#/components/schemas/Metric"
      required:
        - as_of
        - model
        - estimated
        - history_period
        - total
        - forecast_results_by_time
      type: object
    ForecastResult:
      additionalProperties: false
      properties:
        mean_value:
          type: string
        time_period:
          $ref: "#/components/schemas/TimePeriod"
      required:
        - time_period
        - mean_value
      type: object
    Group:
      additionalProperties: false
      properties:
        keys:
          items:
            type: string
          type:
            - array
            - "null"
        metrics:
          additionalProperties:
            $ref: "#/components/schemas/Metric"
          type: object
      required:
        - keys
        - metrics
      type: object
    Metric:
      additionalProperties: false
      properties:
        amount:
          type: string
        unit:
          type: string
      required:
        - amount
        - unit
      type: object
    RegionStatus:
      additionalProperties: false
      properties:
        data_through:
          format: date-time
          type: string
        name:
          type: string
      required:
        - name
        - data_through
      type: object
    Request:
      additionalProperties: false
      properties:
        allow_partial:
          description: When a region does not answer, return the regions that did and list
            the rest in missing_regions, instead of failing the report.
          type: boolean
        as_of:
          description: Optional reporting cutoff; defaults to the current time and cannot
            be in the future.
          format: date-time
          type: string
        filter:
          $ref: "#/components/schemas/Filter"
        granularity:
          enum:
            - hourly
            - daily
            - monthly
          type: string
        group_by:
          items:
            enum:
              - project_id
              - region
              - service
              - usage_type
              - resource_id
            type: string
          maxItems: 5
          type:
            - array
            - "null"
          uniqueItems: true
        metrics:
          items:
            enum:
              - cost
              - usage_quantity
            type: string
          maxItems: 2
          minItems: 1
          type:
            - array
            - "null"
          uniqueItems: true
        time_period:
          $ref: "#/components/schemas/TimePeriod"
      required:
        - time_period
        - granularity
      type: object
    Response:
      additionalProperties: false
      properties:
        as_of:
          format: date-time
          type: string
        currency:
          type: string
        group_definitions:
          items:
            type: string
          type:
            - array
            - "null"
        missing_regions:
          description: Regions left out of an allow_partial report because they did not
            answer.
          items:
            type: string
          type:
            - array
            - "null"
        pricing_version:
          type: string
        regions:
          description: The regions this report covers and how far each one's data is
            complete.
          items:
            $ref: "#/components/schemas/RegionStatus"
          type:
            - array
            - "null"
        results_by_time:
          items:
            $ref: "#/components/schemas/ResultByTime"
          type:
            - array
            - "null"
      required:
        - as_of
        - currency
        - pricing_version
        - group_definitions
        - results_by_time
      type: object
    ResultByTime:
      additionalProperties: false
      properties:
        estimated:
          type: boolean
        groups:
          items:
            $ref: "#/components/schemas/Group"
          type:
            - array
            - "null"
        time_period:
          $ref: "#/components/schemas/TimePeriod"
        total:
          additionalProperties:
            $ref: "#/components/schemas/Metric"
          type: object
        usage_by_unit:
          additionalProperties:
            $ref: "#/components/schemas/Metric"
          type: object
      required:
        - time_period
        - estimated
        - total
        - groups
      type: object
    TimePeriod:
      additionalProperties: false
      properties:
        end:
          description: Exclusive interval end (RFC3339).
          format: date-time
          type: string
        start:
          description: Inclusive UTC interval start (RFC3339).
          format: date-time
          type: string
      required:
        - start
        - end
      type: object
  securitySchemes:
    keystone_bearer:
      scheme: bearer
      type: http
    keystone_token:
      in: header
      name: X-Auth-Token
      type: apiKey
info:
  description: Estimated costs and usage of your projects, with forecasts.
  title: Cost Explorer
  version: 0.0.0-dev
openapi: 3.1.0
paths:
  /v1/cost_forecasts:
    post:
      description: Projects the trailing daily average over a future period, up to 90
        days. The result is an estimate.
      operationId: create_cost_forecast
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ForecastRequest"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ForecastResponse"
          description: OK
        "400":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Bad Request
        "401":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Unauthorized
        "403":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Forbidden
        "413":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Request Entity Too Large
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Unprocessable Entity
        "429":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Too Many Requests
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Internal Server Error
        "503":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Service Unavailable
        "504":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Gateway Timeout
      security:
        - keystone_token: []
        - keystone_bearer: []
      summary: Calculate a cost forecast
      tags:
        - Cost forecasts
  /v1/cost_reports:
    post:
      description: Computes costs and usage for a period that includes its start and
        excludes its end. Reports are not stored. A token reports on its own
        project.
      operationId: create_cost_report
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Request"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Response"
          description: OK
        "400":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Bad Request
        "401":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Unauthorized
        "403":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Forbidden
        "413":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Request Entity Too Large
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Unprocessable Entity
        "429":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Too Many Requests
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Internal Server Error
        "503":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Service Unavailable
        "504":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ErrorModel"
          description: Gateway Timeout
      security:
        - keystone_token: []
        - keystone_bearer: []
      summary: Calculate a cost and usage report
      tags:
        - Cost reports
servers:
  - url: https://cost-explorer.public.global.vexxhost.net
tags:
  - name: Cost forecasts
  - name: Cost reports
