@@ -39,6 +39,11 @@ var payloaduid;
3939var projectuid ;
4040var data ;
4141var type ;
42+ var flowServiceId ;
43+ var scheduleStatus ;
44+ var optionEnable ;
45+ var flowOptionType ;
46+ var incEdgeFlows ;
4247
4348
4449const maxRunningWorkflows = 20 ;
@@ -69,6 +74,86 @@ function init(inDomainName, inUsername, inPassword,inTimeout,inPrettyprint){
6974 dbg . message ( "<EXPERIMENTAL>Timeout [" + timeout + "]" , 4 ) ;
7075}
7176
77+
78+ function flowserviceDetails ( inProjectId , includeEdgeFlows )
79+ {
80+ projectId = inProjectId ;
81+ incEdgeFlows = includeEdgeFlows
82+ finalCall = processflowDetails ;
83+ loginPhase1 ( ) ;
84+ }
85+
86+ function processflowDetails ( )
87+ {
88+ debug ( "Process FlowService Details - Project [" + projectId + "] Include Edge flows [" + incEdgeFlows + "]" ) ;
89+ var endPoint = "https://" + domainName + "/integration/rest/ut-flow/flow-metadata/" + projectId + "?limit=" + returnCount + "&skip=" + returnStart ;
90+ var body ;
91+ debug ( "Next URL [" + endPoint + "]" ) ;
92+ var headers = setHeaders ( ) ;
93+ rest . custom ( endPoint , undefined , undefined , timeout , body , undefined , "GET" , processResponse , undefined , headers , true , false ) ;
94+ }
95+
96+ function flowserviceOption ( inFlowServiceId , inEnable , inProjectId , inOptionType )
97+ {
98+ flowServiceId = inFlowServiceId ;
99+ optionEnable = inEnable ;
100+ projectId = inProjectId ;
101+ flowOptionType = inOptionType ;
102+ finalCall = processflowOption ;
103+ loginPhase1 ( ) ;
104+ }
105+
106+ function processflowOption ( )
107+ {
108+ debug ( "Process FlowService Option [" + flowOptionType + "] - Project [" + projectId + "] FlowService [" + flowServiceId + "] Enable [" + optionEnable + "]" ) ;
109+ if ( optionEnable !== undefined && optionEnable !== null & optionEnable . length > 1 ) {
110+ optionEnable = ( optionEnable . toLowerCase ( ) == "true" ) ;
111+ }
112+
113+ var endPoint = "https://" + domainName + "/integration/rest/ut-flow/flow/" ;
114+ var body = { } ;
115+ if ( flowOptionType == "http" )
116+ {
117+ endPoint += "export/" + flowServiceId + "?projectName=" + projectId ;
118+ body = { "integration" :{ "serviceData" :{ "stages" :[ { "stageName" :"stage00" , "markExportable" :optionEnable } ] } } } ;
119+ }
120+ else if ( flowOptionType == "resubmit" )
121+ {
122+ endPoint += "resubmit/" + flowServiceId + "?projectName=" + projectId ;
123+ body = { "integration" :{ "serviceData" :{ "stages" :[ { "stageName" :"stage00" , "markResubmittable" :optionEnable } ] } } } ;
124+ }
125+ else
126+ {
127+ console . log ( "Unable to determine flow option type: " + flowOptionType ) ;
128+ process . exit ( 1 ) ;
129+ }
130+
131+ debug ( "Next URL [" + endPoint + "]" ) ;
132+ var headers = setHeaders ( ) ;
133+ rest . custom ( endPoint , undefined , undefined , timeout , body , undefined , "PUT" , processResponse , undefined , headers , true , false ) ;
134+ }
135+
136+
137+ function flowserviceScheduler ( inFlowServiceId , inScheduleStatus , inProjectId )
138+ {
139+ flowServiceId = inFlowServiceId ;
140+ scheduleStatus = inScheduleStatus ;
141+ projectId = inProjectId ;
142+ finalCall = processScheduleStatus ;
143+ loginPhase1 ( ) ;
144+ }
145+
146+ function processScheduleStatus ( )
147+ {
148+ debug ( "Process FlowService Schedule Status - Project [" + projectId + "] FlowService [" + flowServiceId + "] Status [" + scheduleStatus + "]" ) ;
149+
150+ var endPoint = "https://" + domainName + "/integration/rest/scheduler/" + scheduleStatus + "/" + flowServiceId + "?projectName=" + projectId ;
151+ debug ( "Next URL [" + endPoint + "]" ) ;
152+ var headers = setHeaders ( ) ;
153+ var body ;
154+ rest . custom ( endPoint , undefined , undefined , timeout , body , undefined , "POST" , processResponse , undefined , headers , true , false ) ;
155+ }
156+
72157function user ( )
73158{
74159 finalCall = execUserInfo ;
@@ -236,6 +321,9 @@ function setHeaders()
236321 { name :"X-Requested-With" , value :"XMLHttpRequest" } ,
237322 { name :"X-Request-ID" , value :generateUUID ( ) } ,
238323 { name :"project_uid" , value :projectId } ,
324+ { name :"x-csrf-token" , value :csrf } ,
325+
326+
239327 ] ;
240328 return headers ;
241329}
@@ -664,7 +752,7 @@ function getLogs()
664752function searchProjectsByName ( )
665753{
666754 dbg . message ( "<EXPERIMENTAL>" + "Search Projects By Name [" + projectName + "]" , 4 ) ;
667- var endPoint = "https://" + domainName + "/enterprise/v1/projects?limit=1000 &skip=0 &q=" + projectName ;
755+ var endPoint = "https://" + domainName + "/enterprise/v1/projects?limit=" + returnCount + " &skip=" + returnStart + " &q=" + projectName ;
668756 dbg . message ( "<EXPERIMENTAL>" + "Next URL [" + endPoint + "]" , 4 ) ;
669757 var headers = setHeaders ( ) ;
670758 rest . custom ( endPoint , undefined , undefined , timeout , undefined , undefined , "GET" , processResponse , undefined , headers , true , false ) ;
@@ -711,7 +799,10 @@ function projectWorkflowsInfo()
711799{
712800
713801 debug ( "Project Workflows Info" ) ;
714- var endPoint = "https://" + domainName + "/enterprise/v1/flows?limit=1000&skip=0&filter=recent&tags=&query=" ;
802+ var endPoint = "https://" + domainName + "/enterprise/v1/flows?limit=" + returnCount + "&skip=" + returnStart + "&filter=recent&tags=&query=" ;
803+
804+
805+
715806 debug ( "Next URL [" + endPoint + "]" ) ;
716807 var headers = setHeaders ( ) ;
717808 rest . custom ( endPoint , undefined , undefined , timeout , undefined , undefined , "GET" , processProjectsResponse , undefined , headers , true , false ) ;
@@ -721,7 +812,7 @@ function projectFlowServicesInfo()
721812{
722813
723814 debug ( "Project FlowServices Info" ) ;
724- var endPoint = "https://" + domainName + "/integration/rest/ut-flow/flow-metadata/" + projectId + "?skip=0&limit=1000" ;
815+ var endPoint = "https://" + domainName + "/integration/rest/ut-flow/flow-metadata/" + projectId + "?limit=" + returnCount + "&skip=" + returnStart ;
725816 debug ( "Next URL [" + endPoint + "]" ) ;
726817 var headers = setHeaders ( ) ;
727818 rest . custom ( endPoint , undefined , undefined , timeout , undefined , undefined , "GET" , processResponse , undefined , headers , true , false ) ;
@@ -996,6 +1087,9 @@ function loginResponse(url,err,body,res){
9961087
9971088}
9981089
1090+
1091+
1092+
9991093module . exports = { init,
10001094 user, stages,
10011095 searchProject,
@@ -1004,4 +1098,4 @@ module.exports = {init,
10041098 connectorAccounts, getProjectAccountConfig,
10051099 getMonitorInfo, workflowResubmit,
10061100 messagingCreate, messagingStats, messagingDelete,
1007- vbidAnalysis} ;
1101+ vbidAnalysis, flowserviceScheduler , flowserviceOption , flowserviceDetails } ;
0 commit comments