typesafehub / sbt-conductr

Typesafe ConductR plugin for sbt
Other
29 stars 22 forks source link

Expose `conduct acls` command from the CLI #136

Closed fsat closed 8 years ago

fsat commented 8 years ago

Manual test done successfully:

BundleKeys.endpoints := Map(
  "ptest" -> Endpoint("http", 0, "path-tester",
    RequestAcl(
      Http(
        "^/bacon".r -> "/burger",
        "^/tree".r,
        "^/fee/(.*)/fi/(.*)/fo/(.*)/fum$".r -> "/boom/\\1-\\2-\\3/box",
        "^/boom/(.*)/box$".r,
        "/foo" -> "/baz",
        "/baz"
      )
    )
  ),
  "ptunnel" -> Endpoint("tcp", 0, "ptunnel",
    RequestAcl(
      Tcp(
        12101, 3303, 5601
      )
    )
  )
)
Felixs-MBP:sbt-conductr-tester felixsatyaputra$ sbt
[info] Loading project definition from /Users/felixsatyaputra/workspace/sandbox/sbt-conductr-tester/project
[info] Set current project to sbt-conductr-tester (in build file:/Users/felixsatyaputra/workspace/sandbox/sbt-conductr-tester/)
> conduct acls
usage: conduct acls [-h] [-i IP] [-p PORT] [-v] [-q] [--long-ids]
                    [--api-version {1,2}] [--settings-dir CLI_SETTINGS_DIR]
                    [--custom-settings-file CUSTOM_SETTINGS_FILE]
                    [--custom-plugins-dir CUSTOM_PLUGINS_DIR]
                    {http,tcp}

positional arguments:
  {http,tcp}            The protocol family of the ACL to be displayed, either
                        http or tcp

optional arguments:
  -h, --help            show this help message and exit
  -i IP, --ip IP        The optional ConductR IP, defaults to one of the value
                        in this order:$CONDUCTR_IP orIP address of the docker
                        VM or`127.0.0.1`
  -p PORT, --port PORT  The optional ConductR port, defaults to $CONDUCTR_PORT
                        or `9005`
  -v, --verbose         Print JSON response to the command
  -q                    Prints affected bundle id on screen if enabled
  --long-ids            Print long Bundle IDs
  --api-version {1,2}   Sets which ConductR api version to be used
  --settings-dir CLI_SETTINGS_DIR
                        Directory where ConductR CLI settings are stored,
                        defaults to /Users/felixsatyaputra/.conductr
  --custom-settings-file CUSTOM_SETTINGS_FILE
                        Configuration where custom settings for ConductR CLI
                        are stored in HOCON format,defaults to
                        /Users/felixsatyaputra/.conductr/settings.conf
  --custom-plugins-dir CUSTOM_PLUGINS_DIR
                        Directory where custom plugins for ConductR CLI are
                        stored, defaults to
                        /Users/felixsatyaputra/.conductr/plugins
[success] Total time: 0 s, completed 31/03/2016 10:49:47 AM

> conduct acls tcp
TCP/PORT  BUNDLE ID  BUNDLE NAME             STATUS
3303      bd41633    path-tester             Running
5601      bd41633    path-tester             Running
9300      d687c32    conductr-elasticsearch  Running
12101     bd41633    path-tester             Running
[success] Total time: 1 s, completed 31/03/2016 10:52:50 AM

> conduct acls http
METHOD  PATH                             REWRITE             BUNDLE ID  BUNDLE NAME             STATUS
*       ^/fee/(.*)/fi/(.*)/fo/(.*)/fum$  /boom/\1-\2-\3/box  bd41633    path-tester             Running
*       ^/boom/(.*)/box$                                     bd41633    path-tester             Running
*       ^/elastic-search                 /                   d687c32    conductr-elasticsearch  Running
*       ^/                                                   468e4dd    conductr-kibana         Running
*       ^/bacon                          /burger             bd41633    path-tester             Running
*       ^/tree                                               bd41633    path-tester             Running
*       ^/                                                   a6ae382    visualizer              Running
*       /foo                             /baz                bd41633    path-tester             Running
*       /baz                                                 bd41633    path-tester             Running
[success] Total time: 1 s, completed 31/03/2016 10:52:55 AM
huntc commented 8 years ago

LGTM