Microsoft.Azure.Commands.DataFactories.GetAzureDataFactoryHubCommand.ExecuteCmdlet C# (CSharp) Method

ExecuteCmdlet() private method

private ExecuteCmdlet ( ) : void
return void
        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;
            }

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

            if (Name != null)
            {
                List<PSHub> hubs = DataFactoryClient.FilterPSHubs(filterOptions);

                if (hubs != null && hubs.Any())
                {
                    WriteObject(hubs.First());
                }
                return;
            }

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