view services/jvm-byteman/src/main/resources/jvm-byteman-swagger.yaml @ 302:5e79312c8075

Fix YAML file inconsistencies The new SwaggerCombine utility caught several inconsistencies in the Swagger definitions, almost always defaults/required issues. This patch fixes those issues. Reviewed-by: sgehwolf Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2017-October/025568.html
author Simon Tooke <stooke@redhat.com>
date Mon, 30 Oct 2017 09:51:28 -0400
parents 1738c834713c
children
line wrap: on
line source

swagger: '2.0'
info:
  version: 0.0.1
  title: Thermostat Web Gateway JVM Byteman API
  license:
    name: GPL v2 with Classpath Exception
    url: 'http://www.gnu.org/licenses'
consumes:
  - application/json
produces:
  - application/json
basePath: /jvm-byteman/0.0.1
paths:
  /status/jvms/{jvmId}:
    parameters:
      - $ref: '#/parameters/thermostat-realms'
      - $ref: '#/parameters/jvm-id'
    get:
      description: Get the latest Byteman status.
      parameters:
        - $ref: '#/parameters/include'
        - $ref: '#/parameters/exclude'
        - $ref: '#/parameters/metadata'
      responses:
        '200':
          description: OK
          schema:
            $ref: '#/definitions/jvm-byteman-status-response'
  /status/systems/{systemId}/jvms/{jvmId}:
    parameters:
      - $ref: '#/parameters/thermostat-realms'
      - $ref: '#/parameters/system-id'
      - $ref: '#/parameters/jvm-id'
    post:
      description: Add a Byteman status.
      parameters:
        - $ref: '#/parameters/jvm-byteman-status-array'
        - $ref: '#/parameters/metadata'
      responses:
        '200':
          description: OK
          schema:
            $ref: '#/definitions/metadata'
  /metrics/jvms/{jvmId}:
    parameters:
      - $ref: '#/parameters/thermostat-realms'
      - $ref: '#/parameters/jvm-id'
    get:
      description: Get Byteman metrics.
      parameters:
        - $ref: '#/parameters/limit'
        - $ref: '#/parameters/offset'
        - $ref: '#/parameters/sort'
        - $ref: '#/parameters/include'
        - $ref: '#/parameters/exclude'
        - $ref: '#/parameters/query'
        - $ref: '#/parameters/metadata'
      responses:
        '200':
          description: OK
          schema:
            $ref: '#/definitions/jvm-byteman-metrics-response'
  /metrics/systems/{systemId}/jvms/{jvmId}:
    parameters:
      - $ref: '#/parameters/thermostat-realms'
      - $ref: '#/parameters/system-id'
      - $ref: '#/parameters/jvm-id'
    post:
      description: Add Byteman metrics.
      parameters:
        - $ref: '#/parameters/jvm-byteman-metrics-array'
        - $ref: '#/parameters/metadata'
      responses:
        '200':
          description: OK
          schema:
            $ref: '#/definitions/metadata'
