File manager service

The file manager service allows to remotely deploy/undeploy files to/from runtime directory. The service is always installed by default, however can be removed/undeployed for the security purposes without affecting anything but file deployment.

Setup

Use the template EVA_DIR/share/svc-tpl/svc-tpl-filemgr.yml:

# File manager service
command: svc/eva-filemgr
bus:
  path: var/bus.ipc
config:
  protected:
    - registry
    - svc_data
  mime_types: share/mime.yml
# the file manager service usually works under root, however may be restricted
# for higher security
user: eva

Create the service using eva-shell:

eva svc create eva.filemgr.main /opt/eva4/share/svc-tpl/svc-tpl-filemgr.yml

or using the bus CLI client:

cd /opt/eva4
cat DEPLOY.yml | ./bin/yml2mp | \
    ./sbin/bus ./var/bus.ipc rpc call eva.core svc.deploy -

(see eva.core::svc.deploy for more info)

EAPI methods

See EAPI commons for the common information about the bus, types, errors and RPC calls.

file.get

Description

Gets a file from runtime directory

Parameters

required

Returns

File info or info + content

Parameters

Name

Type

Description

Required

path

String

Relative file path

yes

mode

String

i/x/t/b (info, extended info, text, binary)

no

caller

String

m/h (machine/human)

no

Return payload example:

{
    "content_type": "application/x-yaml",
    "modified": 1648693508.311287,
    "path": "test.yml",
    "permissions": 33188,
    "size": 9
}

file.put

Description

Puts a file into runtime directory

Parameters

required

Returns

nothing

Parameters

Name

Type

Description

Required

path

String

Relative file path

yes

content

Vec<u8>/String

File content

yes

permissions

u32/String/bool

‘0o755’ for string, true/false for executable flag

no

sha256

Vec<u8><String>

Check sha256 sum of the content before saving

no

extract

String

Extract as: no|tar|txz|tgz|tbz2|zip

no

download

bool

Download content from HTTP URI, sent in the content field

no

list

Description

List files/directories in runtime directory

Parameters

required

Returns

nothing

Parameters

Name

Type

Description

Required

path

String

Relative path

no

masks

String/Vec<String>

file masks

no

kind

String

file, dir or any

no

recursive

bool

recursive listing

no

sh

Description

Executes a shell command

Parameters

required

Returns

Command execution info

Parameters

Name

Type

Description

Required

c

String

Command to execute

yes

timeout

f64

Max command timeout

no

stdin

String

STDIN data

no

Return payload example:

{
    "err": "STDERR OUTPUT",
    "exitcode": 0,
    "out": "STDOUT OUTPUT"
}