---
openapi: 3.0.0
info:
  title: API for docker containers in taskmanager
  description: API for work with docker containers in taskmanager
  contact:
    email: zin@digtlab.ru
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: "1.1"
servers:
- url: https://virtserver.swaggerhub.com/IvanovAlex/taskmanager.kloud.one/1.1
  description: SwaggerHub API Auto Mocking
- url: https://virtserver.swaggerhub.com/ilya.zverev.1988/agenda/1.0.0
  description: SwaggerHub API Auto Mocking
- url: https://runner_sherpa.kloud.one
  description: SwaggerHub API Auto Mocking
tags:
- name: containers
  description: Work with docker containers
paths:
  /containers/create:
    post:
      tags:
      - containers
      summary: create container docker mars
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/containers_create_body'
      responses:
        "201":
          description: Container created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/inline_response_201'
        "400":
          description: Bad parameter
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/inline_response_400'
        "404":
          description: No such image
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/inline_response_404'
        "409":
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/inline_response_400'
        "500":
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/inline_response_400'
  /containers/m_{marsID}:
    delete:
      tags:
      - containers
      summary: delete container docker mars
      parameters:
      - name: marsID
        in: path
        required: true
        style: simple
        explode: false
        schema:
          type: string
      responses:
        "400":
          description: Bad parameter
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/inline_response_400'
        "404":
          description: No such container
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/inline_response_404_1'
        "500":
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/inline_response_400'
  /containers/m_{marsID}/stop:
    post:
      tags:
      - containers
      summary: stop container docker mars
      parameters:
      - name: marsID
        in: path
        required: true
        style: simple
        explode: false
        schema:
          type: string
      responses:
        "404":
          description: No such container
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/inline_response_404_1'
        "500":
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/inline_response_400'
  /containers/m_{marsID}/start:
    post:
      tags:
      - containers
      summary: start container docker mars
      parameters:
      - name: marsID
        in: path
        required: true
        style: simple
        explode: false
        schema:
          type: string
      responses:
        "404":
          description: No such container
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/inline_response_404_1'
        "500":
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/inline_response_400'
components:
  schemas:
    Config:
      type: object
      properties:
        webPort:
          type: number
          example: 8000
        audioCodec:
          type: string
          example: PCMA
        stunServer:
          type: string
          example: stun.sipnet.ru:3478
        dataStorageDays:
          type: number
          example: 100
        webhook:
          type: number
          example: 1
        bitrix24:
          $ref: '#/components/schemas/Config_bitrix24'
        repository:
          type: string
          example: https://raw.githubusercontent.com/komunikator/mars/master/package.json
        webAccounts:
          type: array
          items:
            $ref: '#/components/schemas/Config_webAccounts'
        trustedNet:
          $ref: '#/components/schemas/Config_trustedNet'
        maxCalls:
          type: number
          example: 10
        ringingTimeout:
          type: number
          example: 30
        serviceName:
          type: string
          example: MARS
        activeAccount:
          type: number
          example: 0
        def_tts:
          type: string
          example: yandex
        ivona_speech:
          $ref: '#/components/schemas/Config_ivona_speech'
        sipAccounts:
          type: object
        b24accounts:
          $ref: '#/components/schemas/Config_b24accounts'
        levels:
          $ref: '#/components/schemas/Config_levels'
        replaceConsole:
          type: string
          example: "false"
        appenders:
          type: array
          items:
            $ref: '#/components/schemas/Config_appenders'
        sipServer:
          type: string
          example: disable
        paymentService:
          $ref: '#/components/schemas/Config_paymentService'
        balance:
          type: string
          example: enable
        marsID:
          type: string
          example: 3c952fac-0997-4339-89a1-04e6facd51bd
        reloadTime:
          type: string
          example: 00:00
    containerscreate_HostConfig_LogConfig_Config:
      type: object
      properties:
        max-size:
          type: string
          example: 100m
        max-file:
          type: string
          example: "10"
        tag:
          type: string
          example: '{{.ImageName}}|{{.Name}}'
    containerscreate_HostConfig_LogConfig:
      type: object
      properties:
        Type:
          type: string
          example: json-file
        Config:
          $ref: '#/components/schemas/containerscreate_HostConfig_LogConfig_Config'
    containerscreate_HostConfig:
      type: object
      properties:
        LogConfig:
          $ref: '#/components/schemas/containerscreate_HostConfig_LogConfig'
    containers_create_body:
      type: object
      properties:
        image:
          type: string
          example: registry.digtlab.ru/kloud.one/kloud_one:test
        env:
          type: array
          example:
          - SPEECH_SOCKET=wss://speech.etcd.kloud.one/asrsocket.ws
          - YANDEX_TTS=https://speech.etcd.kloud.one/tts?
          - URI_API=https://apidb.etcd.kloud.one
          - URI_MONGODB=mongodb://example:example@0.0.0.0:0000/?replicaSet=rs0
          - NAME_DB=example
          - 'CONFIG={''webPort'': 8000,''audioCodec'': ''PCMA'',''stunServer'': ''stun.sipnet.ru:3478'',''dataStorageDays'': 100,''webhook'': 1,''bitrix24'':{''portal_link'': '''',''client_id'': '''',''client_secret'': '''',''grant_type'':'''',''redirect_uri'': ''''},''repository'': ''https://raw.githubusercontent.com/komunikator/mars/master/package.json'',''webAccounts'': [{''username'': ''admin'',''password'': ''admin''}],''trustedNet'': {''tokenURL'':''https://net.trusted.ru/idp/sso/oauth/token'',''profileURL'': ''https://net.trusted.ru/trustedapp/rest/person/profile/get'',''redirect_uri'': ''/auth/trusted'',''client_id'':''TRUSTED_LOGIN_CLIENT_ID'',''client_secret'': ''TRUSTED_LOGIN_CLIENT_SECRET''},''maxCalls'': 10,''ringingTimeout'': 30,''serviceName'': ''MARS'',''activeAccount'': 0,''def_tts'': ''yandex'',''ivona_speech'': {''accessKey'': '''',''secretKey'': '''',''language'': ''ru-RU'',''name'': ''Tatyana'',''gender'': ''Female''},''sipAccounts'': {},''b24accounts'': {''test1'': {''disable'': 1,''clientId'': ''APP_CLIENT_ID'',''clientSecret'': ''APP_CLIENT_SECRET'',''portalLink'': ''LINK_MY_PORTAL_BITRIX24'',''redirectUri'': ''MY_DOMAIN:PORT''}},''levels'': {''[all]'': ''trace'',''http'': ''error''},''replaceConsole'': false,''appenders'': [{''type'': ''console'',''category'': [''console, server, ua, call, task, error, http, rotation, sip_proxy'']}],''sipServer'': ''disable'',''paymentService'': {''authorizationUrl'': ''https://apidb.etcd.kloud.one/uth/login?login=example&password=example'',''getUserInfoUrl'': ''https://apidb.etcd.kloud.one/users?'',''getUserSecondsUrl'': ''https://speech.etcd.kloud.one/api/get-stat?key=''},''balance'': ''enable'',''marsID'': ''3c952fac-0997-4339-89a1-04e6facd51bd'',''reloadTime'': ''00:00''}'
          items:
            type: string
        HostConfig:
          $ref: '#/components/schemas/containerscreate_HostConfig'
        Binds:
          type: array
          items:
            type: string
            example: /etc/localtime:/etc/localtime:ro
        RestartPolicy:
          type: string
          example: '{"Name":"always"}'
    inline_response_201:
      type: object
      properties:
        Id:
          type: string
          description: Id
          example: e90e34656806
        Warnings:
          type: string
          description: Array of warnings
          example: '[]'
    inline_response_400:
      type: object
      properties:
        Message:
          type: string
          description: Message
          example: Something went wrong.
    inline_response_404:
      type: object
      properties:
        Message:
          type: string
          description: Message
          example: 'No such imagе: c2ada9df5af8'
    inline_response_404_1:
      type: object
      properties:
        Message:
          type: string
          description: Message
          example: 'No such container: c2ada9df5af8'
    Config_bitrix24:
      type: object
      properties:
        portal_link:
          type: string
          example: ""
        client_id:
          type: string
          example: ""
        client_secret:
          type: string
          example: ""
        grant_type:
          type: string
          example: ""
        redirect_uri:
          type: string
          example: ""
    Config_webAccounts:
      type: object
      properties:
        username:
          type: string
          example: admin
        password:
          type: string
          example: admin
    Config_trustedNet:
      type: object
      properties:
        tokenURL:
          type: string
          example: https://net.trusted.ru/idp/sso/oauth/token
        profileURL:
          type: string
          example: https://net.trusted.ru/trustedapp/rest/person/profile/get
        redirect_uri:
          type: string
          example: /auth/trusted
        client_id:
          type: string
          example: TRUSTED_LOGIN_CLIENT_ID
        client_secret:
          type: string
          example: TRUSTED_LOGIN_CLIENT_SECRET
    Config_ivona_speech:
      type: object
      properties:
        accessKey:
          type: string
          example: ""
        secretKey:
          type: string
          example: ""
        language:
          type: string
          example: ru-RU
        name:
          type: string
          example: Tatyana
        gender:
          type: string
          example: Female
    Config_b24accounts_test1:
      type: object
      properties:
        disable:
          type: number
          example: 1
        clientId:
          type: string
          example: APP_CLIENT_ID
        clientSecret:
          type: string
          example: APP_CLIENT_SECRET
        portalLink:
          type: string
          example: LINK_MY_PORTAL_BITRIX24
        redirectUri:
          type: string
          example: MY_DOMAIN:PORT
    Config_b24accounts:
      type: object
      properties:
        test1:
          $ref: '#/components/schemas/Config_b24accounts_test1'
    Config_levels:
      type: object
      properties:
        '[all]':
          type: string
          example: trace
        http:
          type: string
          example: error
    Config_appenders:
      type: object
      properties:
        type:
          type: string
          example: console
        category:
          type: array
          items:
            type: string
            example: console, server, ua, call, task, error, http, rotation, sip_proxy
    Config_paymentService:
      type: object
      properties:
        authorizationUrl:
          type: string
          example: https://apidb.etcd.kloud.one/auth/login?login=example&password=example
        getUserInfoUrl:
          type: string
          example: https://apidb.etcd.kloud.one/users?
        getUserSecondsUrl:
          type: string
          example: https://speech.etcd.kloud.one/api/get-stat?key=
