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 virtual List <PSPipeline> ListPipelines(PipelineFilterOptions filterOptions) { List <PSPipeline> pipelines = new List <PSPipeline>(); PipelineListResponse response; if (filterOptions.NextLink.IsNextPageLink()) { response = DataPipelineManagementClient.Pipelines.ListNext(filterOptions.NextLink); } else { response = DataPipelineManagementClient.Pipelines.List(filterOptions.ResourceGroupName, filterOptions.DataFactoryName); } filterOptions.NextLink = response != null ? response.NextLink : null; if (response != null && response.Pipelines != null) { foreach (var pipeline in response.Pipelines) { pipelines.Add( new PSPipeline(pipeline) { ResourceGroupName = filterOptions.ResourceGroupName, DataFactoryName = filterOptions.DataFactoryName }); } } return(pipelines); }
public virtual List <PSPipeline> FilterPSPipelines(PipelineFilterOptions filterOptions) { if (filterOptions == null) { throw new ArgumentNullException("filterOptions"); } if (string.IsNullOrWhiteSpace(filterOptions.ResourceGroupName)) { throw new ArgumentException(Resources.ResourceGroupNameCannotBeEmpty); } List <PSPipeline> Pipelines = new List <PSPipeline>(); if (!string.IsNullOrWhiteSpace(filterOptions.Name)) { Pipelines.Add(GetPipeline(filterOptions.ResourceGroupName, filterOptions.DataFactoryName, filterOptions.Name)); } else { Pipelines.AddRange(ListPipelines(filterOptions)); } return(Pipelines); }
public virtual List<PSPipeline> ListPipelines(PipelineFilterOptions filterOptions) { List<PSPipeline> pipelines = new List<PSPipeline>(); PipelineListResponse response; if (filterOptions.NextLink.IsNextPageLink()) { response = DataPipelineManagementClient.Pipelines.ListNext(filterOptions.NextLink); } else { response = DataPipelineManagementClient.Pipelines.List(filterOptions.ResourceGroupName, filterOptions.DataFactoryName); } filterOptions.NextLink = response != null ? response.NextLink : null; if (response != null && response.Pipelines != null) { foreach (var pipeline in response.Pipelines) { pipelines.Add( new PSPipeline(pipeline) { ResourceGroupName = filterOptions.ResourceGroupName, DataFactoryName = filterOptions.DataFactoryName }); } } return pipelines; }
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); } } }
protected override void ProcessRecord() { // 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()); }
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()); }
public virtual List<PSPipeline> FilterPSPipelines(PipelineFilterOptions filterOptions) { if (filterOptions == null) { throw new ArgumentNullException("filterOptions"); } if (string.IsNullOrWhiteSpace(filterOptions.ResourceGroupName)) { throw new ArgumentException(Resources.ResourceGroupNameCannotBeEmpty); } List<PSPipeline> Pipelines = new List<PSPipeline>(); if (!string.IsNullOrWhiteSpace(filterOptions.Name)) { Pipelines.Add(GetPipeline(filterOptions.ResourceGroupName, filterOptions.DataFactoryName, filterOptions.Name)); } else { Pipelines.AddRange(ListPipelines(filterOptions.ResourceGroupName, filterOptions.DataFactoryName)); } return Pipelines; }