public override void ExecuteCmdlet() { ByResourceId(); ByFactoryObject(); var filterOptions = new AdfEntityFilterOptions() { Name = Name, ResourceGroupName = ResourceGroupName, DataFactoryName = DataFactoryName }; if (Name != null) { List <PSDataset> datasets = DataFactoryClient.FilterPSDatasets(filterOptions); if (datasets != null && datasets.Any()) { WriteObject(datasets[0]); } return; } // List datasets until all pages are fetched do { WriteObject(DataFactoryClient.FilterPSDatasets(filterOptions), true); } while (filterOptions.NextLink.IsNextPageLink()); }
public virtual List <PSLinkedService> ListLinkedServices(AdfEntityFilterOptions filterOptions) { var linkedServices = new List <PSLinkedService>(); IPage <LinkedServiceResource> response; if (filterOptions.NextLink.IsNextPageLink()) { response = this.DataFactoryManagementClient.LinkedServices.ListByFactoryNext(filterOptions.NextLink); } else { response = this.DataFactoryManagementClient.LinkedServices.ListByFactory(filterOptions.ResourceGroupName, filterOptions.DataFactoryName); } filterOptions.NextLink = response != null ? response.NextPageLink : null; if (response != null) { linkedServices.AddRange(response.ToList().Select(linkedService => new PSLinkedService(linkedService, filterOptions.ResourceGroupName, filterOptions.DataFactoryName))); } return(linkedServices); }
private List <PSTrigger> ListTriggers(AdfEntityFilterOptions filterOptions) { var triggers = new List <PSTrigger>(); IPage <TriggerResource> response; if (filterOptions.NextLink.IsNextPageLink()) { response = this.DataFactoryManagementClient.Triggers.ListByFactoryNext(filterOptions.NextLink); } else { response = this.DataFactoryManagementClient.Triggers.ListByFactory(filterOptions.ResourceGroupName, filterOptions.DataFactoryName); } filterOptions.NextLink = response != null ? response.NextPageLink : null; if (response != null) { triggers.AddRange(response.ToList().Select(trigger => new PSTrigger(trigger, filterOptions.ResourceGroupName, filterOptions.DataFactoryName))); } return(triggers); }
public override void ExecuteCmdlet() { if (ParameterSetName.Equals(ParameterSetNames.ByFactoryObject, StringComparison.OrdinalIgnoreCase)) { DataFactoryName = DataFactory.DataFactoryName; ResourceGroupName = DataFactory.ResourceGroupName; } AdfEntityFilterOptions filterOptions = new AdfEntityFilterOptions() { Name = Name, ResourceGroupName = ResourceGroupName, DataFactoryName = DataFactoryName }; if (Name != null) { List <PSTrigger> triggers = DataFactoryClient.FilterPSTriggers(filterOptions); if (triggers != null && triggers.Any()) { WriteObject(triggers.First()); } return; } // List triggers until all pages are fetched. do { WriteObject(DataFactoryClient.FilterPSTriggers(filterOptions), true); } while (filterOptions.NextLink.IsNextPageLink()); }
public override void ExecuteCmdlet() { ByResourceId(); ByFactoryObject(); AdfEntityFilterOptions filterOptions = new AdfEntityFilterOptions() { Name = Name, ResourceGroupName = ResourceGroupName, DataFactoryName = DataFactoryName }; if (Name != null) { List <PSLinkedService> linkedServices = DataFactoryClient.FilterPSLinkedServices(filterOptions); if (linkedServices != null && linkedServices.Any()) { WriteObject(linkedServices[0]); } return; } // List all linked services until all pages are fetched. do { WriteObject(DataFactoryClient.FilterPSLinkedServices(filterOptions), true); } while (filterOptions.NextLink.IsNextPageLink()); }
public override void ExecuteCmdlet() { ByResourceId(); ByFactoryObject(); AdfEntityFilterOptions filterOptions = new AdfEntityFilterOptions() { Name = Name, ResourceGroupName = ResourceGroupName, DataFactoryName = DataFactoryName }; if (Name != null) { List <PSTrigger> triggers = DataFactoryClient.FilterPSTriggers(filterOptions); if (triggers != null && triggers.Any()) { WriteObject(triggers.First()); } return; } // List triggers until all pages are fetched. do { WriteObject(DataFactoryClient.FilterPSTriggers(filterOptions), true); } while (filterOptions.NextLink.IsNextPageLink()); }
public virtual List <PSTrigger> FilterPSTriggers(AdfEntityFilterOptions filterOptions) { if (filterOptions == null) { throw new ArgumentNullException("filterOptions"); } var triggers = new List <PSTrigger>(); if (filterOptions.Name != null) { triggers.Add(GetTrigger(filterOptions.ResourceGroupName, filterOptions.DataFactoryName, filterOptions.Name)); } else { triggers.AddRange(ListTriggers(filterOptions)); } return(triggers); }
public virtual List <PSDataset> FilterPSDatasets(AdfEntityFilterOptions filterOptions) { if (filterOptions == null) { throw new ArgumentNullException("filterOptions"); } List <PSDataset> datasets = new List <PSDataset>(); if (filterOptions.Name != null) { datasets.Add(this.GetDataset(filterOptions.ResourceGroupName, filterOptions.DataFactoryName, filterOptions.Name)); } else { datasets.AddRange(this.ListDatasets(filterOptions)); } return(datasets); }
public virtual List <PSLinkedService> FilterPSLinkedServices(AdfEntityFilterOptions filterOptions) { if (filterOptions == null) { throw new ArgumentNullException("filterOptions"); } var linkedServices = new List <PSLinkedService>(); if (filterOptions.Name != null) { linkedServices.Add(GetLinkedService(filterOptions.ResourceGroupName, filterOptions.DataFactoryName, filterOptions.Name)); } else { linkedServices.AddRange(ListLinkedServices(filterOptions)); } return(linkedServices); }
public virtual List <PSDataset> ListDatasets(AdfEntityFilterOptions filterOptions) { List <PSDataset> datasets = new List <PSDataset>(); IPage <DatasetResource> response; if (filterOptions.NextLink.IsNextPageLink()) { response = this.DataFactoryManagementClient.Datasets.ListByFactoryNext(filterOptions.NextLink); } else { response = this.DataFactoryManagementClient.Datasets.ListByFactory(filterOptions.ResourceGroupName, filterOptions.DataFactoryName); } filterOptions.NextLink = response != null ? response.NextPageLink : null; if (response != null && response.ToList().Count > 0) { datasets.AddRange(response.ToList().Select(dataset => new PSDataset(dataset, filterOptions.ResourceGroupName, filterOptions.DataFactoryName))); } return(datasets); }
public virtual async Task <List <PSIntegrationRuntime> > ListIntegrationRuntimesAsync(AdfEntityFilterOptions filterOptions) { var integrationRuntimes = new List <PSIntegrationRuntime>(); IPage <IntegrationRuntimeResource> response; if (filterOptions.NextLink.IsNextPageLink()) { response = await this.DataFactoryManagementClient.IntegrationRuntimes.ListByFactoryNextAsync(filterOptions.NextLink); } else { response = await this.DataFactoryManagementClient.IntegrationRuntimes.ListByFactoryAsync( filterOptions.ResourceGroupName, filterOptions.DataFactoryName); } filterOptions.NextLink = response?.NextPageLink; if (response == null) { return(integrationRuntimes); } foreach (var integrationRuntime in response.ToList()) { var managed = integrationRuntime.Properties as ManagedIntegrationRuntime; if (managed != null) { integrationRuntimes.Add(new PSManagedIntegrationRuntime( integrationRuntime, filterOptions.ResourceGroupName, filterOptions.DataFactoryName)); } else { var selfHosted = integrationRuntime.Properties as SelfHostedIntegrationRuntime; if (selfHosted != null) { integrationRuntimes.Add(new PSSelfHostedIntegrationRuntime( integrationRuntime, filterOptions.ResourceGroupName, filterOptions.DataFactoryName)); } else { integrationRuntimes.Add(new PSIntegrationRuntime( integrationRuntime, filterOptions.ResourceGroupName, filterOptions.DataFactoryName)); } } } return(integrationRuntimes); }