# Edge CLI User Manual

orege is a command line utility for OpenResty Edge.

# installation

  1. install

redhat, centos, fedora.

yum install -y openresty-edge-cli

ubuntu, debian.

apt install -y openresty-edge-cli

command oredge will install to path /usr/local/oredge-admin/bin

  1. set path

please set PATH envrioment in ~/.bash_profile.

export PATH=/usr/local/oredge-admin/bin:$PATH
  1. add config to ~/.oredge/config.
mkdir ~/.oredge

cat << EOF > ~/.oredge/config
[admin]
host=admin-dev.openresty.com
port=443
verify_ssl=true
api_token=xxxxxxxxxxxxxxxxxxxxxx
EOF
  1. try cli
oredge --help

# config

The default config file is ~/.oredge/config.

[admin]
host=admin-dev.openresty.com
port=443
verify_ssl=true
api_token=xxxxxxxxxxxxxxxxxxxxxx

# usage

  1. oredge help, will print the usage of the command.
# oredge help
Usage: oredge RESOURCE ACTION [OPTIONS]

RESOURCE:
    app
    cache
    http-proxy
    sock5-proxy
    upstream
    rule
    k8s
    gateway
    dns
    rule
    dns-record
    cert
    http-proxy-auth
    txlog
    test
    help

ACTION:
    list                               list resource.
    show                               show resource detail.
    create                             create resource.
    delete                             delete resource.
    modify                             modify resource.
    purge(for cache purge only)
    help

GLOBAL OPTIONS:
    --help
    --show-api                         print restful api request.
    --config                           specify config file, default is ~/.oredge/config.
  1. print help in RESOURCE context.
# oredge app help
Usage: oredge app ACTION [OPTIONS]

ACTION:
    list
    show
    create
    modify
    delete
    help

GLOBAL OPTIONS:
    --help
    --show-api                         print restful api request.
    --config                           specify config file, default is ~/.oredge/config.

  1. print help in RESOURCE ACTION context.
#oredge app list help
Usage: oredge app list [OPTIONS]

OPTIONS:
    --type string                      http(default) or stream.
    --page integer                     1(default).
    --page-size integer                20(default).

GLOBAL OPTIONS:
    --help
    --show-api                         print restful api request.
    --config                           specify config file, default is ~/.oredge/config.
  1. use --config to specify the config file other than ~/.oredge/config.
# oredge app list --config=./config
ID     TYPE    DOMAINS                    PARTITIONS    LABEL               MODIFY TIME            CREATE TIME
788    http    test-3.com                 1                                 2021-05-06 20:52:01    2021-04-25 07:21:36
786    http    edge-test.com              1                                 2021-04-25 07:31:28    2021-04-22 09:35:05
785    http    test-delete-app.com        1                                 2021-04-21 06:31:16    2021-04-21 06:31:16
782    http    test-split.com             1                                 2021-04-12 02:25:29    2021-04-12 02:25:29
781    http    demo-test.com              1                                 2021-04-10 21:44:38    2021-04-10 21:44:13
780    http    new-app-test.com           1             Test add new app    2021-05-06 20:43:42    2021-04-09 05:00:58

  1. use --show-api to print restful api request the command line use.

# oredge app list --type=stream --page=2 --page-size=10 --show-api
> GET /admin-api/applications?page_size=10&force=true&detail=1&type=stream&start_time=0&partition_id=&page=2&end_time=0 HTTP/1.1
> Host: admin-dev.openresty.com
> User-Agent: libwww-perl/6.53
> Content-Length: 0
> API-token: ***
>

ID    TYPE    DOMAINS       PARTITIONS    LABEL    MODIFY TIME            CREATE TIME
25    tcp                   1                      2021-02-25 21:32:17    2021-02-25 21:32:17
24    tls     Rxyngv.com    1                      2021-02-25 21:31:50    2021-02-25 21:31:50
23    tcp                   1                      2021-02-24 02:43:37    2021-02-24 02:43:14
18    tcp                   1                      2020-11-02 02:18:03    2020-11-02 02:18:03
17    tls     a.test.com    1                      2020-10-14 22:42:33    2020-10-14 22:42:33
16    tcp                   1                      2020-09-16 12:33:14    2020-09-16 12:33:14
11    tls     test01.com    1                      2020-09-10 06:13:38    2020-09-10 06:13:38
2     tls     BKAkoK.com    1                      2020-09-01 07:15:19    2020-09-01 07:15:19
1     tls     c.com         1                      2021-03-22 02:12:53    2020-07-12 23:51:15