get:
  tags:
    - Commands
  summary: Return a short info about all client commands
  operationId: ClientCommandsGet
  description: >-
    Return a list of all running and finished commands sorted by finished time
    in desc order with running commands at the beginning
  parameters:
    - name: client_id
      in: path
      description: unique client id retrieved previously
      required: true
      schema:
        type: string
    - name: sort
      in: query
      description: >-
        Sort field to be used for sorting, the default sorting is by finished
        time in desc order.
         To change the direction add `-` to the sorting value e.g. `-started_at`. Allowed values are `jid`, `started_at`, `finished_at`, `status`, `multi_job_id`, `created_by`, `schedule_id`.
         You can use as many sort parameters as you want.
      schema:
        type: string
    - name: filter[<FIELD>]
      in: query
      description: >-
        Filter option `filter[<field>]` or `filter[started_at][<op>]`. `<field>`
        can be one of `jid`, `created_by`, `started_at`, `finished_at`,
        `status`, `multi_job_id`, `schedule_id`  and `<value>` is the search
        value,
         e.g. `filter[created_by]=admin` will request only commands created by admin. You can use as many filter parameters as you want.
         Wildcards `*` are supported in the filter `<value>`.
         For `started_at` and `finished_at` filters you need to specify operation: `gt`, `lt`, `since` or `until`.
         If you want to filter by multiple values e.g. find entries either for created_by = admin or other you can use following filters
         `filter[created_by]=admin,other`.
      schema:
        type: string
    - name: page
      in: query
      description: >-
        Pagination options `page[limit]` and `page[offset]` can be used to get
        more than the first page of results. Default limit is 100 and maximum is
        1000. The `count` property in meta shows the total number of results.
      schema:
        type: integer
    - name: fields[<RESOURCE>]
      in: query
      description: >-
        Fields to be returned. It should be provided in the format as
        `fields[<RESOURCE>]=<FIELDS>`, where `<RESOURCE>` is `commands` or
        `result` and `<FIELDS>` is a comma separated list of fields. Default is:
        `fields[commands]=jid,status,finished_at&fields[result]=summary`.
      schema:
        type: string
  responses:
    '200':
      description: Successful Operation
      content:
        application/json:
          schema:
            type: object
            properties:
              data:
                type: array
                items:
                  $ref: ../components/schemas/JobSummary.yaml
              meta:
                type: object
                properties:
                  count:
                    type: integer
    '400':
      description: Invalid request parameters
      content:
        application/json:
          schema:
            $ref: ../components/schemas/ErrorPayload.yaml
    '500':
      description: Invalid Operation
      content:
        application/json:
          schema:
            $ref: ../components/schemas/ErrorPayload.yaml
post:
  tags:
    - Commands
  summary: Execute a command by the rport client
  operationId: ClientCommandsPost
  description: >-
    NOTE: if command limitation is enabled by an rport client then a full path
    command can be required to use. See
    https://oss.rport.io/docs/no06-command-execution.html for more details
  parameters:
    - name: client_id
      in: path
      description: unique client id retrieved previously
      required: true
      schema:
        type: string
  requestBody:
    description: remote command to execute by the rport client
    content:
      '*/*':
        schema:
          type: object
          properties:
            command:
              type: string
              description: >-
                remote command to execute by the rport client. NOTE: if command
                limitation is enabled by an rport client then a full path
                command can be required to use. See
                https://oss.rport.io/docs/no06-command-execution.html for more
                details
            interpreter:
              type: string
              description: >-
                command interpreter to use to execute the command. If not set
                'cmd' is used by default on Windows and /bin/sh on Linux
              enum:
                - cmd
                - powershell
                - tacoscript
            cwd:
              type: string
              description: current working directory for the executable command
            is_sudo:
              type: boolean
              description: execute a command as sudo user
            timeout_sec:
              type: integer
              description: >-
                timeout in seconds to observe the command execution. If not set
                a default timeout (60 seconds) is used
    required: true
  responses:
    '200':
      description: Successful Operation
      content:
        application/json:
          schema:
            type: object
            properties:
              data:
                type: object
                properties:
                  jid:
                    type: string
                    description: job id of the corresponding command
    '400':
      description: Invalid request parameters
      content:
        application/json:
          schema:
            $ref: ../components/schemas/ErrorPayload.yaml
    '404':
      description: Active client not found
      content:
        application/json:
          schema:
            $ref: ../components/schemas/ErrorPayload.yaml
    '409':
      description: >-
        Could not execute the command. Probably a previous command is still
        running
      content:
        application/json:
          schema:
            $ref: ../components/schemas/ErrorPayload.yaml
    '500':
      description: Invalid Operation
      content:
        application/json:
          schema:
            $ref: ../components/schemas/ErrorPayload.yaml
  x-codegen-request-body-name: body
