Example #1
0
        private async Task <IEnumerable <LogicAppAction> > FindLogicAppRunActionsAsync(ILogicManagementClient managementClient, string runName)
        {
            _logger.LogTrace("Find related logic app run actions...");
            IPage <WorkflowRunAction> workflowRunActions =
                await managementClient.WorkflowRunActions.ListAsync(_resourceGroup, _logicAppName, runName);

            var actions = new Collection <LogicAppAction>();

            foreach (WorkflowRunAction workflowRunAction in workflowRunActions)
            {
                string input = await GetHttpJsonStringAsync(workflowRunAction.InputsLink?.Uri);

                string output = await GetHttpJsonStringAsync(workflowRunAction.OutputsLink?.Uri);

                var action = LogicAppConverter.ToLogicAppAction(workflowRunAction, input, output);
                actions.Add(action);
            }

            _logger.LogTrace("Found {LogicAppActionsCount} logic app actions", actions.Count);
            return(actions.AsEnumerable());
        }
Example #2
0
        private async Task <IEnumerable <LogicAppRun> > GetLogicAppRunsAsync()
        {
            using (LogicManagementClient managementClient = await _authentication.AuthenticateAsync())
            {
                var odataQuery = new ODataQuery <WorkflowRunFilter>
                {
                    Filter = $"StartTime ge {_startTime.UtcDateTime:O} and Status ne 'Running'"
                };

                if (_hasCorrelationId)
                {
                    odataQuery.Filter += $" and ClientTrackingId eq '{_correlationId}'";
                }

                _logger.LogTrace(
                    "Query logic app runs for '{LogicAppName}' in resource group '{ResourceGroup}': {Query}", _logicAppName, _resourceGroup, odataQuery.Filter);

                IPage <WorkflowRun> workFlowRuns =
                    await managementClient.WorkflowRuns.ListAsync(_resourceGroup, _logicAppName, odataQuery);

                _logger.LogTrace("Query returned {WorkFlowRunCount} workflow runs", workFlowRuns.Count());

                var logicAppRuns = new Collection <LogicAppRun>();
                foreach (WorkflowRun workFlowRun in workFlowRuns)
                {
                    IEnumerable <LogicAppAction> actions =
                        await FindLogicAppRunActionsAsync(managementClient, workFlowRun.Name);

                    if (_trackingProperties.Count > 0 && actions.Any(action => HasTrackedProperty(action.TrackedProperties)) ||
                        _trackingProperties.Count <= 0)
                    {
                        var logicAppRun = LogicAppConverter.ToLogicAppRun(workFlowRun, actions);
                        logicAppRuns.Add(logicAppRun);
                    }
                }

                _logger.LogTrace("Query resulted in {LogicAppRunCount} logic app runs", logicAppRuns.Count);
                return(logicAppRuns.AsEnumerable());
            }
        }
Example #3
0
        /// <summary>
        /// Gets the logic app definition information.
        /// </summary>
        public async Task <LogicAppMetadata> GetMetadataAsync()
        {
            Workflow workflow = await _logicManagementClient.Workflows.GetAsync(_resourceGroup, _logicAppName);

            return(LogicAppConverter.ToLogicApp(workflow));
        }