Skip to content

Commit d60ab47

Browse files
committed
new 10.12 changes
1 parent 754e6e9 commit d60ab47

File tree

3 files changed

+95
-16
lines changed

3 files changed

+95
-16
lines changed

projects.js

Lines changed: 42 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -71,24 +71,52 @@ function update(projectId, projectName){
7171
request.put(url,username,password,timeout,data,processResponse);
7272
}
7373

74+
function del(projectId){
75+
76+
url += "/" + projectId;
77+
var data={};
78+
request.httpDelete(url,username,password,timeout,data,processResponse);
79+
}
80+
81+
82+
7483
/**
7584
* Pushes a deployment to a destination tenant
7685
* @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+
* @param {tenant username} destTenantuser
87+
* @param {tenant password} destTenantPw
88+
* @param {tenant url} destTenantDomainName
89+
* @param {assets to publish} assets
8690
*/
87-
function push(name,tenantUn,tenantPw,tenantUrl,workflows,flowServices,restAPIs,soapAPIs,listeners,messagings)
88-
{
89-
91+
function pub(projectId,publishName,targetTenantDomainName,targetUserId,targetUserPassword,assetsJson){
92+
//{"output":{"workflows":["fla73a20e13dd6736cf9c355","fl3cfd145262bbc5d44acff3"],"flows":["mapLeads"],"rest_api":[],"soap_api":[],"listener":[],"messaging":[]}}
93+
url += "/" + projectId + "/push";
94+
95+
var jsonStr='{';
96+
jsonStr+='"name": "' + publishName + '",';
97+
jsonStr+='"destination_tenant_detail": {';
98+
jsonStr+='"username": "' + targetUserId + '",';
99+
jsonStr+='"password": "' + targetUserPassword + '",';
100+
jsonStr+='"url": "' + "https://" + targetTenantDomainName + '"';
101+
jsonStr+='},';
102+
assetsJson = assetsJson.replace(/\"flows\"/g, "\"flow_services\"");
103+
jsonStr+=assetsJson.substring(11,assetsJson.length-2);
104+
jsonStr+="}";
105+
106+
data = JSON.parse(jsonStr);
107+
request.post(url,username,password,timeout,data,processResponse)
90108
}
91109

110+
/**
111+
*
112+
* @param {publish name} publishName
113+
* @param {version number} version
114+
*/
115+
function deploy(projectName, version)
116+
{
117+
url += "/" + projectName + "/deploy";
118+
data={"version":parseInt(version)};
119+
request.post(url,username,password,timeout,data,processResponse);
120+
}
92121

93-
94-
module.exports = { init, list, listAssets, create, update };
122+
module.exports = { init, list, listAssets, create, update, del, pub, deploy};

rest.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ function put(restEndPoint,user,pass,timeout,data,callback){
4848
sendBody(restEndPoint,user,pass,timeout,data,'PUT',callback);
4949
}
5050

51+
function httpDelete(restEndPoint,user,pass,timeout,data,callback){
52+
sendBody(restEndPoint,user,pass,timeout,data,'DELETE',callback);
53+
}
54+
55+
5156
function post(restEndPoint,user,pass,timeout,data,callback){
5257
sendBody(restEndPoint,user,pass,timeout,data,'POST',callback);
5358
}
@@ -229,4 +234,4 @@ function del(restEndPoint,user,pass,timeout,data,callback){
229234
});
230235
}
231236

232-
module.exports = { get, post, put, del, postDownloadFile, postUploadFile, downloadFile };
237+
module.exports = { get, post, put, del, postDownloadFile, postUploadFile, downloadFile, httpDelete };

wmiocli.js

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const program = new Command();
3333
program
3434

3535
//Program Info
36-
.version('2021.01.0')
36+
.version('2022.04.1')
3737

3838
//required options
3939
.requiredOption('-d, --domain <tenantDomain>', 'Tenant Doamin Name, e.g. "tenant.int-aws-us.webmethods.io"')
@@ -104,6 +104,27 @@ Examples:
104104
-p password
105105
project-delete fl65d3aa87fc1783ea5cf8c8
106106
107+
\x1b[32mGet Project Assets:\x1b[0m
108+
$ node wmiocli.js
109+
-d tenant.int-aws-us.webmethods.io
110+
-u user
111+
-p password
112+
project-assets fl65d3aa87fc1783ea5cf8c8
113+
114+
\x1b[32m/Publish Project to another tenant:\x1b[0m
115+
$ node wmiocli.js
116+
-d tenant.int-aws-us.webmethods.io
117+
-u user
118+
-p password
119+
project-publish fl65d3aa87fc1783ea5cf8c8 'My deployment' 'target.int-aws-us.webmethods.io' 'targetuser' 'targetpassword' '{"output":{"workflows":["fla73a20e13dd6736cf9c355","fl3cfd145262bbc5d44acff3"],"flows":["mapLeads"],"rest_api":[],"soap_api":[],"listener":[],"messaging":[]}}'
120+
121+
122+
\x1b[32m/Publish Project to another tenant:\x1b[0m
123+
$ node wmiocli.js
124+
-d tenant.int-aws-us.webmethods.io
125+
-u user
126+
-p password
127+
project-publish fl65d3aa87fc1783ea5cf8c8 'My deployment'
107128
108129
\x1b[4mWorkflow\x1b[0m
109130
@@ -218,6 +239,31 @@ program.command('project-update <project-id> <project-name>')
218239
project.update(projectId, projectName);
219240
});
220241

242+
program.command('project-delete <project-id>')
243+
.description('Delete project with given id')
244+
.action((projectId) => {
245+
checkEnableDebug();
246+
project.init(program.opts().domain,program.opts().user,program.opts().password,program.opts().timeout,program.opts().prettyprint)
247+
project.del(projectId);
248+
});
249+
250+
program.command('project-publish <project-id> <publish-name> <target-tenant-domain-name> <target-user-id> <target-user-password> <assets-json>')
251+
.description('Pubilsh project to another tenant with given id')
252+
.action((projectId,publishName,targetTenantDomainName,targetUserId,targetUserPassword,assetsJson) => {
253+
checkEnableDebug();
254+
project.init(program.opts().domain,program.opts().user,program.opts().password,program.opts().timeout,program.opts().prettyprint)
255+
project.pub(projectId,publishName,targetTenantDomainName,targetUserId,targetUserPassword,assetsJson);
256+
257+
});
258+
259+
program.command('project-deploy <projectName> <version>')
260+
.description('deploy published project with given version into tenant')
261+
.action((projectName, version) => {
262+
checkEnableDebug();
263+
project.init(program.opts().domain,program.opts().user,program.opts().password,program.opts().timeout,program.opts().prettyprint)
264+
project.deploy(projectName,version);
265+
});
266+
221267
/**
222268
* ------------------------------------------------------------------------------------------------------------------------------------
223269
* ROLES

0 commit comments

Comments
 (0)