14. Спецификация модуля «BLOB-адаптер»

openapi: 3.0.3
info:
  version: '1.0'
  title: blob-adapter
  description: Предназначен для выполнения запросов BLOB по ссылке
tags:
  - name: blob
      description: Запрос BLOB по ссылке

servers:
  - url: 'http://127.0.0.1:8189'

paths:
  /attachment/{link}:
      get:
      summary: Получение BLOB по ссылке
      description: Синхронное получение blob-объекта
      deprecated: false
      operationId: blobRequest
      tags:
          - blob
      parameters:
          - name: requestId
          in: header
          description: Идентификатор запроса, полученный от Агента Потребителя
          required: true
          schema:
              type: string
              format: uuid
          example: '2e8c8ab2-44db-4dcb-8ae5-2365121b4e14'
          - name: queryRequestId
          in: header
          description: Идентификатор исходного запроса, в рамках которого была получена ссылка на blob
          required: false
          schema:
              type: string
          example: '11118ab2-44db-4dcb-8ae5-2365121b1111'
          - name: Request-Timeout
          in: header
          description: 'Таймаут запроса, в секундах'
          required: false
          schema:
              type: integer
          example: 5
          - name: link
          in: path
          description: 'ссылка на blob'
          required: true
          schema:
              type: string
          example: 'internal.example.com:8080/datamart/data/v1/blobs/'
      responses:
          '200':
          description: Содержимое blob
          content:
              application/octet-stream:
              schema:
                  type: object
          headers:
              requestId:
              $ref: '#/components/headers/requestId'
              queryRequestId:
              $ref: '#/components/headers/queryRequestId'
              content-type:
              schema:
                  type: string
              example: text/plain; charset=utf-8
              content-disposition:
              schema:
                  type: string
              example: attachment; filename="list.txt"
          '400':
          description: Bad Request Ошибка парсинга сообщения
          content:
              application/json; charset=utf-8:
              schema:
                  $ref: '#/components/schemas/CommonValidationErrorResponse'
          headers:
              requestId:
              $ref: '#/components/headers/requestId'
              queryRequestId:
              $ref: '#/components/headers/queryRequestId'
          '408':
          description: Request Timeout Ошибка таймаута
          content:
              application/json; charset=utf-8:
              schema:
                  $ref: '#/components/schemas/CommonTimeoutErrorResponse'
          headers:
              requestId:
              $ref: '#/components/headers/requestId'
              queryRequestId:
              $ref: '#/components/headers/queryRequestId'

          '500':
          description: Internal Server Error Внутренняя ошибка
          content:
              application/json; charset=utf-8:
              schema:
                  $ref: '#/components/schemas/CommonInternalErrorResponse'
          headers:
              requestId:
              $ref: '#/components/headers/requestId'
              queryRequestId:
              $ref: '#/components/headers/queryRequestId'


      delete:
      summary: Удаление BLOB по ссылке
      description: Синхронное удаление blob-объекта
      operationId: blobDelete
      tags:
          - blob
      parameters:
          - name: requestId
          in: header
          description: Идентификатор запроса
          required: true
          schema:
              type: string
              format: uuid
          example: '2e8c8ab2-44db-4dcb-8ae5-2365121b4e14'
          - name: Request-Timeout
          in: header
          description: 'Таймаут запроса, в секундах'
          required: false
          schema:
              type: integer
          example: 5
          - name: link
          in: path
          required: true
          description: ссылка на blob
          schema:
              type: string
      responses:
          '200':
          description: Удаление данных выполнено успешно
          headers:
              requestId:
              $ref: '#/components/headers/requestId'
          '400':
          description: Bad Request Ошибка парсинга сообщения
          content:
              application/json; charset=utf-8:
              schema:
                  $ref: '#/components/schemas/CommonValidationErrorResponse'
          headers:
              requestId:
              $ref: '#/components/headers/requestId'
              queryRequestId:
              $ref: '#/components/headers/queryRequestId'
          '408':
          description: Request Timeout Ошибка таймаута
          content:
              application/json; charset=utf-8:
              schema:
                  $ref: '#/components/schemas/CommonTimeoutErrorResponse'
          headers:
              requestId:
              $ref: '#/components/headers/requestId'
              queryRequestId:
              $ref: '#/components/headers/queryRequestId'
          '500':
          description: Internal Server Error Внутренняя ошибка
          content:
              application/json; charset=utf-8:
              schema:
                  $ref: '#/components/schemas/CommonInternalErrorResponse'
          headers:
              requestId:
              $ref: '#/components/headers/requestId'
              queryRequestId:
              $ref: '#/components/headers/queryRequestId'
  /attachment:
      post:
      summary: Запись BLOB по ссылке
      description: Синхронная запись blob-объекта
      operationId: blobSave
      tags:
          - blob
      parameters:
          - name: requestId
          in: header
          description: Идентификатор запроса
          required: true
          schema:
              type: string
              format: uuid
          example: '2e8c8ab2-44db-4dcb-8ae5-2365121b4e14'
          - name: Request-Timeout
          in: header
          description: 'Таймаут запроса, в секундах'
          required: false
          schema:
              type: integer
          example: 5
          - name: content-type
          in: header
          required: false
          schema:
              type: string
          example: text/plain; charset=utf-8
          - name: content-disposition
          in: header
          required: false
          schema:
              type: string
          example: attachment; filename="list.txt"
      requestBody:
          required: true
          content:
          multipart/form-data:
              schema:
              type: object
              required: [ upload, name ]
              properties:
                  data:
                  type: string
                  description: Бинарные данные
                  format: binary
                  link:
                  type: string
                  description: Ссылка на blob
      responses:
          '200':
          description: Загрузка данных выполнена успешно
          headers:
              requestId:
              $ref: '#/components/headers/requestId'
          '400':
          description: Bad Request Ошибка парсинга сообщения
          content:
              application/json; charset=utf-8:
              schema:
                  $ref: '#/components/schemas/CommonValidationErrorResponse'
          headers:
              requestId:
              $ref: '#/components/headers/requestId'
              queryRequestId:
              $ref: '#/components/headers/queryRequestId'
          '408':
          description: Request Timeout Ошибка таймаута
          content:
              application/json; charset=utf-8:
              schema:
                  $ref: '#/components/schemas/CommonTimeoutErrorResponse'
          headers:
              requestId:
              $ref: '#/components/headers/requestId'
              queryRequestId:
              $ref: '#/components/headers/queryRequestId'

          '500':
          description: Internal Server Error Внутренняя ошибка
          content:
              application/json; charset=utf-8:
              schema:
                  $ref: '#/components/schemas/CommonInternalErrorResponse'
          headers:
              requestId:
              $ref: '#/components/headers/requestId'
              queryRequestId:
              $ref: '#/components/headers/queryRequestId'
  /download:
      post:
      summary: Получение BLOB по ссылке
      description: Синхронное получение blob-объекта (deprecated)
      deprecated: true
      operationId: blobRequestDeprecated
      tags:
          - blob
      parameters:
          - name: requestId
          in: header
          description: Идентификатор запроса, полученный от Агента Потребителя
          required: true
          schema:
              type: string
              format: uuid
          example: '2e8c8ab2-44db-4dcb-8ae5-2365121b4e14'
          - name: queryRequestId
          in: header
          description: Идентификатор исходного запроса, в рамках которого была получена ссылка на blob
          required: false
          schema:
              type: string
          example: '11118ab2-44db-4dcb-8ae5-2365121b1111'
          - name: Request-Timeout
          in: header
          description: 'Таймаут запроса, в секундах'
          required: false
          schema:
              type: integer
          example: 5
      requestBody:
          required: true
          content:
          application/json:
              schema:
              type: object
              description: Ссылка на blob
              properties:
                  link:
                  type: string
                  example: 'internal.example.com:8080/datamart/data/v1/blobs/'
      responses:
          '200':
          description: Содержимое blob
          content:
              application/octet-stream:
              schema:
                  type: object
          headers:
              requestId:
              $ref: '#/components/headers/requestId'
              queryRequestId:
              $ref: '#/components/headers/queryRequestId'
              content-type:
              schema:
                  type: string
              example: text/plain; charset=utf-8
              content-disposition:
              schema:
                  type: string
              example: attachment; filename="list.txt"
          '400':
          description: Bad Request Ошибка парсинга сообщения
          content:
              application/json; charset=utf-8:
              schema:
                  $ref: '#/components/schemas/CommonValidationErrorResponse'
          headers:
              requestId:
              $ref: '#/components/headers/requestId'
              queryRequestId:
              $ref: '#/components/headers/queryRequestId'
          '408':
          description: Request Timeout Ошибка таймаута
          content:
              application/json; charset=utf-8:
              schema:
                  $ref: '#/components/schemas/CommonTimeoutErrorResponse'
          headers:
              requestId:
              $ref: '#/components/headers/requestId'
              queryRequestId:
              $ref: '#/components/headers/queryRequestId'

          '500':
          description: Internal Server Error Внутренняя ошибка
          content:
              application/json; charset=utf-8:
              schema:
                  $ref: '#/components/schemas/CommonInternalErrorResponse'
          headers:
              requestId:
              $ref: '#/components/headers/requestId'
              queryRequestId:
              $ref: '#/components/headers/queryRequestId'
  /uploadAttachment:
      post:
      summary: Запись BLOB по ссылке
      description: Синхронная запись blob-объекта (deprecated from dtm-uploader)
      deprecated: true
      operationId: blobSaveDep
      tags:
          - blob
      requestBody:
          required: true
          content:
          multipart/form-data:
              schema:
              type: object
              required: [upload, name,requestId]
              properties:
                  upload:
                  type: string
                  description: Бинарные данные
                  format: binary
                  name:
                  type: string
                  description: Ссылка на blob
                  requestId:
                  type: string
                  description: Идентификатор запроса
      responses:
          '200':
          description: Ответ
          content:
              application/json:
              schema:
                  $ref: '#/components/schemas/dtmUploaderResponseUpload'
  /deleteAttachment/{name}/requestId/{requestId}:
      delete:
      summary: Удаление BLOB по ссылке
      description: Синхронное удаление blob-объекта (deprecated from dtm-uploader)
      deprecated: true
      operationId: blobDeleteDep
      tags:
          - blob
      parameters:
          - name: requestId
          in: path
          description: Идентификатор запроса
          required: true
          schema:
              type: string
              format: uuid
          example: '2e8c8ab2-44db-4dcb-8ae5-2365121b4e14'
          - name: name
          in: path
          description: Имя удаляемого файла
          required: true
          schema:
              type: string
          example: 'photo.jpg'
      responses:
          '200':
          description: Ответ
          content:
              application/json:
              schema:
                  $ref: '#/components/schemas/dtmUploaderResponseUpload'
