Пример #1
0
        public virtual List <PSDataFactory> FilterPSDataFactories(DataFactoryFilterOptions filterOptions)
        {
            if (filterOptions == null)
            {
                throw new ArgumentNullException("filterOptions");
            }
            var dataFactories = new List <PSDataFactory>();

            if (filterOptions.DataFactoryName != null && filterOptions.ResourceGroupName != null)
            {
                dataFactories.Add(GetDataFactory(filterOptions.ResourceGroupName, filterOptions.DataFactoryName));
            }
            else if (filterOptions.ResourceGroupName == null && filterOptions.DataFactoryName == null)
            {
                dataFactories.AddRange(ListDataFactoriesBySubscription(filterOptions));
            }
            else
            {
                if (filterOptions.ResourceGroupName == null && filterOptions.DataFactoryName != null)
                {
                    throw new Exception("ResourceGroupName name can't be null if factory name is not due to parameter sets. Should never reach this point");
                }
                dataFactories.AddRange(ListDataFactories(filterOptions));
            }
            return(dataFactories);
        }
Пример #2
0
        public virtual List <PSDataFactory> ListDataFactoriesBySubscription(DataFactoryFilterOptions filterOptions)
        {
            if (filterOptions == null)
            {
                throw new ArgumentNullException("filterOptions");
            }

            var             dataFactories = new List <PSDataFactory>();
            IPage <Factory> response;

            if (filterOptions.NextLink.IsNextPageLink())
            {
                response = this.DataFactoryManagementClient.Factories.ListNext(filterOptions.NextLink);
            }
            else
            {
                response = this.DataFactoryManagementClient.Factories.List();
            }
            filterOptions.NextLink = response != null ? response.NextPageLink : null;

            if (response != null)
            {
                dataFactories.AddRange(response.Select(df =>
                {
                    var parsedResourceId  = new ResourceIdentifier(df.Id);
                    var ResourceGroupName = parsedResourceId.ResourceGroupName;
                    return(new PSDataFactory(df, ResourceGroupName));
                }));
            }

            return(dataFactories);
        }
Пример #3
0
        public virtual List <PSDataFactory> ListDataFactories(DataFactoryFilterOptions filterOptions)
        {
            if (filterOptions == null)
            {
                throw new ArgumentNullException("filterOptions");
            }

            var dataFactories = new List <PSDataFactory>();

            IPage <Factory> response;

            if (filterOptions.NextLink.IsNextPageLink())
            {
                response = this.DataFactoryManagementClient.Factories.ListNext(filterOptions.NextLink);
            }
            else
            {
                response = this.DataFactoryManagementClient.Factories.ListByResourceGroup(filterOptions.ResourceGroupName);
            }
            filterOptions.NextLink = response != null ? response.NextPageLink : null;

            if (response != null)
            {
                dataFactories.AddRange(response.Select(df => new PSDataFactory(df, filterOptions.ResourceGroupName)));
            }

            return(dataFactories);
        }
        public override void ExecuteCmdlet()
        {
            var filterOptions = new DataFactoryFilterOptions();

            if (ParameterSetName.Equals(ParameterSetNames.ByFactoryName, StringComparison.OrdinalIgnoreCase))
            {
                filterOptions.DataFactoryName   = Name;
                filterOptions.ResourceGroupName = ResourceGroupName;
            }
            ;

            //List data factories until all pages are fetched
            do
            {
                WriteObject(DataFactoryClient.FilterPSDataFactories(filterOptions), true);
            } while (filterOptions.NextLink.IsNextPageLink());
        }
        public override void ExecuteCmdlet()
        {
            var filterOptions = new DataFactoryFilterOptions()
            {
                DataFactoryName   = Name,
                ResourceGroupName = ResourceGroupName
            };

            if (Name != null)
            {
                List <PSDataFactory> dataFactories = DataFactoryClient.FilterPSDataFactories(filterOptions);
                if (dataFactories != null && dataFactories.Any())
                {
                    WriteObject(dataFactories.First());
                }
                return;
            }

            //List data factories until all pages are fetched
            do
            {
                WriteObject(DataFactoryClient.FilterPSDataFactories(filterOptions), true);
            } while (filterOptions.NextLink.IsNextPageLink());
        }
        public virtual List <PSDataFactory> FilterPSDataFactories(DataFactoryFilterOptions filterOptions)
        {
            if (filterOptions == null)
            {
                throw new ArgumentNullException("filterOptions");
            }

            var dataFactories = new List <PSDataFactory>();

            if (filterOptions.DataFactoryName != null)
            {
                PSDataFactory dataFactory = GetDataFactory(filterOptions.ResourceGroupName, filterOptions.DataFactoryName);
                if (dataFactory != null)
                {
                    dataFactories.Add(dataFactory);
                }
            }
            else
            {
                dataFactories.AddRange(ListDataFactories(filterOptions));
            }

            return(dataFactories);
        }