openapi: 3.0.0
info:
  version: 'v.2.2.36'
  title: 'Luna-Configurator API'
  description: |

          Service provides RESTFul api interface for creating, removing, editing and getting settings.
        
          There is possibility to get settings by tags for one specific service.
        
          Also there is a simple web-GUI in which one can get, edit or remove existing settings.

          OpenAPI specification is the only valid document providing up-to-date information about the service API. 

          The specification can be used:

          - By documentation generation tools to visualize the API.
          - By code generation tools.

          All the documents and code generated using this specification can include inaccuracies and should be carefully checked.

          OpenAPI specification can be received using the "/docs/spec" resource. The "Accept" header should be set to "application/x-yaml".

components:
  headers:
    application_json:
      schema:
        type: string
        enum:
          - application/json
          - application/json; charset=utf-8
      required: true

    application_octet-stream:
      schema:
        type: string
        enum:
          - application/octet-stream
      required: true

    config_accept_content_type:
      schema:
        type: string
        enum:
          - application/json
          - application/json; charset=utf-8
          - text/plain
      required: true
      description: The content type of the response body.

    text_html:
      schema:
        type: string
        enum:
          - text/html
      required: true
      description: Content type is text/html

    pullerResponse:
      schema:
        type: string
        enum:
          - application/json
          - application/json; charset=utf-8
          - application/x-vl-config-file
      description: Expected response format from puller
      required: true

    luna_request_id:
      schema:
        type: string
        format: timestamp,uuid4
        example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a
        pattern: ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$
      description: |
        External request id. Helps to uniquely identify messages that correspond to particular requests, in system logs.
        If it was not set, system will set it in default format ("timestamp,UUID4"). It will be returned with response.
      required: true

    content_disposition:
      schema:
        type: string
        pattern: ^attachment; filename=luna-configurator-dump-\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}.json$
        example: attachment; filename=luna-configurator-dump-2020-01-01T13-00-00.json
      description: The Content-Disposition response-header field to suggest a default filename if the user requests that the content is saved to a file.
      required: true

    docs_content_type:
      schema:
        type: string
        enum:
          - application/x-yaml
          - text/html
      required: true
      description: Type of receiving data
  parameters:
    luna_request_id:
      in: header
      schema:
        type: string
        format: timestamp,uuid4
        example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a
        pattern: ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$
      description: |
            external request id. Helps to uniquely identify messages that correspond to particular requests, in system logs.
            If it was not set, system will set it in default format ("timestamp,UUID4"). It will be returned with response.
      name: Luna-Request-Id
      required: false

    accept_config_handler:
      in: header
      name: Accept
      schema:
        type: string
        enum:
          - application/json
          - text/plain
        description: One of application/json, text/plain
      description: acceptable type of receiving data

    applicationJsonContent:
      in: header
      name: Content-Type
      schema:
        type: string
        enum:
          - application/json
      description: content type is application/json.
      required: false

    applicationJsonContentRequired:
      in: header
      name: Content-Type
      schema:
        type: string
        enum:
          - application/json
      description: content type is application/json.
      required: true

    applicationJsonAccept:
      in: header
      name: Accept
      schema:
        type: string
        enum:
          - application/json
      description: Accept is application/json.
      required: false

    pullerConfigFileAccept:
      in: header
      name: Accept
      schema:
        type: string
        enum:
          - application/x-vl-config-file
          - application/json
      description: Possible accept from puller
      required: false

    setting_name:
      in: query
      name: setting_name
      description: Setting name
      example: 'DEFAULT_IMAGE_EXTENSION'
      schema:
        type: string
      required: false

    service_name:
      in: path
      name: service_name
      description: Service name
      example: 'luna-image-store'
      schema:
        type: string
      required: true

    service_name_filter:
      in: query
      name: service_name
      description: Service name
      example: 'luna-image-store'
      schema:
        type: string
      required: false

    tags:
      in: query
      name: tags
      example: 'TAG1,TAG2'
      description: Comma separated setting tags.
      schema:
        $ref: '#/components/schemas/setting_tags'
      required: false

    page:
      in: query
      name: page
      example: 2
      description: Page number
      schema:
        $ref: '#/components/schemas/page'
      required: false

    page_size:
      in: query
      name: page_size
      example: 1000
      description: Number of entries per page
      schema:
        $ref: '#/components/schemas/page_size'
      required: false

    get_schema:
      in: query
      name: get_schema
      example: 1
      description: Allows to get the corresponding JSON scheme
      schema:
        $ref: '#/components/schemas/get_schema'
      required: false

    is_default:
      in: query
      name: is_default
      schema:
        $ref: '#/components/schemas/is_default'
      required: false

    setting_id:
      in: path
      name: setting_id
      example: 12
      schema:
        type: string
      description: Setting Id
      required: true

    limitation_names:
      in: query
      name: limitation_names
      description: Comma separated limitation names.
      example: 'LOG_TIME,LOG_LEVEL'
      schema:
        type: string
      required: false

    limitation_name:
      in: path
      name: limitation_name
      description: Limitation name
      example: 'LOG_TIME'
      schema:
        type: string
      required: true

    description:
      in: query
      name: description
      description: Part or whole description to filter by it
      example: 'Main database for luna-events service'
      schema:
        type: string
      required: false

    group_name:
      in: path
      name: group_id
      description: Group name
      example: 'luna-platform'
      schema:
        type: string
      required: true

    group_names:
      in: query
      name: group_names
      description: Comma separated group names.
      example: 'group_1,group_2'
      schema:
        type: string
      required: false

    accept_docs_handler:
      in: header
      name: Accept
      schema:
        $ref: '#/components/schemas/accept_docs_handler'
      required: true
      description: acceptable type of receiving data
  schemas:
    AnyStandaloneType:
      description: any standalone type
      anyOf:
        - type: object
          additionalProperties: true
        - type: number
        - type: string
        - type: boolean

    AnyType:
      description: any type
      anyOf:
        - $ref: "#/components/schemas/AnyStandaloneType"
        - type: array
          items:
            - $ref: "#/components/schemas/AnyStandaloneType"

    config_file_plain_text:
      type: string
      description: x-vl-config-file file body

    is_default:
      description: Is default setting mark
      enum:
        - true
        - false
      type: boolean

    get_schema:
      enum:
        - 0
        - 1
      default: 0
      type: integer

    setting_id:
      type: integer
      example: 12
      description: Setting ID
      minimum: 1

    page:
      type: integer
      default: 1

    page_size:
      type: integer
      maximum: 1000
      minimum: 1
      default: 10

    service_name:
      maxLength: 128
      type: string
      description: Service name

    setting_tag:
      maxLength: 128
      type: string
      description: Setting tag

    setting_tags:
      type: array
      description: Setting tags list
      items:
        $ref: '#/components/schemas/setting_tag'

    limitation_name:
      maxLength: 128
      type: string
      description: Limitation name

    group_name:
      type: string
      maxLength: 128
      minLength: 2
      description: Group name

    group_description:
      maxLength: 256
      type: string
      description: Group description

    application_json:
      type: string
      description: content type is application/json

    default_description:
      default: None
      maxLength: 128
      type: string

    setting_id_response:
      type: object
      properties:
        setting_id:
          $ref: '#/components/schemas/setting_id'
      required:
        - setting_id

    time:
      type: string
      format: date-time
      example: "2018-08-11T09:11:41.674+00:00"
      description: time in format RFC 3339

    patch_limitation_response:
      type: object
      properties:
        setting_id:
          allOf:
            - $ref: '#/components/schemas/setting_id'
          description: Old default setting ID
        unverified_setting_ids:
          type: array
          items:
            allOf:
              - $ref: '#/components/schemas/setting_id'
          description: |
                        Unverified setting IDs. This list contains IDs of the settings that's values does not satisfy
                        the new scheme of the corresponding limitation. The list will contain a value only if limitation is replaced.
      required:
        - setting_id
        - unverified_setting_ids

    put_limitation_response:
      type: object
      properties:
        setting_id:
          allOf:
            - $ref: '#/components/schemas/setting_id'
          description: New setting ID
        unverified_setting_ids:
          type: array
          items:
            allOf:
              - $ref: '#/components/schemas/setting_id'
          description: |
            Unverified setting IDs. This list contains IDs of the settings that's values does not satisfy
            the new scheme of the corresponding limitation. The list will contain a value only if limitation is replaced.
      required:
        - setting_id

    patch_limitation:
      type: object
      properties:
        default_value:
          type: object
          description: Default value for limitation
        description:
          allOf:
            - $ref: '#/components/schemas/default_description'
          default: ""
          description: Description for limitation
        validation_schema:
          type: object
          description: Schema for validate settings values
        services:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/service_name'
          description: Names of services that use this limitation
        group_names:
          type: array
          description: Names of groups that use this limitation
          items:
            $ref: '#/components/schemas/group_name'
          minItems: 1
      minProperties: 1

    groups_list:
      type: object
      properties:
        groups:
          description: Groups list
          type: array
          items:
            $ref: '#/components/schemas/group_with_description'
      required:
        - groups

    setting_for_reply:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/setting_id'
        value:
          $ref: "#/components/schemas/AnyType"
          description: Setting value
        description:
          allOf:
            - $ref: '#/components/schemas/default_description'
          description: Setting description
          default: ""
        create_time:
          allOf:
          - $ref: '#/components/schemas/time'
          - description: Setting create time
        last_update_time:
          allOf:
          - $ref: '#/components/schemas/time'
          - description: Setting last update time
        name:
          description: Setting name
          type: string
        is_default:
          $ref: '#/components/schemas/is_default'
        tags:
          allOf:
           - $ref: '#/components/schemas/setting_tags'
          minItems: 0
        validation_schema:
          type: object
          description: Limitation JSON schema
          additionalProperties: true
      required:
        - id
        - description
        - create_time
        - last_update_time
        - tags
        - is_default
        - name
        - value

    settings_for_reply:
      type: object
      properties:
        settings:
          type: array
          items:
            $ref: '#/components/schemas/setting_for_reply'
        count:
          type: integer
          description: 'Number of settings returned'
      required: [settings, count]

    post_settings:
      type: object
      properties:
        value:
          type: object
          description: Setting value
        description:
          allOf:
            - $ref: '#/components/schemas/default_description'
          description: Setting description
          default: ""
        name:
          type: string
          description: Setting name
        tags:
          allOf:
            - $ref: '#/components/schemas/setting_tags'
          description: List of various tags that will be used to get settings from the puller
          minItems: 1
      required:
        - tags
        - name
        - value

    put_setting_request:
      type: object
      properties:
        value:
          $ref: "#/components/schemas/AnyType"
          description: Setting value
        description:
          allOf:
            - $ref: '#/components/schemas/default_description'
          description: Setting description
          default: ""
        name:
          type: string
          description: Setting name
        tags:
          allOf:
            - $ref: '#/components/schemas/setting_tags'
          description: 'Tags must be specified when replacing a non-default setting.
                        While changing the default setting, one don’t need to specify tags'
      required:
        - tags
        - name
        - value

    put_limitation:
      type: object
      properties:
        validation_schema:
          type: object
          description: Limitation JSON schema
        default_value:
          $ref: "#/components/schemas/AnyType"
          description: Default value
        description:
          allOf:
            - $ref: '#/components/schemas/default_description'
          description: Limitation description
          default: ""
        services:
          type: array
          description: List services for this limitation
          minItems: 1
          items:
            $ref: '#/components/schemas/service_name'
        group_names:
          type: array
          description: List groups for this limitation
          items:
            $ref: '#/components/schemas/group_name'
      required:
        - validation_schema
        - default_value
        - services

    get_limitations:
      type: array
      description: Limitations list
      items:
        $ref: '#/components/schemas/get_limitation'

    get_limitation:
      type: object
      properties:
        limitation_name:
          $ref: '#/components/schemas/limitation_name'
        services:
          description: List services for this limitation
          type: array
          items:
            $ref: '#/components/schemas/service_name'
        validation_schema:
          type: object
          description: Limitation JSON schema
          additionalProperties: true
        default_value:
          $ref: "#/components/schemas/AnyType"
          description: Default value
        description:
          allOf:
            - $ref: '#/components/schemas/default_description'
          description: Limitation description
          default: ""
      required:
        - default_value
        - validation_schema
        - services
        - description
        - limitation_name

    dump_limitations:
      type: array
      description: Limitations list
      items:
        allOf:
          - $ref: '#/components/schemas/get_limitation'
          - properties:
              group_names:
                type: array
                description: List of groups for this limitation
                items:
                  $ref: '#/components/schemas/group_name'

    dump_settings:
      type: array
      description: Settings list
      items:
        allOf:
          - $ref: '#/components/schemas/put_setting_request'
          - required: [description]

    dump_groups:
      type: array
      description: Group list
      items:
        $ref: '#/components/schemas/group_with_description'

    get_services:
      type: object
      properties:
        services:
          description: Services list
          type: array
          items:
            $ref: '#/components/schemas/service_name'
      required:
        - services

    post_group:
      type: object
      properties:
        group_name:
          $ref: '#/components/schemas/group_name'
        description:
          allOf:
            - $ref: '#/components/schemas/group_description'
          default: ""
      required:
        - group_name

    patch_group:
      type: object
      properties:
        description:
          allOf:
            - $ref: '#/components/schemas/group_description'
          default: ""
      required:
        - description

    group_with_description:
      type: object
      properties:
        group_name:
          $ref: '#/components/schemas/group_name'
        description:
          allOf:
            - $ref: '#/components/schemas/group_description'
          default: ""
      required:
        - group_name
        - description

    groups_linker:
      type: object
      properties:
        group_names:
          description: Groups list
          type: array
          items:
            $ref: '#/components/schemas/group_name'
          minItems: 1
        limitation_names:
          type: array
          description: Limitations list
          items:
            $ref: '#/components/schemas/limitation_name'
          minItems: 1
        action:
          type: string
          enum:
            - 'attach'
            - 'detach'
          description: 'attach or detach list limitations from a list groups'
      required:
        - group_names
        - limitation_names
        - action

    groups_post_response:
      type: object
      properties:
        group_name:
          $ref: '#/components/schemas/group_name'
      required:
        - group_name


    puller_request:
      type: object
      description: 'Setting for service (key - setting name, value - setting value).
                    Names of settings names whose value must be returned with the specified tag'
      properties:
        '<SETTING_NAME>':
          allOf:
            - $ref: '#/components/schemas/setting_tag'
          description: 'The key-value format object, where the key is the non-default setting name, and the value is its tag.'

    puller_setting_value:
      type: object
      properties:
        value:
          $ref: "#/components/schemas/AnyType"
          description: Setting value
        id:
          $ref: '#/components/schemas/setting_id'
      required:
        - id
        - value

    puller_response:
      type: object
      description: Setting for service (key - setting name, value - setting value)
      properties:
        '<SETTING_NAME>':
          allOf:
            - $ref: '#/components/schemas/puller_setting_value'
          description: 'Settings matching the requested tag or default settings'
      # required this hack due to current openapi version does not support pattern properties
      # but it needs to validate responses using this jsonschema, pattern must match setting name pattern
      additionalProperties: false
      patternProperties:
        type: object
        "^[a-zA-Z0-9_-]{1,128}$":
          allOf:
            - $ref: '#/components/schemas/puller_setting_value'
          description: 'Settings matching the requested tag or default settings'

    int_version:
      type: integer
      minimum: 0
      description: Part of the version

    version:
      type: object
      properties:
        Version:
          type: object
          properties:
            api:
              allOf:
                - $ref: '#/components/schemas/int_version'
              description: an api version of service.
            major:
              allOf:
                - $ref: '#/components/schemas/int_version'
              description: a major version of service.
            minor:
              allOf:
                - $ref: '#/components/schemas/int_version'
              description: a minor version of service.
            patch:
              allOf:
                - $ref: '#/components/schemas/int_version'
              description: a patch version of service.
          required:
            - api
            - major
            - minor
            - patch
      required:
        - Version

    Error:
      type: object
      properties:
        error_code:
          type: integer
          description: Error code.
        desc:
          type: string
          description: Short error description.
        detail:
          type: string
          description: Error details.
        link:
          type: string
          description: Link to the documentation website with the error description.
      required:
        - error_code
        - detail
        - desc
        - link
      example:
        error_code: 1
        detail: internal server error
        desc: internal server error
        link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-1/

    dump_file:
      type: object
      properties:
        limitations:
          $ref: '#/components/schemas/dump_limitations'
        settings:
          $ref: '#/components/schemas/dump_settings'
        groups:
          $ref: '#/components/schemas/dump_groups'
        version:
          type: string
          maxLength: 36
          description: configs migration version
      required: [limitations, settings, groups, version]
      description: body contain json
      example: {
        "limitations": [{
          "limitation_name": "STORAGE_TYPE",
          "validation_schema": {
            "type": "string",
            "enum": ["LOCAL", "S3"]},
          "services": ["luna-image-store"],
          "default_value": "LOCAL",
          "description": "Storage type. LOCAL - local directory, S3 - AWS S3",
          "group_names": ["luna-origin"]}
        ],
        "settings": [{
          "name": "STORAGE_TYPE",
          "value": "S3",
          "description": "default Storage type. LOCAL - local directory, S3 - AWS S3",
          "tags": [
            "storage_tag"
          ]}],
        "groups": [{
          "group_name": "luna-origin",
          "description": "original platform group"
          }],
        "version": "99993b66"
      }

    accept_docs_handler:
      type: string
      enum: [application/x-yaml, text/html]

    health_ok:
      description: successful healthcheck execution info
      type: object
      properties:
        execution_time:
          type: number
          example: 0.123
          description: request execution time in seconds
      required: [ execution_time ]

    health_errors:
      type: object
      properties:
        errors:
          description: failed healthcheck execution info
          type: array
          items:
            type: object
            properties:
              component:
                description: component name
                type: string
              error:
                allOf:
                  - description: healthcheck error
                  - $ref: '#/components/schemas/Error'
              status:
                description: component health status
                type: integer
                enum: [ 0, 1 ]
            required: [ component, error, status ]
      required: [ errors ]
      example:
        errors:
          - component: configurator_db
            error:
              error_code: 10017
              desc: Database error
              detail: Database connection timeout error
            status: 0
          - component: configurator_db_migration
            error:
              error_code: 10017
              desc: Database error
              detail: Database connection timeout error
            status: 0

    plugin_status:
      type: object
      properties:
        name:
          type: string
          description: Plugin name
        running:
          type: integer
          enum: [0, 1]
          description: Whether plugin is running or not.
      required: [name, running]

    plugins:
      type: object
      properties:
        plugins:
          description: list of imported plugins
          type: array
          items:
            $ref: '#/components/schemas/plugin_status'
      required: [plugins]
      example:
        plugins:
          - name: foo
            running: 1
  responses:
    internal_server_error:
      description: Internal server error
      headers:
        Content-Type:
          $ref: '#/components/headers/application_json'
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            error_response:
              value:
                error_code: 1
                detail: "Internal server error"
                desc: "Internal server error"
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-1"

    forbidden_resource_error:
      description: Forbidden.
      headers:
        Content-Type:
          $ref: '#/components/headers/application_json'
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            resource_is_disabled:
              value:
                error_code: 12049
                desc: Forbidden
                detail: Resource is disabled.
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12049"
paths:
  /dashboard/:
    get:
      tags:
        - dashboard
      summary: Graphical interface for managing settings
      description: HTML page with GUI in which one can get, change or delete settings
      operationId: getDashboard
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/text_html'
          content:
            text/html:
              example: '<html> ... </html>'
        500:
          $ref: '#/components/responses/internal_server_error'
  /version:
    get:
      tags:
      - version
      summary: get version
      description: get version of service
      operationId: getVersion
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              example:
                Version:
                  api: 1
                  major: 0
                  minor: 0
                  patch: 1
              schema:
                $ref: '#/components/schemas/version'
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/puller/{service_name}:
    parameters:
      - $ref: '#/components/parameters/service_name'
    post:
      tags:
        - puller
      summary: Get settings for exact service
      operationId: getPuller
      description: |
                    Request to receive most relevant settings for exact service.
                    Using the values ​​of the "Accept" header, you can get a response in JSON or configuration file format.
                    Skip body if you need only default settings.
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/applicationJsonContentRequired'
        - $ref: '#/components/parameters/pullerConfigFileAccept'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/puller_request'
            examples:
              default:
                value: {}
              with_value:
                value:
                  DEFAULT_IMAGE_EXTENSION: 'tag1'
                  INFLUX_MONITORING: 'tag2'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/pullerResponse'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/puller_response'
              example:
                LUNA_FACES_ADDRESS:
                  value:
                    origin: http://127.0.0.1:5030
                    api_version: 2
                  id: 15
                LUNA_FACES_TIMEOUTS:
                  value:
                    request: 60
                    connect: 20
                    sock_connect: 10
                    sock_read: 20
                  id: 36
                INFLUX_MONITORING:
                  value:
                    send_data_for_monitoring: 0
                    use_ssl: 0
                    flushing_period: 1
                    host: 127.0.0.1
                    port: 8086
                    database_name: luna_monitoring
                    user_name: luna
                    password: luna
                  id: 45
                LUNA_LICENSES_LOGGER:
                  value:
                    log_level: INFO
                    folder_with_logs: ./
                    max_log_file_size: 1024
                    log_time: LOCAL
                  id: 80
            application/x-vl-config-file:
              schema:
                $ref: '#/components/schemas/config_file_plain_text'
              example: |
                [LUNA_FACES_ADDRESS]
                ORIGIN = http://127.0.0.1:5030
                API_VERSION = 2

                [LUNA_FACES_TIMEOUTS]
                REQUEST = 60
                CONNECT = 20
                SOCK_CONNECT = 10
                SOCK_READ = 20

                [INFLUX_MONITORING]
                SEND_DATA_FOR_MONITORING = 0
                USE_SSL = 0
                FLUSHING_PERIOD = 1
                HOST = 127.0.0.1
                PORT = 8086
                DATABASE_NAME = luna_monitoring
                USER_NAME = luna
                PASSWORD = luna

                [LUNA_LICENSES_LOGGER]
                LOG_LEVEL = INFO
                FOLDER_WITH_LOGS = ./
                MAX_LOG_FILE_SIZE = 1024
                LOG_TIME = LOCAL
        400:
          description: Bad Request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              examples:
                Bad/incomplete input data:
                  value:
                    error_code: 12012
                    desc: 'Bad/incomplete input data'
                    detail: 'Request does not contain json'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
                Tag not found:
                  value:
                    error_code: 27005
                    desc: "Bad/incomplete input data"
                    detail: "Tag 'kek' for setting 'DEFAULT_IMAGE_EXTENSION' not found"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-27005"
              schema:
                $ref: '#/components/schemas/Error'
        406:
          description: Not Acceptable
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              example:
                error_code: 12023
                desc: Bad/incomplete input data
                detail: 'Content type is unacceptable, allowed types: "application/x-vl-config-file, application/json"'
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12023"
              schema:
                $ref: '#/components/schemas/Error'

        500:
          $ref: '#/components/responses/internal_server_error'
  /1/settings/{setting_id}:
    parameters:
      - $ref: '#/components/parameters/setting_id'
    get:
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
      tags:
        - settings
      description: Get setting
      summary: Get setting by id
      operationId: getSetting
      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/setting_for_reply'
              example:
                id: 12
                value:
                  db_type: 'postgres'
                  db_user: 'luna'
                  db_password: 'luna'
                  db_name: 'luna_faces'
                  db_host: '127.0.0.1'
                  db_port: 5432
                description: 'default Main database for luna-faces service'
                create_time: 2018-08-11T09:11:41.674+00:00
                last_update_time: 2018-08-11T09:11:41.674+00:00
                name: 'LUNA_FACES_DB'
                is_default: true
                tags: []
        404:
          description: Setting not found
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 27001
                desc: 'Object not found'
                detail: "Setting with id '777' not found"
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-27001"
        500:
          $ref: '#/components/responses/internal_server_error'

    put:
      tags:
        - settings
      summary: Replace setting
      description: Replace setting
      operationId: replaceSetting
      parameters:
        - $ref: '#/components/parameters/applicationJsonContent'
        - $ref: '#/components/parameters/luna_request_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/put_setting_request'
            example:
              value:
                db_type: 'postgres'
                db_user: 'luna'
                db_password: 'luna'
                db_name: 'luna_index_manager'
                db_host: '127.0.0.1'
                db_port: 5432
              description: 'database settings'
              name: 'LUNA_INDEX_MANAGER_DB'
              tags:
                - 'ffff'
      responses:
        200:
          description: Rewrited
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Location:
              schema:
                type: string
              required: true
              description: Location header
              example: '/1/setting/123'
          content:
            application/json:
              example:
                setting_id: 304
              schema:
                $ref: '#/components/schemas/setting_id_response'
        400:
          description: Bad request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              examples:
                Not allowed to change default setting name:
                  value:
                    error_code: 27012
                    desc: 'Bad/incomplete input data'
                    detail: "Not allowed to change default setting name"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-27012"
                Failed to validate input json:
                  value:
                    error_code: 12022
                    desc: 'Bad/incomplete input data'
                    detail:
                              "Failed to validate input json. Path: 'tags',
                              message: 'tags' must be empty for the default setting"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022"
                Request does not contain json:
                  value:
                    error_code: 12002
                    desc: 'Bad/incomplete input data'
                    detail: 'Request does not contain json'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12002"
              schema:
                $ref: '#/components/schemas/Error'
        404:
          description: Setting not found
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 27001
                desc: 'Object not found'
                detail: "Setting with id '777' not found"
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-27001"
        409:
          description: Conflict
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              example:
                error_code: 27002
                desc: "Integrity error"
                detail: "Setting with the following fields already exists: name: S3 tag: kkk"
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-27002"
              schema:
                $ref: '#/components/schemas/Error'
        500:
          $ref: '#/components/responses/internal_server_error'

    delete:
      tags:
        - settings
      summary: Delete setting
      description: Delete setting by ID
      operationId: deleteSetting
      responses:
        204:
          description: success remove setting
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        423:
          description: Cannot remove setting
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              example:
                error_code: 27011
                desc: "Bad/incomplete input data"
                detail: "Cannot remove default setting 'STORAGE_TIME'"
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-27011"
              schema:
                $ref: '#/components/schemas/Error'
        404:
          description: Setting not found
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 27001
                desc: 'Object not found'
                detail: "Setting with id '123' not found"
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-27001"
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/settings/services:
    get:
      tags:
        - services
      summary: Get services list
      description: Get services list
      operationId: getServices
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              example: 
                services:
                  - 'luna-faces'
                  - 'luna-events'
              schema:
                $ref: '#/components/schemas/get_services'
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/settings:
    post:
      tags:
        - settings
      summary: Create new setting
      description: Create new setting
      operationId: newSetting
      parameters:
        - $ref: '#/components/parameters/applicationJsonContent'
        - $ref: '#/components/parameters/luna_request_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/post_settings'
            example:
              value:
                db_type: 'postgres'
                db_user: 'luna'
                db_password: 'luna'
                db_name: 'luna_index_manager'
                db_host: '127.0.0.1'
                db_port: 5432
              name: 'LUNA_INDEX_MANAGER_DB'
              tags:
                - 'tag1'
                - 'tag2'
      responses:
        201:
          description: Created
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Location:
              schema:
                type: string
              required: true
              description: Location header
              example: '/1/settings/113'
          content:
            application/json:
              example:
                setting_id: 304
              schema:
                $ref: '#/components/schemas/setting_id_response'
        400:
          description: Bad request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              examples:
                Object not found:
                  value:
                    error_code: 27006
                    desc: "Object not found"
                    detail: "Limitation named 'LUNA_INDEX_MANAGER_DB1' not found"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-27006"
                Bad/incomplete input data:
                  value:
                    error_code: 12002
                    desc: 'Bad/incomplete input data'
                    detail: 'Request does not contain json'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12002"

              schema:
                $ref: '#/components/schemas/Error'
        409:
          description: Conflict
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              example:
                error_code: 27002
                desc: 'Integrity error'
                detail: 'Setting with the following fields already exists: name: LUNA_CONFIGURATOR_DB tag: tag11'
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-27002"
              schema:
                $ref: '#/components/schemas/Error'
        500:
          $ref: '#/components/responses/internal_server_error'
    get:
      tags:
        - settings
      summary: Get settings
      description: Get settings by filters
      operationId: getSettings
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/tags'
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/page_size'
        - $ref: '#/components/parameters/get_schema'
        - $ref: '#/components/parameters/is_default'
        - $ref: '#/components/parameters/setting_name'
        - $ref: '#/components/parameters/service_name_filter'
        - $ref: '#/components/parameters/group_names'
        - $ref: '#/components/parameters/description'
      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/settings_for_reply'
              examples:
                database settings:
                  value:
                    id: 12
                    value:
                      db_type: 'postgres'
                      db_user: 'luna'
                      db_password: 'luna'
                      db_name: 'luna_faces'
                      db_host: '127.0.0.1'
                      db_port: 5432
                    description: 'default Main database for luna-faces service'
                    create_time: 2018-08-11T09:11:41.674+00:00
                    last_update_time: 2018-08-11T09:11:41.674+00:00
                    name: LUNA_FACES_DB
                    is_default: true
                    tags: []
                    validation_schema:
                      properties:
                        db_type:
                          type: string
                          enum:
                            - postgres
                            - oracle
                            - vertica
                with tags:
                  value:
                    id: 98
                    value: 'default'
                    description: 'default quality profile'
                    create_time: 1576516589
                    last_update_time: 1576685684
                    name: 'DEFAULT_QUALITY_PROFILE_NAME'
                    is_default: true
                    tags:
                      - 'tag1'
                      - 'tag2'
        400:
          description: Bad Request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_page:
                  value:
                    error_code: 12012
                    desc: 'Bad/incomplete input data'
                    detail: "Bad query parameters 'page'"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
                bad_service_name:
                  value:
                    error_code: 11035
                    desc: 'Service name not found'
                    detail: "Service name luna-fcs not found"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11035"
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/settings/limitations:
    get:
      summary: Get limitations
      description: Get limitations by filters
      operationId: getLimitations
      tags:
        - limitations
      parameters:
        - $ref: '#/components/parameters/limitation_names'
        - $ref: '#/components/parameters/description'
        - $ref: '#/components/parameters/group_names'
        - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/get_limitations'
              example:
                -
                  limitation_name: 'LUNA_INDEX_MANAGER_DB'
                  validation_schema:
                    properties:
                      db_type:
                        type: 'string'
                        enum: 
                          - 'postgres'
                          - 'oracle'
                          - 'vertica'
                      db_user:
                        type: 'string'
                      db_password:
                        type: 'string'
                      db_name:
                        type: 'string'
                      db_host:
                        type: 'string'
                      db_port:
                        type: 'integer'
                        minimum: 1
                    required:
                      - 'db_type'
                      - 'db_user'
                      - 'db_password'
                      - 'db_name'
                      - 'db_host'
                      - 'db_port'
                    type: 'object'
                    additionalProperties: false
                  services:
                    - 'luna-index-manager'
                  default_value:
                     db_type: 'postgres'
                     db_user: 'luna'
                     db_password: 'luna'
                     db_name: 'luna_index_manager'
                     db_host: '127.0.0.1'
                     db_port: 5432
                  description: 'Main database for luna-index-manager service'
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/settings/limitations/{limitation_name}:
    parameters:
      - $ref: '#/components/parameters/limitation_name'
    get:
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
      tags:
        - limitations
      summary: Get limitation
      description: Get limitation by name
      operationId: getLimitation
      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              example:
                limitation_name: TTL_DESCRIPTOR
                services:
                  - 'luna-admin'
                validation_schema:
                  type: 'integer'
                default_value: 1
                description: 'ttl of free descriptors (in days)'
              schema:
                $ref: '#/components/schemas/get_limitation'
        404:
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          description: Object not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 27006
                desc: 'Object not found'
                detail: "Limitation named 'kek' not found"
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-27006"
        500:
          $ref: '#/components/responses/internal_server_error'

    put:
      parameters:
        - $ref: '#/components/parameters/applicationJsonContent'
        - $ref: '#/components/parameters/luna_request_id'
      tags:
        - limitations
      summary: Create/replace limitation
      description: Create/replace limitation
      operationId: createLimitation
      requestBody:
        content:
          application/json:
            example:
              validation_schema:
                type: 'integer'
              default_value: 1
              description: 'new limitation'
              services:
                - 'luna-faces'
                - 'luna-image-store'
              group_names:
                - 'luna-platform'
            schema:
              $ref: '#/components/schemas/put_limitation'
      responses:
        201:
          description: Created
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Location:
              schema:
                type: string
              required: true
              description: Location header
              example: '/1/settings/limitations/some_limitation'
          content:
            application/json:
              example:
                setting_id: 304
              schema:
                $ref: '#/components/schemas/put_limitation_response'
        400:
          description: Bad Request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              examples:
                Failed to validate input json:
                  value:
                    error_code: 12022
                    desc: 'Bad/incomplete input data'
                    detail:
                      "Failed to validate input json. Path: '',
                      message: 'data must contain ['default_value', 'validation_schema', 'services']
                      properties"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022"
                Bad/incomplete input data":
                  value:
                    error_code: 12002
                    desc: 'Bad/incomplete input data'
                    detail: 'Request does not contain json'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022"
              schema:
                $ref: '#/components/schemas/Error'
        500:
          $ref: '#/components/responses/internal_server_error'

    patch:
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/applicationJsonContent'
      tags:
        - limitations
      summary: Patch existing limitation
      description: Patch existing limitation
      operationId: patchLimitation
      requestBody:
        content:
          application/json:
            example:
              validation_schema:
                type: integer
                enum:
                  - 0
                  - 1
              services:
               - luna-faces
              description: Use materialized views flag
              default_value: 0
            schema:
              $ref: '#/components/schemas/patch_limitation'
      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Location:
              schema:
                type: string
              required: true
              description: Location header
              example: '/1/settings/limitations/some_limitation'
          content:
            application/json:
              example:
                setting_id: 9
                unverified_setting_ids: []
              schema:
                $ref: '#/components/schemas/patch_limitation_response'
        400:
          description: Bad Request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              example:
                error_code: 12012
                desc: 'Bad/incomplete input data'
                detail: 'Request does not contain json'
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
              schema:
                $ref: '#/components/schemas/Error'
        404:
          description: Not found
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              example:
                error_code: 27006
                desc: 'Object not found'
                detail': "Limitation named 'some_limitation' not found"
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-27006"
              schema:
                $ref: '#/components/schemas/Error'
        500:
          $ref: '#/components/responses/internal_server_error'

    delete:
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
      tags:
        - limitations
      summary: Delete limitation
      description: Delete limitation with limitation_name
      operationId: deleteLimitation
      responses:
        204:
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          description: success delete limitation
        404:
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          description: Limitation not found
          content:
            application/json:
              example:
                error_code: 27006
                desc: 'Object not found'
                detail: "Limitation named 'LOG_TIME' not found"
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-27006"
              schema:
                $ref: '#/components/schemas/Error'
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/groups:
    get:
      tags:
        - groups
      parameters:
        - $ref: '#/components/parameters/limitation_names'
        - $ref: '#/components/parameters/group_names'
        - $ref: '#/components/parameters/luna_request_id'
      summary: Retrive list of groups
      description: Get groups list
      operationId: getGroups
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/groups_list'
              example:
                groups:
                  - group_name: 'databases'
                    description: 'some databases'
                  - group_name: 'loggers'
                    description: 'some loggers'
        500:
          $ref: '#/components/responses/internal_server_error'

    post:
      tags:
        - groups
      summary: Create new group
      description: Create new group
      operationId: newGroup
      parameters:
        - $ref: '#/components/parameters/applicationJsonContent'
        - $ref: '#/components/parameters/luna_request_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/post_group'
            example:
              group_name: 'group1'
              description: 'group1 description'
      responses:
        201:
          description: Created
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Location:
              schema:
                type: string
              required: true
              description: Location header
              example: '/1/groups/some_group'
          content:
            application/json:
              example:
                group_name: 'group1'
              schema:
                $ref: '#/components/schemas/groups_post_response'
        409:
          description: Conflict
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              example:
                error_code: 27010
                desc: "Integrity error"
                detail: "Group named 'group1' already exists"
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-27010"
              schema:
                $ref: '#/components/schemas/Error'
        400:
          description: Bad Request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              examples:
                Failed to validate input json:
                  value:
                    error_code: 12022
                    desc: 'Bad incomplete input data'
                    detail:
                          "Failed to validate input json.
                           Path: 'group_name',  message: 'data must contain ['group_name'] properties"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022"
                Bad/incomplete input data:
                  value:
                    error_code: 12002
                    desc: 'Bad/incomplete input data'
                    detail: 'Request does not contain json'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022"
                Description must be shorter:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: "Failed to validate input json. Path: 'description',
                            message: 'description must be shorter than or equal to 256 characters"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022"
              schema:
                $ref: '#/components/schemas/Error'
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/groups/{group_id}:
    parameters:
      - $ref: '#/components/parameters/group_name'


    get:
      tags:
        - groups
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
      summary: Get group
      description: Get group by name
      operationId: getGroup
      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              example:
                group_name: 'luna-queue'
                description: 'default group'
              schema:
                 $ref: '#/components/schemas/group_with_description'
        404:
          description: Not found
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              example:
                error_code: 27008
                detail: "Group named 'databases' not found"
                desc: 'Object not found'
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-27008"
              schema:
                $ref: '#/components/schemas/Error'
        500:
          $ref: '#/components/responses/internal_server_error'

    patch:
      tags:
        - groups
      parameters:
        - $ref: '#/components/parameters/applicationJsonContent'
        - $ref: '#/components/parameters/luna_request_id'
      summary: Patch group
      description: Patch group by name
      operationId: patchGroup
      requestBody:
        content:
          application/json:
            example:
              description: 'group description'
            schema:
              $ref: '#/components/schemas/patch_group'
      responses:
        204:
          description: Success update group
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        400:
          description: Bad Request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              examples:
                Failed to validate input json:
                  value:
                    error_code: 12022
                    desc: 'Bad/incomplete input data'
                    detail:
                      "Failed to validate input json. Path: '',
                      message: 'data must contain ['description']
                      properties"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022"
                Bad/incomplete input data:
                  value:
                    error_code: 12002
                    desc: 'Bad/incomplete input data'
                    detail: 'Request does not contain json'
              schema:
                $ref: '#/components/schemas/Error'
        404:
          description: Not found
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              examples:
                Object not found:
                  value:
                    error_code: 27008
                    detail: "Group named 'queues' not found"
                    desc: 'Object not found'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-27008"
                Bad/incomplete input data:
                  value:
                    error_code: 12002
                    desc: 'Bad/incomplete input data'
                    detail: 'Request does not contain json'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12002"
              schema:
                $ref: '#/components/schemas/Error'
        500:
          $ref: '#/components/responses/internal_server_error'

    delete:
      tags:
        - groups
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
      summary: Delete group
      description: Delete group by ID
      operationId: deleteGroup
      responses:
        204:
          description: Success delete group
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        404:
          description: Not found
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              example:
                error_code: 27008
                detail: "Group named 'queues' not found"
                desc: 'Object not found'
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-27008"
              schema:
                $ref: '#/components/schemas/Error'
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/groups_linker:
    patch:
      tags:
        - groups linker
      summary: Link or unlink groups
      description: Link or unlink group(s) to(from) limitation(s)
      operationId: linkGroups
      parameters:
        - $ref: '#/components/parameters/applicationJsonContent'
        - $ref: '#/components/parameters/luna_request_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/groups_linker'
            example:
              group_names:
                - 'databases'
                - 'loggers'
              limitation_names:
                - 'LOGGER'
                - 'FACES_DB'
              action: 'attach'
      responses:
        204:
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          description: 'success link(unlink) limitation(s) to(from) group(s)'
        400:
          description: Bad Request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              examples:
                Limitation named not found:
                  value:
                    error_code: 27006
                    desc: 'Object not found'
                    detail: "Limitation named 'LOG_TME' not found"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-27006"
                One or more groups not found:
                  value:
                    error_code: 27009
                    desc: "Object not found"
                    detail: "One or more groups not found, including group named 'luna-platform1'"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-27009"
                Bad/incomplete input data:
                  value:
                    error_code: 12002
                    desc: 'Bad/incomplete input data'
                    detail: 'Request does not contain json'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12002"
                limitation_names must contain at least 1 items:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: "Failed to validate input json. Path: 'limitation_names',
                            message: 'limitation_names must contain at least 1 items"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12002"
              schema:
                $ref: '#/components/schemas/Error'
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/dump:
    get:
      tags:
        - dump
      summary: Get dump-file
      description: Get json file with all limitations and settings
      operationId: getDumpFile
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Content-Disposition:
              $ref: '#/components/headers/content_disposition'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/dump_file'
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/docs/spec:
    get:
      tags:
        - documents
      summary: get openapi documentation
      description: |
        Get service OpenApi documentation. If *Accept* request header is of type `application/x-yaml`,
        returns documentation in `yaml` format or returns `html` documentation, if *Accept-Type* is `text/html`
      operationId: getSpec

      parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/accept_docs_handler'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/docs_content_type'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/x-yaml:
              schema:
                type: string
                description: yaml format documentation
            text/html:
              schema:
                type: string
                description: html format documentation
        415:
          description: Unsupported Media Type
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                unsupported_media_type:
                  value:
                    error_code: 12024
                    detail: 'Bad/incomplete input data'
                    desc: "Unsupported media type"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12024"
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/docs/dev:
    get:
      tags:
        - documents
      summary: get development manual
      description: |
        Get sphinx documentation - *Development Manual*. After the request you will be redirected to the page `/docs/dev/index.html`
      operationId: getDevManual

      parameters:
        - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/text_html'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            text/html:
              schema:
                type: string
                description: html format documentation
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/config:
    get:
      tags:
        - config
      summary: get service configuration
      description: Get service configuration. Passwords and tokens will be hidden in the response.
      operationId: getConfig

      parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/accept_config_handler'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/config_accept_content_type'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                type: object
                description: json format configuration
              example:
                INFLUX_MONITORING:
                  SEND_DATA_FOR_MONITORING: 0
                  VERSION: 2
                  ORGANIZATION: ORGANIZATION_NAME
                  TOKEN: '********'
                  BUCKET: luna_monitoring
                  HOST: 127.0.0.1
                  PORT: 8086
                  USE_SSL: 0
                  FLUSHING_PERIOD: 1.0
            text/plain:
              schema:
                type: string
                description: text format configuration
              example: |
                [INFLUX_MONITORING]
                SEND_DATA_FOR_MONITORING = 0
                VERSION = 2
                ORGANIZATION = ORGANIZATION_NAME
                TOKEN = ********
                BUCKET = luna_monitoring
                HOST = 127.0.0.1
                PORT = 8086
                USE_SSL = 0
                FLUSHING_PERIOD = 1.0
        415:
          description: Unsupported Media Type
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                unsupported_media_type:
                  value:
                    error_code: 12024
                    detail: 'Bad/incomplete input data'
                    desc: "Unsupported media type"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12024"
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/plugins:
    get:
      tags:
        - plugins
      summary: get list of plugins
      description: |
        Get list of service plugins
      operationId: getPlugins
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/plugins'
        500:
          $ref: '#/components/responses/internal_server_error'
  /metrics:

    get:
      tags:
        - metrics
      summary: get service requests statistics
      description: Get statistics of success and failed requests to the service in prometheus format.
      operationId: metrics
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK.
          headers:
            Content-Type:
              schema:
                type: string
                enum:
                  - text/plain; charset=UTF-8
              required: true
              description: Content type is `text/plain`.
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            text/plain:
              schema:
                type: string
                description: Prometheus plain text format.
              example: |
                # HELP request_count_total Counter of requests
                # TYPE request_count_total counter
                request_count_total{path="GET:/healthcheck",status_code="200"} 1.0
        403:
          $ref: '#/components/responses/forbidden_resource_error'
        500:
          $ref: '#/components/responses/internal_server_error'
  /healthcheck:
    get:
      tags:
      - health
      summary: get health
      description: get health of service
      operationId: healthcheck
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/health_ok'
        500:
          $ref: '#/components/responses/internal_server_error'
        502:
          description: Unhealthy
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/health_errors'
