vkuznet / transfer2go

Distributed, loosely couple agent-based transferring system
MIT License
8 stars 2 forks source link

Add CLI interface to view, approve, delete requests in main agent #50

Closed vkuznet closed 7 years ago

vkuznet commented 7 years ago

We need both CLI and web interfaces to approve or delete requests in main agent. The initial web UI exists, now we need CLI counterpart. It should do the following:

# view request waiting approval
transfer2go -agent=main-agent -requests
should provide list of request and their state, e.g.
Request: Id, Source: src, Destination: dst, Data: /a/b/c, Status: pending
Request: Id, Source: src, Destination: dst, Data: /a/b/c, Status: in-transfer

Then, we need to have ability to approve certain request

transfer2go -agent=main-agent -requestID=id -action=approve
vkuznet commented 7 years ago

Admins should be able to change priority of the request. And, we may have other actions. Therefore to avoid growth of option I think it should be better to use JSON doc for such manipulation, e.g.

transfer2go -agent=main-agent -action=JSON

where JSON would represent action request, e.g.

{"requestID": id, "action": "approve"}
{"requestID": id, "priority":2}

And, add -format option to return data either in plain tabular ASCII format or json.

vkuznet commented 7 years ago

The first version of the code already exists, see https://github.com/vkuznet/transfer2go/blob/master/client/client.go#L374

But it would be nice to generalize it according to description in this issue.

vkuznet commented 7 years ago

The -requests option is implement in CLI (3dbfe37). It can be done as following:

transfer2go -agent=main-agent -requests=pending
INFO[0000] <TransferRequest id=1505312493 priority=0 status= ts=0 file=file.root block= dataset= srcUrl=http://localhost:8000 srcAlias=sourceAgent dstUrl=http://localhost:9000 dstAlias=destinationAgent delay=0>
vkuznet commented 7 years ago

Final piece was added into this commit: 42529bb Now users can do

transfer2go -agent=main-agent -action='{"id":1505312493, "action":"approve"}'