public override async Task <ActionResponse> ExecuteActionAsync(ActionRequest request) { RestClient rc = ScribeUtility.Initialize(request.DataStore.GetValue("ScribeUsername"), request.DataStore.GetValue("ScribePassword")); string orgId = request.DataStore.GetValue("ScribeOrganizationId"); Thread.Sleep(SOLUTION_STATUS_WAIT); string solutionId = await ScribeUtility.GetSolutionId(rc, orgId, ScribeUtility.BPST_SOLUTION_NAME); ScribeSolution solution = JsonUtility.Deserialize <ScribeSolution>(await rc.Get(string.Format(ScribeUtility.URL_SOLUTION, orgId, solutionId))); string status = solution.status ?? string.Empty; if (status.EqualsIgnoreCase(SOLUTION_STATUS_IDLE_LAST_RUN_FAILED) || status.EqualsIgnoreCase(SOLUTION_STATUS_ON_DEMAND_LAST_RUN_FAILED)) { return(new ActionResponse(ActionStatus.Failure, new ActionResponseExceptionDetail(string.Empty, await GetHistory(rc, orgId, solutionId)))); } else if (status.EqualsIgnoreCase(SOLUTION_STATUS_IDLE) || status.EqualsIgnoreCase(SOLUTION_STATUS_ON_DEMAND)) { return(new ActionResponse(ActionStatus.Success)); } else { return(new ActionResponse(ActionStatus.InProgress)); } }
public override async Task <ActionResponse> ExecuteActionAsync(ActionRequest request) { Thread.Sleep(SOLUTION_STATUS_WAIT); RestClient rc = ScribeUtility.Initialize(request.DataStore.GetValue("ScribeUsername"), request.DataStore.GetValue("ScribePassword")); string orgId = request.DataStore.GetValue("ScribeOrganizationId"); string solutionId = await ScribeUtility.GetSolutionId(rc, orgId, ScribeUtility.BPST_SOLUTION_NAME); for (int i = 0; i < SOLUTION_STATUS_ATTEMPTS && !(await IsSolutionReady(rc, orgId, solutionId)); i++) { Thread.Sleep(SOLUTION_STATUS_WAIT); } await rc.Post(string.Format(ScribeUtility.URL_SOLUTION_PROCESS, orgId, solutionId), string.Empty); return(new ActionResponse(ActionStatus.Success)); }