definitions:
  jvm-byteman-metrics-response:
    type: object
    properties:
      response:
          $ref: '#/definitions/jvm-byteman-metrics-array'
      metadata:
        $ref: '#/definitions/metadata'
  jvm-byteman-status-response:
    type: object
    properties:
      response:
          $ref: '#/definitions/jvm-byteman-status-array'
      metadata:
        $ref: '#/definitions/metadata'
  jvm-byteman-status-array:
    type: array
    items:
      $ref: '#/definitions/jvm-byteman-status'
  jvm-byteman-metrics-array:
    type: array
    items:
      $ref: '#/definitions/jvm-byteman-metric'
  jvm-byteman-metric:
    type: object
    properties:
      agentId:
        type: string
      jvmId:
        type: string
      timeStamp:
        allOf:
          - $ref: '#/definitions/metric'
          - description: UNIX timestamp in milliseconds
      marker:
        type: string
      payload:
        $ref: '#/definitions/jvm-byteman-metric-payload'
  jvm-byteman-status:
    type: object
    properties:
      agentId:
        type: string
      jvmId:
        type: string
      timeStamp:
        allOf:
          - $ref: '#/definitions/metric'
          - description: UNIX timestamp in milliseconds
      rule:
        type: string
      listenPort:
        type: integer
  jvm-byteman-metric-payload:
    type: object
    description: "A key-value pair, where values can be of type String, Boolean or Double. Example { \"some-key\": \"stringValue\", \"booleanKey\" : true, \"doubleKey\": 3.14 }"
    properties:
      key:
        type: string
      value:
        $ref: '#/definitions/map-value'
  map-value:
    enum: [
      $ref: '#/definitions/map-value-string'
      $ref: '#/definitions/map-value-boolean'
      $ref: '#/definitions/map-value-float'
    ]
  map-value-string:
    type: string
  map-value-boolean:
    type: boolean
  map-value-float:
    type: number
    format: float
  metadata:
      type: object
      properties:
        payloadCount:
          type: integer
        count:
          type: integer
        prev:
          type: string
        next:
          type: string
        first:
          type: string
        last:
          type: string
        insertCount:
          type: integer
        matchCount:
          type: integer
        elapsed:
          type: integer
          format: int64
  metric:
    type: object
    properties:
      $numberLong:
        type: string
parameters:
  system-id:
    name: systemId
    in: path
    required: true
    type: string
  jvm-id:
    name: jvmId
    in: path
    required: true
    type: string
  jvm-byteman-status-array:
    name: jvm-byteman-status-array
    in: body
    description: The jvm byteman status
    required: true
    schema:
      $ref: '#/definitions/jvm-byteman-status-array'
  jvm-byteman-metrics-array:
    name: jvm-byteman-metrics-array
    in: body
    description: The jvm Byteman metrics
    required: true
    schema:
      $ref: '#/definitions/jvm-byteman-metrics-array'
  limit:
    name: limit
    in: query
    description: Limit of items to return. Example '1'
    type: integer
    required: false
    default: 1
  offset:
    name: offset
    in: query
    description: Offset of items to return. Example '0'
    type: integer
    required: false
    default: 0
  sort:
    name: sort
    in: query
    description: Sort string. Comma separated list of fields prefixed with '+' for ascending or '-' for descending. Example '?s=+a,-b' Fields use dot notation for embedded documents. Example 'outer.inner' refers to field inner contained in field outer.
    type: string
    required: false
  query:
    name: query
    in: query
    description: Query string. Comma separated list of key, comparator, value pairs. Comparator supports '==', '<=', '>=', '<', '>', '!='. Example '?q=a==b,c!=d'. Keys are fields in documents and use dot notation for embedded documents. Example 'outer.inner' refers to field inner contained in field outer.
    type: string
    required: false
  include:
    name: include
    in: query
    description: >-
      Inclusion string. Comma separated list of fields to include in the
      response. Example '?include=a,b' Fields use dot notation for embedded
      documents. Example 'outer.inner' refers to field inner contained in field
      outer. Cannot be used in combination with 'exclude' parameter. Overriden by
      'exclude' parameter
    type: string
    required: false
  exclude:
    name: exclude
    in: query
    description: >-
      Exclusion string. Comma separated list of fields to exclude in the
      response. Example '?exclude=a,b' Fields use dot notation for embedded
      documents. Example 'outer.inner' refers to field inner contained in field
      outer. Cannot be used in combination with 'include' parameter; takes
      precedence over 'include' parameter
    type: string
    required: false
  metadata:
    name: metadata
    type: boolean
    in: query
    description: "Metadata flag. If set to 'true', the subsequent request response will return metadata information. If set to 'false', such metadata information will be omitted."
  thermostat-realms:
      name: X-Thermostat-Realms
      type: string
      in: header
      description: "Realms Header used to specify a subset of roles to use for Keycloak authorization. Attempts to specify realms that the client does not have, or no valid realms at all will result in a 400 Bad Request response. Expects a space separated list of realms. Example 'X-Thermostat-Realms: realm-one realm-two'"