feedhenry / fh-fhc

FeedHenry CLI, the Command Line Interface to FeedHenry
Other
26 stars 66 forks source link

RHMAP-21897: Add create connections command #461

Closed camilamacedo86 closed 5 years ago

camilamacedo86 commented 6 years ago

Jira link(s)

https://issues.jboss.org/browse/RHMAP-21897

What

Add command to create connections

Why

In order to be helpful when the BF be deprecated

How

New command to use the same REST API used by RHMAP studio

Verification Steps

Check if the new command will be listed.

$ ./bin/fhc.js connections
No action specified. Usage: 
fhc connections <action>
Where <action> is one of:
  create                Create connections
  list                  List connections
  read                  Read a connection
  update                Update connections

Check the required options validation and descriptions.

./bin/fhc.js connections create
Usage:
 fhc connections create --client=<client> --cloud=<cloud> --type=<type>
 --env=<env> --project=<project> [--connection=<connection>] [--json=<json>]

Options:
  --help            Show help                                          [boolean]
  --version         Show version number                                [boolean]
  --client, --cli   Unique 24 character GUID of the project           [required]
  --cloud, --clo    Unique 24 character GUID of the connection        [required]
  --type, -t        "Client app type : [android, ios, html5]"       [required]
  --env, -e         Unique 24 character GUID of the cloud application [required]
  --project, -p     Unique 24 character GUID of the cloud application [required]
  --connection, -c  Connection Tags must be in Semantic Version format, e.g.
                    0.0.1. See: http://semver.org
  --json, -j        Output in json format

Examples:
  fhc connections create --client=<client>  Create the <connection> for the
  --cloud=<cloud> --type=<type>             <client> with the <type> and the
  --env=<env> --project=<project>           <cloud> from the <project> deployed
  --connection=<connection>                 on the <env>
  fhc connections create --client=<client>  Create a a new sequencially
  --cloud=<cloud> --type=<type>             connection for the <client> with the
  --env=<env> --project=<project>           <type> and the <cloud> from the
                                            <project> deployed on the <env>

Missing required arguments: client, cloud, type, env, project
fhc ERR! YError: Missing required arguments: client, cloud, type, env, project
fhc ERR! 
fhc ERR! System Darwin 18.0.0
fhc ERR! command "/Users/camilamacedo/.nvm/versions/node/v6.14.4/bin/node" "/Users/camilamacedo/work/fh-fhc/bin/fhc.js" "connections" "create"
fhc Command executed with error

Create a new connection for Cordova without inform the value

E.g ./bin/fhc.js connections create --cloud=gf5i6x74opqkycntbiykivei --client=gf5i6x6k7ypbzrnol6ynvvqz --env=dev --type=html5 --project=gf5i6xy4lgnwuyzlpedrz7t2

screenshot 2018-11-12 at 10 35 22

Create a new connection for Cordova by informing a tag

E.g ./bin/fhc.js connections create --cloud=gf5i6x74opqkycntbiykivei --client=gf5i6x6k7ypbzrnol6ynvvqz --env=dev --type=html5 --project=gf5i6xy4lgnwuyzlpedrz7t2 --connection=1.0.0

screenshot 2018-11-12 at 10 38 26

Use the --json parameter to check the result in this format.

{
  "cloudAppName": null,
  "clientAppName": null,
  "environment": "dev",
  "tag": "1.0.2",
  "domain": "testing",
  "destination": "html5",
  "status": "ACTIVE",
  "statusText": "",
  "cloudApp": "gf5i6x74opqkycntbiykivei",
  "clientApp": "gf5i6x6k7ypbzrnol6ynvvqz",
  "project": "gf5i6xy4lgnwuyzlpedrz7t2",
  "build": "",
  "businessObject": "cluster/reseller/customer/domain/project/connection",
  "clientVersion": 0,
  "guid": "mj7hzv2np6xfkbt67lo66qhj",
  "sysOwner": "u4hsyksna2xvc27n2a4as46j",
  "sysVersion": 0,
  "sysModified": 1542019149803,
  "sysCreated": 1542019149802,
  "sysGroupFlags": 65567,
  "sysGroupList": ""
}

Checklist:

damienomurchu commented 6 years ago

@camilamacedo86 CI is failing on one of the unit tests. If you need to debug into the failing test you should be able to do so with: export NODE_PATH=./lib && node --debug-brk --inspect ./node_modules/.bin/turbo --setUp ./test/setupTeardown.js --tearDown ./test/setupTeardown.js test/unit/fh3/test_ping.js

This will give you a chrome dev tools url you can open up to drop breakpoints/ etc

camilamacedo86 commented 5 years ago

Hi @evanshortiss the changes requested by you were made. Could you check? Could you review this PR?