77const request = require ( './rest.js' ) ;
88
99var domainName , username , password , timeout ;
10+ var prettyprint = false ;
1011var url ;
1112
1213function checkForErrors ( inBody )
@@ -16,21 +17,32 @@ function checkForErrors(inBody)
1617
1718}
1819
19- function init ( inDomainName , inUsername , inPassword , inTimeout ) {
20+ function init ( inDomainName , inUsername , inPassword , inTimeout , inPrettyprint ) {
2021 domainName = inDomainName ;
2122 username = inUsername ;
2223 password = inPassword ;
2324 timeout = inTimeout ;
24- url = "https://" + domainName + "/enterprise/v1/rest/projects" ;
25+ prettyprint = inPrettyprint ;
26+
27+ url = "https://" + domainName + "/apis/v1/rest/projects" ;
2528 //console.log("Username [" + username + "]");
2629 //console.log("URL [" + url + "]");
2730 //console.log("Timeout [" + timeout + "]");
2831}
2932
30- function processResponse ( data , status )
31- {
32-
33- console . log ( JSON . stringify ( data ) ) ;
33+ /**
34+ * Call back function to process REST response
35+ * @param {return data from REST request } data
36+ * @param {status } status
37+ */
38+ function processResponse ( data , status ) {
39+ if ( prettyprint == true ) {
40+ console . log ( JSON . stringify ( data , null , 4 ) ) ;
41+ }
42+ else {
43+ console . log ( JSON . stringify ( data ) ) ;
44+ }
45+
3446 if ( status != 0 ) {
3547 process . exit ( status ) ;
3648 }
@@ -42,6 +54,11 @@ function list(projectId){
4254 request . get ( url , username , password , timeout , processResponse ) ;
4355}
4456
57+ function listAssets ( projectId ) {
58+ if ( projectId ) url += "/" + projectId + "/assets" ;
59+ request . get ( url , username , password , timeout , processResponse ) ;
60+ }
61+
4562function create ( projectName ) {
4663 var data = { "name" :projectName } ;
4764 request . post ( url , username , password , timeout , data , processResponse ) ;
@@ -54,7 +71,24 @@ function update(projectId, projectName){
5471 request . put ( url , username , password , timeout , data , processResponse ) ;
5572}
5673
74+ /**
75+ * Pushes a deployment to a destination tenant
76+ * @param {deployment name } name
77+ * @param {tenant username } tenantUn
78+ * @param {tenant password } tenantPw
79+ * @param {tenant url } tenantUrl
80+ * @param {array of workflow ids } workflows
81+ * @param {array of flowservice names } flowServices
82+ * @param {array of restAPIs } restAPIs
83+ * @param {array of soapAPIs } soapAPIs
84+ * @param {array of listeners } listeners
85+ * @param {array of messaging subscribers } messagings
86+ */
87+ function push ( name , tenantUn , tenantPw , tenantUrl , workflows , flowServices , restAPIs , soapAPIs , listeners , messagings )
88+ {
89+
90+ }
5791
5892
5993
60- module . exports = { init, list, create, update } ;
94+ module . exports = { init, list, listAssets , create, update } ;
0 commit comments