components:
  headers:
      requestId:
      description: Идентификатор запроса, полученный от Агента Потребителя
      required: true
      schema:
          type: string
          format: uuid
      example: '2e8c8ab2-44db-4dcb-8ae5-2365121b4e14'
      queryRequestId:
      description: Идентификатор исходного запроса, в рамках которого была получена ссылка на blob
      required: false
      schema:
          type: string
      example: '11118ab2-44db-4dcb-8ae5-2365121b1111'
  schemas:
      dtmUploaderResponseUpload:
      type: object
      required: [requestId,statusCode,statusMessage]
      properties:
          requestId:
          type: string
          statusCode:
          type: string
          statusMessage:
          type: string
      CommonInternalErrorResponse:
      type: object
      required:
          - error
      properties:
          error:
          description: Объект, содержащий информацию об ошибке
          type: object
          required:
              - code
              - message
          properties:
              code:
              description: Код ошибки
              type: string
              enum:
                  - Internal Server Error
              message:
              description: Сообщение об ошибке
              type: string
      example:
          error:
          code: Internal Server Error
          message: 'Ошибка выгрузки BLOB: The specified key does not exist. (Service: Amazon S3; Status Code: 404; Error Code: NoSuchKey; Request ID: 1825037AB1C5E969; S3 Extended Request ID: 3b051705-fed5-4804-bcbd-32266485a803; Proxy: null)'

      CommonValidationErrorResponse:
      type: object
      required:
          - error
      properties:
          error:
          description: Объект, содержащий информацию об ошибке
          type: object
          required:
              - code
              - message
          properties:
              code:
              description: Код ошибки
              type: string
              enum:
                  - Bad Request
              message:
              description: Сообщение об ошибке
              type: string
      example:
          error:
          code: Bad Request
          message: "Отсутствует обязательный заголовок 'requestId'"
      CommonTimeoutErrorResponse:
      type: object
      required:
          - error
      properties:
          error:
          description: Объект, содержащий информацию об ошибке
          type: object
          required:
              - code
              - message
          properties:
              code:
              description: Код ошибки
              type: string
              enum:
                  - Request Timeout
              message:
              description: Сообщение об ошибке
              type: string