WorkflowName

We found 10 examples in language CSharp for this search. You will see 46 fragments of code.

        /// <summary>
        /// Gets the workflow by name from given resource group.
        /// </summary>
        /// <param name="resourceGroupName">Name of the resource group</param>
        /// <param name="workflowName">Workflow name</param>
        /// <returns>Workflow object</returns>
        public Workflow GetWorkflow(string resourceGroupName, string workflowName)
        {
            return this.LogicManagementClient.Workflows.Get(resourceGroupName, workflowName);
        }

        /// <summary>
        /// Removes the specified workflow from the given resource group.
        /// </summary>
        /// <param name="resourceGroupName">Name of the resource group</param>
        /// <param name="workflowName">Workflow name</param>
        public void RemoveWorkflow(string resourceGroupName, string workflowName)
        {
            this.LogicManagementClient.Workflows.Delete(resourceGroupName, workflowName);
        }


        /// <summary>
        /// Gets the workflow by name from given resource group.
        /// </summary>
        /// <param name="resourceGroupName">Name of the resource group</param>
        /// <param name="workflowName">Workflow name</param>
        /// <returns>Workflow object</returns>
        public Workflow GetWorkflow(string resourceGroupName, string workflowName)
        {
            return this.LogicManagementClient.Workflows.Get(resourceGroupName, workflowName);
        }

        /// <summary>
        /// Removes the specified workflow from the given resource group.
        /// </summary>
        /// <param name="resourceGroupName">Name of the resource group</param>
        /// <param name="workflowName">Workflow name</param>
        public void RemoveWorkflow(string resourceGroupName, string workflowName)
        {
            this.LogicManagementClient.Workflows.Delete(resourceGroupName, workflowName);
        }


        public List<RuleResultTree> ExecuteRule(string workflowName, object[] inputs)
        {
            var ruleParams = new List<RuleParameter>();

            for (int i = 0; i < inputs.Length; i++)
            {
                var input = inputs[i];
                var obj = Utils.GetTypedObject(input);
                ruleParams.Add(new RuleParameter($"input{i + 1}", obj));
            }
            return ExecuteRule(workflowName, ruleParams.ToArray());
        }

        public List<RuleResultTree> ExecuteRule(string workflowName, object input)
        {
            var inputs = new[] { input };
            return ExecuteRule(workflowName, inputs);
        }

        public List<RuleResultTree> ExecuteRule(string workflowName, RuleParameter[] ruleParams)
        {
            return ValidateWorkflowAndExecuteRule(workflowName, ruleParams);
        }

        public void RemoveWorkflow(params string[] workflowNames)
        {
            foreach (var workflowName in workflowNames)
            {
                _rulesCache.Remove(workflowName);
            }
        }

        private static string GetCompileRulesKey(string workflowName, RuleParameter[] ruleParams)
        {
            return $"{workflowName}-" + String.Join("-", ruleParams.Select(c => c.Type.Name));
        }

            /// <summary>
            /// Gets a list of workflows by subscription.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='odataQuery'>
            /// OData parameters to apply to the operation.
            /// </param>
            public static IPage<Workflow> ListBySubscription(this IWorkflowsOperations operations, ODataQuery<WorkflowFilter> odataQuery = default(ODataQuery<WorkflowFilter>))
            {
                return operations.ListBySubscriptionAsync(odataQuery).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Gets a list of workflows by subscription.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='odataQuery'>
            /// OData parameters to apply to the operation.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<IPage<Workflow>> ListBySubscriptionAsync(this IWorkflowsOperations operations, ODataQuery<WorkflowFilter> odataQuery = default(ODataQuery<WorkflowFilter>), CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(odataQuery, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Gets a list of workflows by resource group.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The resource group name.
            /// </param>
            /// <param name='odataQuery'>
            /// OData parameters to apply to the operation.
            /// </param>
            public static IPage<Workflow> ListByResourceGroup(this IWorkflowsOperations operations, string resourceGroupName, ODataQuery<WorkflowFilter> odataQuery = default(ODataQuery<WorkflowFilter>))
            {
                return operations.ListByResourceGroupAsync(resourceGroupName, odataQuery).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Gets a list of workflows by resource group.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The resource group name.
            /// </param>
            /// <param name='odataQuery'>
            /// OData parameters to apply to the operation.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<IPage<Workflow>> ListByResourceGroupAsync(this IWorkflowsOperations operations, string resourceGroupName, ODataQuery<WorkflowFilter> odataQuery = default(ODataQuery<WorkflowFilter>), CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, odataQuery, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Gets a workflow.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The resource group name.
            /// </param>
            /// <param name='workflowName'>
            /// The workflow name.
            /// </param>
            public static Workflow Get(this IWorkflowsOperations operations, string resourceGroupName, string workflowName)
            {
                return operations.GetAsync(resourceGroupName, workflowName).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Gets a workflow.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The resource group name.
            /// </param>
            /// <param name='workflowName'>
            /// The workflow name.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<Workflow> GetAsync(this IWorkflowsOperations operations, string resourceGroupName, string workflowName, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workflowName, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

        /// <summary>
        /// Cancels the logic app run.
        /// </summary>
        /// <param name="resourceGroupName">Name of the resource group</param>
        /// <param name="workflowName">Name of the workflow</param>
        /// <param name="runName">Workflow run name</param>
        public void CancelWorkflowRun(string resourceGroupName, string workflowName,
            string runName)
        {
            this.LogicManagementClient.WorkflowRuns.Cancel(resourceGroupName, workflowName, runName);
        }

        /// <summary>
        /// Gets the workflow run history.
        /// </summary>
        /// <param name="resourceGroupName">Name of the resource group</param>
        /// <param name="workflowName">Name of the workflow</param>
        /// <returns>List of workflow runs</returns>
        public Page<WorkflowRun> GetWorkflowRuns(string resourceGroupName, string workflowName)
        {
            return (Page<WorkflowRun>)this.LogicManagementClient.WorkflowRuns.List(resourceGroupName, workflowName);
        }

        /// <summary>
        /// Gets the logic app run.
        /// </summary>
        /// <param name="resourceGroupName">Name of the resource group</param>
        /// <param name="workflowName">Name of the workflow</param>
        /// <param name="runName">Name of the workflow run</param>
        /// <returns>Workflow run</returns>       
        public WorkflowRun GetWorkflowRun(string resourceGroupName, string workflowName,
            string runName)
        {
            return this.LogicManagementClient.WorkflowRuns.Get(resourceGroupName, workflowName, runName);
        }

        /// <summary>
        /// Gets the workflow run action
        /// </summary>
        /// <param name="resourceGroupName">Name of the resource group</param>
        /// <param name="workflowName">Name of the workflow</param>
        /// <param name="runName">Name of the workflow run</param>
        /// <param name="actionName">Name of the workflow run action</param>
        /// <returns>Workflow run action</returns>
        public WorkflowRunAction GetWorkflowRunAction(string resourceGroupName, string workflowName,
            string runName, string actionName)
        {
            return this.LogicManagementClient.WorkflowRunActions.Get(resourceGroupName, workflowName, runName,
                actionName);
        }

        /// <summary>
        /// Gets actions of the specified workflow run.
        /// </summary>
        /// <param name="resourceGroupName">Name of the resource group</param>
        /// <param name="workflowName">Name of the workflow</param>
        /// <param name="runName">Name of the workflow run</param>
        /// <returns>Actions of the specified workflow run</returns>
        public Page<WorkflowRunAction> GetWorkflowRunActions(string resourceGroupName, string workflowName, string runName)
        {
            return (Page<WorkflowRunAction>)this.LogicManagementClient.WorkflowRunActions.List(resourceGroupName, workflowName, runName);
        }

        public static void PublishActivity(this WorkflowManagementClient client, string name, string xamlFilePath)
        {
            client.Activities.Publish(
                new ActivityDescription(WorkflowUtils.Translate(xamlFilePath))
                {
                    Name = name
                });
        }


        public static void PublishWorkflowString(this WorkflowManagementClient client, string workflowName, string xamlFilePath, SubscriptionFilter activationFilter = null)
        {
            PublishWorkflowString(client, workflowName, xamlFilePath, null, null, activationFilter);
        }

        public static void PublishWorkflow(this WorkflowManagementClient client, string workflowName, string XamlFile, SubscriptionFilter activationFilter = null)
        {
            PublishWorkflow(client, workflowName, XamlFile, null, null, activationFilter);
        }

        public static void PublishWorkflow(this WorkflowManagementClient client, string workflowName, string xamlFilePath, Collection<ExternalVariable> externalVariables, SubscriptionFilter activationFilter = null)
        {
            PublishWorkflow(client, workflowName, xamlFilePath, externalVariables, null, activationFilter);
        }

        public static void PublishWorkflow(this WorkflowManagementClient client, string workflowName, string xamlFilePath, IDictionary<string, string> configValues, SubscriptionFilter activationFilter = null)
        {
            PublishWorkflow(client, workflowName, xamlFilePath, null, configValues, activationFilter);
        }

        public static void PublishWorkflow(this WorkflowManagementClient client, string workflowName, string xamlFilePath, Collection<ExternalVariable> externalVariables, IDictionary<string, string> configValues, SubscriptionFilter activationFilter = null)
        {
            // publish the activity description related with the workflow
            client.Activities.Publish(
                new ActivityDescription(WorkflowUtils.Translate(xamlFilePath)) { Name = workflowName },true,true);

            // now, publish the workflow description
            WorkflowDescription description = new WorkflowDescription
            {
                Name = workflowName,
                ActivityPath = workflowName,
            };

            // add external variables
            if (externalVariables != null)
            {
                externalVariables
                    .ToList()
                    .ForEach(ev => description.ExternalVariables.Add(ev));
            }

            // add config
            if (configValues != null)
            {
                description.Configuration = new WorkflowConfiguration();
                configValues
                    .ToList()
                    .ForEach(c => description.Configuration.AppSettings.Add(c));
            }

            // add activation filter
            if (activationFilter != null)
            {
                description.ActivationDescription = new SubscriptionActivationDescription
                {
                    Filter = activationFilter
                };
            }

            // publish!
            client.Workflows.Publish(description);
        }

        /// <summary>
        /// Cancels the logic app run.
        /// </summary>
        /// <param name="resourceGroupName">Name of the resource group</param>
        /// <param name="workflowName">Name of the workflow</param>
        /// <param name="runName">Workflow run name</param>
        public void CancelWorkflowRun(string resourceGroupName, string workflowName,
            string runName)
        {
            this.LogicManagementClient.WorkflowRuns.Cancel(resourceGroupName, workflowName, runName);
        }

        /// <summary>
        /// Gets the workflow run history.
        /// </summary>
        /// <param name="resourceGroupName">Name of the resource group</param>
        /// <param name="workflowName">Name of the workflow</param>
        /// <returns>List of workflow runs</returns>
        public Page<WorkflowRun> GetWorkflowRuns(string resourceGroupName, string workflowName)
        {
            return (Page<WorkflowRun>)this.LogicManagementClient.WorkflowRuns.List(resourceGroupName, workflowName);
        }

        /// <summary>
        /// Gets the logic app run.
        /// </summary>
        /// <param name="resourceGroupName">Name of the resource group</param>
        /// <param name="workflowName">Name of the workflow</param>
        /// <param name="runName">Name of the workflow run</param>
        /// <returns>Workflow run</returns>       
        public WorkflowRun GetWorkflowRun(string resourceGroupName, string workflowName,
            string runName)
        {
            return this.LogicManagementClient.WorkflowRuns.Get(resourceGroupName, workflowName, runName);
        }

        /// <summary>
        /// Gets the workflow run action
        /// </summary>
        /// <param name="resourceGroupName">Name of the resource group</param>
        /// <param name="workflowName">Name of the workflow</param>
        /// <param name="runName">Name of the workflow run</param>
        /// <param name="actionName">Name of the workflow run action</param>
        /// <returns>Workflow run action</returns>
        public WorkflowRunAction GetWorkflowRunAction(string resourceGroupName, string workflowName,
            string runName, string actionName)
        {
            return this.LogicManagementClient.WorkflowRunActions.Get(resourceGroupName, workflowName, runName,
                actionName);
        }

        /// <summary>
        /// Gets actions of the specified workflow run.
        /// </summary>
        /// <param name="resourceGroupName">Name of the resource group</param>
        /// <param name="workflowName">Name of the workflow</param>
        /// <param name="runName">Name of the workflow run</param>
        /// <returns>Actions of the specified workflow run</returns>
        public Page<WorkflowRunAction> GetWorkflowRunActions(string resourceGroupName, string workflowName, string runName)
        {
            return (Page<WorkflowRunAction>)this.LogicManagementClient.WorkflowRunActions.List(resourceGroupName, workflowName, runName);
        }

            /// <summary>
            /// Gets a list of workflow triggers.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The resource group name.
            /// </param>
            /// <param name='workflowName'>
            /// The workflow name.
            /// </param>
            /// <param name='odataQuery'>
            /// OData parameters to apply to the operation.
            /// </param>
            public static IPage<WorkflowTrigger> List(this IWorkflowTriggersOperations operations, string resourceGroupName, string workflowName, ODataQuery<WorkflowTriggerFilter> odataQuery = default(ODataQuery<WorkflowTriggerFilter>))
            {
                return operations.ListAsync(resourceGroupName, workflowName, odataQuery).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Gets a list of workflow triggers.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The resource group name.
            /// </param>
            /// <param name='workflowName'>
            /// The workflow name.
            /// </param>
            /// <param name='odataQuery'>
            /// OData parameters to apply to the operation.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<IPage<WorkflowTrigger>> ListAsync(this IWorkflowTriggersOperations operations, string resourceGroupName, string workflowName, ODataQuery<WorkflowTriggerFilter> odataQuery = default(ODataQuery<WorkflowTriggerFilter>), CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workflowName, odataQuery, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Gets a workflow trigger.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The resource group name.
            /// </param>
            /// <param name='workflowName'>
            /// The workflow name.
            /// </param>
            /// <param name='triggerName'>
            /// The workflow trigger name.
            /// </param>
            public static WorkflowTrigger Get(this IWorkflowTriggersOperations operations, string resourceGroupName, string workflowName, string triggerName)
            {
                return operations.GetAsync(resourceGroupName, workflowName, triggerName).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Gets a workflow trigger.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The resource group name.
            /// </param>
            /// <param name='workflowName'>
            /// The workflow name.
            /// </param>
            /// <param name='triggerName'>
            /// The workflow trigger name.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<WorkflowTrigger> GetAsync(this IWorkflowTriggersOperations operations, string resourceGroupName, string workflowName, string triggerName, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workflowName, triggerName, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Resets a workflow trigger.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The resource group name.
            /// </param>
            /// <param name='workflowName'>
            /// The workflow name.
            /// </param>
            /// <param name='triggerName'>
            /// The workflow trigger name.
            /// </param>
            public static void Reset(this IWorkflowTriggersOperations operations, string resourceGroupName, string workflowName, string triggerName)
            {
                operations.ResetAsync(resourceGroupName, workflowName, triggerName).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Resets a workflow trigger.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The resource group name.
            /// </param>
            /// <param name='workflowName'>
            /// The workflow name.
            /// </param>
            /// <param name='triggerName'>
            /// The workflow trigger name.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task ResetAsync(this IWorkflowTriggersOperations operations, string resourceGroupName, string workflowName, string triggerName, CancellationToken cancellationToken = default(CancellationToken))
            {
                (await operations.ResetWithHttpMessagesAsync(resourceGroupName, workflowName, triggerName, null, cancellationToken).ConfigureAwait(false)).Dispose();
            }

        [Fact]
        public void WorkflowTriggerHistories_Get_OK()
        {
            using (var context = MockContext.Start(this.TestClassName))
            {
                var client = this.GetClient(context);
                this.CleanResourceGroup(client);
                var workflowName = TestUtilities.GenerateName(Constants.WorkflowPrefix);
                var workflow = this.CreateWorkflow(workflowName);
                var createdWorkflow = client.Workflows.CreateOrUpdate(Constants.DefaultResourceGroup,
                    workflowName,
                    workflow);

                var preHistories = client.WorkflowTriggerHistories.List(Constants.DefaultResourceGroup, workflowName, Constants.DefaultTriggerName);
                Assert.Empty(preHistories);

                client.WorkflowTriggers.Run(Constants.DefaultResourceGroup, workflowName, Constants.DefaultTriggerName);

                var postHistories = client.WorkflowTriggerHistories.List(Constants.DefaultResourceGroup, workflowName, Constants.DefaultTriggerName);
                var retrievedHistory = client.WorkflowTriggerHistories.Get(Constants.DefaultResourceGroup,
                    workflowName,
                    Constants.DefaultTriggerName,
                    postHistories.First().Name);

                this.ValidateHistory(retrievedHistory);

                client.Workflows.Delete(Constants.DefaultResourceGroup, workflowName);
            }
        }

        [Fact]
        public void WorkflowTriggerHistories_List_OK()
        {
            using (var context = MockContext.Start(this.TestClassName))
            {
                var client = this.GetClient(context);
                this.CleanResourceGroup(client);
                var workflowName = TestUtilities.GenerateName(Constants.WorkflowPrefix);
                var workflow = this.CreateWorkflow(workflowName);
                var createdWorkflow = client.Workflows.CreateOrUpdate(Constants.DefaultResourceGroup,
                    workflowName,
                    workflow);

                var preHistories = client.WorkflowTriggerHistories.List(Constants.DefaultResourceGroup, workflowName, Constants.DefaultTriggerName);
                Assert.Empty(preHistories);

                client.WorkflowTriggers.Run(Constants.DefaultResourceGroup, workflowName, Constants.DefaultTriggerName);
                client.WorkflowTriggers.Run(Constants.DefaultResourceGroup, workflowName, Constants.DefaultTriggerName);

                var postHistories = client.WorkflowTriggerHistories.List(Constants.DefaultResourceGroup, workflowName, Constants.DefaultTriggerName);

                Assert.Equal(2, postHistories.Count());
                foreach (var history in postHistories)
                {
                    this.ValidateHistory(history);
                }

                client.Workflows.Delete(Constants.DefaultResourceGroup, workflowName);
            }
        }

        private void ValidateHistory(WorkflowTriggerHistory actual)
        {
            Assert.NotEmpty(actual.Correlation.ClientTrackingId);
            Assert.True(actual.Fired);
            Assert.NotEmpty(actual.Id);
            Assert.NotEmpty(actual.Run.Name);
            Assert.NotNull(actual.StartTime);
            Assert.NotNull(actual.EndTime);
        }


        public bool ContainsWorkflowRules(string workflowName)
        {
            return _workflowRules.ContainsKey(workflowName);
        }

        public bool ContainsCompiledRules(string workflowName)
        {
            return _compileRules.ContainsKey(workflowName);
        }

        public void AddOrUpdateWorkflowRules(string workflowName, WorkflowRules rules)
        {
            _workflowRules.AddOrUpdate(workflowName, rules, (k, v) => rules);
        }

        public void AddOrUpdateCompiledRule(string compiledRuleKey, CompiledRule compiledRule)
        {
            _compileRules.AddOrUpdate(compiledRuleKey, compiledRule, (k, v) => compiledRule);
        }

        public void Clear()
        {
            _workflowRules.Clear();
            _compileRules.Clear();
        }

        public IEnumerable<Rule> GetRules(string workflowName)
        {
            return _workflowRules[workflowName].Rules;
        }

Other methods