FilterPSPipelines() public method

public FilterPSPipelines ( Microsoft.Azure.Commands.DataFactories.PipelineFilterOptions filterOptions ) : List
filterOptions Microsoft.Azure.Commands.DataFactories.PipelineFilterOptions
return List
Exemplo n.º 1
0
        public override void ExecuteCmdlet()
        {
            if (ParameterSetName == ByFactoryObject)
            {
                if (DataFactory == null)
                {
                    throw new PSArgumentNullException(string.Format(CultureInfo.InvariantCulture, Resources.DataFactoryArgumentInvalid));
                }

                DataFactoryName   = DataFactory.DataFactoryName;
                ResourceGroupName = DataFactory.ResourceGroupName;
            }

            PipelineFilterOptions filterOptions = new PipelineFilterOptions()
            {
                Name = Name,
                ResourceGroupName = ResourceGroupName,
                DataFactoryName   = DataFactoryName
            };

            List <PSPipeline> pipelines = DataFactoryClient.FilterPSPipelines(filterOptions);

            if (pipelines != null)
            {
                if (pipelines.Count == 1 && Name != null)
                {
                    WriteObject(pipelines[0]);
                }
                else
                {
                    WriteObject(pipelines, true);
                }
            }
        }
        public override void ExecuteCmdlet()
        {
            // ValidationNotNullOrEmpty doesn't handle whitespaces well
            if (Name != null && string.IsNullOrWhiteSpace(Name))
            {
                throw new PSArgumentNullException("Name");
            }

            if (ParameterSetName == ByFactoryObject)
            {
                if (DataFactory == null)
                {
                    throw new PSArgumentNullException(string.Format(CultureInfo.InvariantCulture, Resources.DataFactoryArgumentInvalid));
                }

                DataFactoryName   = DataFactory.DataFactoryName;
                ResourceGroupName = DataFactory.ResourceGroupName;
            }

            PipelineFilterOptions filterOptions = new PipelineFilterOptions()
            {
                Name = Name,
                ResourceGroupName = ResourceGroupName,
                DataFactoryName   = DataFactoryName
            };

            if (Name != null)
            {
                List <PSPipeline> pipelines = DataFactoryClient.FilterPSPipelines(filterOptions);
                if (pipelines != null && pipelines.Any())
                {
                    WriteObject(pipelines.First());
                }
                return;
            }

            // List pipelines until all pages are fetched.
            do
            {
                WriteObject(DataFactoryClient.FilterPSPipelines(filterOptions), true);
            } while (filterOptions.NextLink.IsNextPageLink());
        }