public virtual List <PSActivityRun> ListActivityRuns(ActivityRunFilterOptions activityRunFilter)
        {
            List <PSActivityRun> activityRuns = new List <PSActivityRun>();
            IPage <ActivityRun>  response     = this.DataFactoryManagementClient.ActivityRuns.ListByPipelineRun(
                activityRunFilter.ResourceGroupName,
                activityRunFilter.DataFactoryName,
                activityRunFilter.PipelineRunId,
                activityRunFilter.RunStartedAfter,
                activityRunFilter.RunStartedBefore,
                activityRunFilter.Status,
                activityRunFilter.ActivityName,
                activityRunFilter.LinkedServiceName);

            activityRuns.AddRange(response.Select(ar =>
                                                  new PSActivityRun(ar, activityRunFilter.ResourceGroupName, activityRunFilter.DataFactoryName)));

            string nextLink = response.NextPageLink;

            while (nextLink.IsNextPageLink())
            {
                response = this.DataFactoryManagementClient.ActivityRuns.ListByPipelineRunNext(nextLink);
                activityRuns.AddRange(response.Select(ar =>
                                                      new PSActivityRun(ar, activityRunFilter.ResourceGroupName, activityRunFilter.DataFactoryName)));
                nextLink = response.NextPageLink;
            }
            return(activityRuns);
        }
        public override void ExecuteCmdlet()
        {
            ByFactoryObject();

            ActivityRunFilterOptions activityRunFilter = new ActivityRunFilterOptions
            {
                ResourceGroupName = ResourceGroupName,
                DataFactoryName   = DataFactoryName,
                PipelineRunId     = PipelineRunId,
                RunStartedAfter   = RunStartedAfter,
                RunStartedBefore  = RunStartedBefore,
                ActivityName      = ActivityName,
                Status            = Status
            };

            WriteObject(DataFactoryClient.ListActivityRuns(activityRunFilter), true);
        }
Beispiel #3
0
        public override void ExecuteCmdlet()
        {
            if (ParameterSetName.Equals(ParameterSetNames.ByFactoryObject, StringComparison.OrdinalIgnoreCase))
            {
                DataFactoryName   = DataFactory.DataFactoryName;
                ResourceGroupName = DataFactory.ResourceGroupName;
            }
            ActivityRunFilterOptions activityRunFilter = new ActivityRunFilterOptions
            {
                ResourceGroupName = ResourceGroupName,
                DataFactoryName   = DataFactoryName,
                PipelineRunId     = PipelineRunId,
                RunStartedAfter   = RunStartedAfter,
                RunStartedBefore  = RunStartedBefore,
                ActivityName      = ActivityName,
                LinkedServiceName = LinkedServiceName,
                Status            = Status
            };

            WriteObject(DataFactoryClient.ListActivityRuns(activityRunFilter));
        }
        public virtual List <PSActivityRun> ListActivityRuns(ActivityRunFilterOptions activityRunFilter)
        {
            List <PSActivityRun> activityRuns = new List <PSActivityRun>();
            var runFilters = new RunFilterParameters()
            {
                LastUpdatedAfter  = activityRunFilter.RunStartedAfter,
                LastUpdatedBefore = activityRunFilter.RunStartedBefore,
                Filters           = new List <RunQueryFilter>(),
                OrderBy           = new List <RunQueryOrderBy>(),
            };

            if (activityRunFilter.ActivityName != null)
            {
                runFilters.Filters.Add(
                    new RunQueryFilter()
                {
                    Operand          = RunQueryFilterOperand.ActivityName,
                    OperatorProperty = RunQueryFilterOperator.Equals,
                    Values           = new List <string>()
                    {
                        activityRunFilter.ActivityName
                    }
                });
            }
            if (activityRunFilter.Status != null)
            {
                runFilters.Filters.Add(
                    new RunQueryFilter()
                {
                    Operand          = RunQueryFilterOperand.Status,
                    OperatorProperty = RunQueryFilterOperator.Equals,
                    Values           = new List <string>()
                    {
                        activityRunFilter.Status
                    }
                });
            }
            ActivityRunsQueryResponse response = this.DataFactoryManagementClient.ActivityRuns.QueryByPipelineRun(
                activityRunFilter.ResourceGroupName,
                activityRunFilter.DataFactoryName,
                activityRunFilter.PipelineRunId,
                runFilters);

            activityRuns.AddRange(response.Value.Select(ar =>
                                                        new PSActivityRun(ar, activityRunFilter.ResourceGroupName, activityRunFilter.DataFactoryName)));

            string continuationToken = response.ContinuationToken;

            while (!string.IsNullOrWhiteSpace(continuationToken))
            {
                runFilters.ContinuationToken = continuationToken;
                response = this.DataFactoryManagementClient.ActivityRuns.QueryByPipelineRun(activityRunFilter.ResourceGroupName,
                                                                                            activityRunFilter.DataFactoryName, activityRunFilter.PipelineRunId, runFilters);

                activityRuns.AddRange(response.Value.Select(ar =>
                                                            new PSActivityRun(ar, activityRunFilter.ResourceGroupName, activityRunFilter.DataFactoryName)));

                continuationToken = response.ContinuationToken;
            }
            return(activityRuns);
        }