Пример #1
0
        public virtual List <PSTable> FilterPSTables(TableFilterOptions filterOptions)
        {
            if (filterOptions == null)
            {
                throw new ArgumentNullException("filterOptions");
            }

            if (string.IsNullOrWhiteSpace(filterOptions.ResourceGroupName))
            {
                throw new ArgumentException(Resources.ResourceGroupNameCannotBeEmpty);
            }

            List <PSTable> tables = new List <PSTable>();

            if (!string.IsNullOrWhiteSpace(filterOptions.Name))
            {
                tables.Add(GetTable(filterOptions.ResourceGroupName, filterOptions.DataFactoryName, filterOptions.Name));
            }
            else
            {
                tables.AddRange(ListTables(filterOptions));
            }

            return(tables);
        }
Пример #2
0
        public virtual List <PSTable> ListTables(TableFilterOptions filterOptions)
        {
            List <PSTable> tables = new List <PSTable>();

            TableListResponse response;

            if (filterOptions.NextLink.IsNextPageLink())
            {
                response = DataPipelineManagementClient.Tables.ListNext(filterOptions.NextLink);
            }
            else
            {
                response = DataPipelineManagementClient.Tables.List(filterOptions.ResourceGroupName, filterOptions.DataFactoryName);
            }
            filterOptions.NextLink = response != null ? response.NextLink : null;

            if (response != null && response.Tables != null)
            {
                foreach (var table in response.Tables)
                {
                    tables.Add(
                        new PSTable(table)
                    {
                        ResourceGroupName = filterOptions.ResourceGroupName,
                        DataFactoryName   = filterOptions.DataFactoryName
                    });
                }
            }

            return(tables);
        }
        public virtual List<PSTable> FilterPSTables(TableFilterOptions filterOptions)
        {
            if (filterOptions == null)
            {
                throw new ArgumentNullException("filterOptions");
            }

            if (string.IsNullOrWhiteSpace(filterOptions.ResourceGroupName))
            {
                throw new ArgumentException(Resources.ResourceGroupNameCannotBeEmpty);
            }

            List<PSTable> tables = new List<PSTable>();

            if (!string.IsNullOrWhiteSpace(filterOptions.Name))
            {
                tables.Add(GetTable(filterOptions.ResourceGroupName, filterOptions.DataFactoryName, filterOptions.Name));
            }
            else
            {
                tables.AddRange(ListTables(filterOptions.ResourceGroupName, filterOptions.DataFactoryName));
            }

            return tables;
        }
        public virtual List<PSTable> ListTables(TableFilterOptions filterOptions)
        {
            List<PSTable> tables = new List<PSTable>();

            TableListResponse response;
            if (filterOptions.NextLink.IsNextPageLink())
            {
                response = DataPipelineManagementClient.Tables.ListNext(filterOptions.NextLink);
            }
            else
            {
                response = DataPipelineManagementClient.Tables.List(filterOptions.ResourceGroupName, filterOptions.DataFactoryName);
            }
            filterOptions.NextLink = response != null ? response.NextLink : null;

            if (response != null && response.Tables != null)
            {
                foreach (var table in response.Tables)
                {
                    tables.Add(
                        new PSTable(table)
                        {
                            ResourceGroupName = filterOptions.ResourceGroupName,
                            DataFactoryName = filterOptions.DataFactoryName
                        });
                }
            }

            return tables;
        }
Пример #5
0
        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;
            }

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

            if (Name != null)
            {
                List <PSTable> tables = DataFactoryClient.FilterPSTables(filterOptions);
                if (tables != null && tables.Any())
                {
                    WriteObject(tables[0]);
                }
                return;
            }

            // List tables until all pages are fetched
            do
            {
                WriteObject(DataFactoryClient.FilterPSTables(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;
            }

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

            List<PSTable> tables = DataFactoryClient.FilterPSTables(filterOptions);

            if (tables != null)
            {
                if (tables.Count == 1 && Name != null)
                {
                    WriteObject(tables[0]);
                }
                else
                {
                    WriteObject(tables, true);
                }
            }
        }
Пример #7
0
        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;
            }

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

            List <PSTable> tables = DataFactoryClient.FilterPSTables(filterOptions);

            if (tables != null)
            {
                if (tables.Count == 1 && Name != null)
                {
                    WriteObject(tables[0]);
                }
                else
                {
                    WriteObject(tables, true);
                }
            }
        }