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; } string rawJsonContent = DataFactoryClient.ReadJsonFileContent(this.TryResolvePath(File)); Name = ResolveResourceName(rawJsonContent, Name, "Pipeline"); CreatePSPipelineParameters parameters = new CreatePSPipelineParameters() { ResourceGroupName = ResourceGroupName, DataFactoryName = DataFactoryName, Name = Name, RawJsonContent = rawJsonContent, Force = Force.IsPresent, ConfirmAction = ConfirmAction }; WriteObject(DataFactoryClient.CreatePSPipeline(parameters)); }
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; } var dataSlices = DataFactoryClient.ListDataSlices( ResourceGroupName, DataFactoryName, TableName, StartDateTime, EndDateTime); if (dataSlices == null || dataSlices.Count == 0) { WriteWarning(string.Format( CultureInfo.InvariantCulture, Resources.NoDataSliceFound)); } WriteObject(dataSlices, true); }
public override void ExecuteCmdlet() { // ValidationNotNullOrEmpty doesn't handle whitespaces well if (Name != null && string.IsNullOrWhiteSpace(Name)) { throw new PSArgumentNullException("Name"); } DataFactoryFilterOptions filterOptions = new DataFactoryFilterOptions() { Name = 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 override void ExecuteCmdlet() { if (ParameterSetName == ByFactoryObject) { if (DataFactory == null) { throw new PSArgumentNullException(string.Format(CultureInfo.InvariantCulture, Resources.DataFactoryArgumentInvalid)); } DataFactoryName = DataFactory.DataFactoryName; ResourceGroupName = DataFactory.ResourceGroupName; } string encryptedValue = String.Empty; if (String.IsNullOrWhiteSpace(GatewayName)) { // Cloud encryption without Gateway encryptedValue = DataFactoryClient.CloudEncryptString(Value, ResourceGroupName, DataFactoryName); } else { // On-premises encryption with Gateway encryptedValue = DataFactoryClient.OnPremisesEncryptString(Value, ResourceGroupName, DataFactoryName, GatewayName); } WriteObject(encryptedValue); }
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; } DateTime startTime = StartDateTime; DateTime endTime = EndDateTime; ConfirmAction( string.Format( CultureInfo.InvariantCulture, "Set pipeline '{0}' active period from '{1}' to '{2}'", PipelineName, startTime, endTime), PipelineName, () => DataFactoryClient.SetPipelineActivePeriod( ResourceGroupName, DataFactoryName, PipelineName, startTime, endTime, AutoResolve.ToBool(), ForceRecalculate.ToBool())); WriteObject(true); }
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; } string encryptedValue = String.Empty; if (String.IsNullOrWhiteSpace(GatewayName)) { // Cloud encryption without Gateway WriteWarning("Cloud encryption has already been deprecated. Please run get-help new-azuredatafactoryencryptvalue to see other option of this command"); } else { // On-premises encryption with Gateway encryptedValue = DataFactoryClient.OnPremisesEncryptString(Value, ResourceGroupName, DataFactoryName, GatewayName, Credential, Type, NonCredentialValue, AuthenticationType, Server, Database); } WriteObject(encryptedValue); }
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; } // Resolve the file path and read the raw content string rawJsonContent = DataFactoryClient.ReadJsonFileContent(this.TryResolvePath(File)); // Resolve any mismatch between -Name and the name written in JSON Name = ResolveResourceName(rawJsonContent, Name, "LinkedService"); CreatePSLinkedServiceParameters parameters = new CreatePSLinkedServiceParameters() { ResourceGroupName = ResourceGroupName, DataFactoryName = DataFactoryName, Name = Name, RawJsonContent = rawJsonContent, Force = Force.IsPresent, ConfirmAction = ConfirmAction }; WriteObject(DataFactoryClient.CreatePSLinkedService(parameters)); }
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; } DataSliceRunFilterOptions filterOptions = new DataSliceRunFilterOptions() { ResourceGroupName = ResourceGroupName, DataFactoryName = DataFactoryName, DatasetName = this.DatasetName, StartDateTime = StartDateTime }; int totalDataSliceRuns = 0; do { var dataSliceRuns = DataFactoryClient.ListDataSliceRuns(filterOptions); totalDataSliceRuns += dataSliceRuns.Count; WriteObject(dataSliceRuns, true); } while (filterOptions.NextLink.IsNextPageLink()); if (totalDataSliceRuns == 0) { WriteWarning(string.Format(CultureInfo.InvariantCulture, Resources.NoDataSliceFound)); } }
public override void ExecuteCmdlet() { // ValidationNotNullOrEmpty doesn't handle whitespaces well if (Name != null && string.IsNullOrWhiteSpace(Name)) { throw new PSArgumentNullException("Name"); } DataFactoryFilterOptions filterOptions = new DataFactoryFilterOptions() { Name = Name, ResourceGroupName = ResourceGroupName }; List <PSDataFactory> dataFactories = DataFactoryClient.FilterPSDataFactories(filterOptions); if (dataFactories != null) { if (dataFactories.Count == 1 && Name != null) { WriteObject(dataFactories[0]); } else { WriteObject(dataFactories, true); } } }
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; } ConfirmAction( Force.IsPresent, string.Format( CultureInfo.InvariantCulture, "Are you sure you want to suspend pipeline '{0}' in data factory '{1}'?", Name, DataFactoryName), string.Format( CultureInfo.InvariantCulture, "Suspending pipeline '{0}' in data factory '{1}'.", Name, DataFactoryName), Name, () => DataFactoryClient.SuspendPipeline(ResourceGroupName, DataFactoryName, Name)); WriteObject(true); }
protected override void ProcessRecord() { if (ParameterSetName == ByFactoryObject) { if (DataFactory == null) { throw new PSArgumentNullException(string.Format(CultureInfo.InvariantCulture, Resources.DataFactoryArgumentInvalid)); } DataFactoryName = DataFactory.DataFactoryName; ResourceGroupName = DataFactory.ResourceGroupName; } ConfirmAction( Force.IsPresent, string.Format( CultureInfo.InvariantCulture, "Are you sure you want to resume pipeline '{0}' in data factory '{1}'?", Name, DataFactoryName), string.Format( CultureInfo.InvariantCulture, "Resuming pipeline '{0}' in data factory '{1}'.", Name, DataFactoryName), Name, () => DataFactoryClient.ResumePipeline(ResourceGroupName, DataFactoryName, Name)); WriteObject(true); }
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; } ConfirmAction( Force.IsPresent, string.Format( CultureInfo.InvariantCulture, Resources.DataFactoryGatewayConfirmationMessage, Name, DataFactoryName), string.Format( CultureInfo.InvariantCulture, Resources.DataFactoryGatewayRemoving, Name, DataFactoryName), Name, () => DataFactoryClient.DeleteGateway(ResourceGroupName, DataFactoryName, Name)); WriteObject(true); }
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); } } }
private void ExecuteDelete() { HttpStatusCode response = DataFactoryClient.DeleteTable(ResourceGroupName, DataFactoryName, Name); if (response == HttpStatusCode.NoContent) { WriteWarning(string.Format(CultureInfo.InvariantCulture, Resources.TableNotFound, Name, DataFactoryName)); } }
public override void ExecuteCmdlet() { if (ParameterSetName == ByFactoryObject) { DataFactoryName = InputObject.DataFactoryName; ResourceGroupName = InputObject.ResourceGroupName; } PSDataFactoryGatewayAuthKey authKey = DataFactoryClient.ListGatewayAuthKeys(ResourceGroupName, DataFactoryName, GatewayName); WriteObject(authKey); }
protected override void ProcessRecord() { CreatePSDataFactoryParameters parameters = new CreatePSDataFactoryParameters() { ResourceGroupName = ResourceGroupName, DataFactoryName = Name, Location = Location, Tags = Tags, Force = Force.IsPresent, ConfirmAction = ConfirmAction }; WriteObject(DataFactoryClient.CreatePSDataFactory(parameters)); }
public override void ExecuteCmdlet() { CreatePSDataFactoryParameters parameters = new CreatePSDataFactoryParameters() { ResourceGroupName = ResourceGroupName, DataFactoryName = Name, Location = Location, Tags = Tag, Force = Force.IsPresent, ConfirmAction = ConfirmAction }; WriteObject(DataFactoryClient.CreatePSDataFactory(parameters)); }
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; } PSRunLogInfo runLog = DataFactoryClient.GetDataSliceRunLogsSharedAccessSignature( ResourceGroupName, DataFactoryName, Id); if (DownloadLogs.IsPresent) { string directory = string.IsNullOrWhiteSpace(Output) ? Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) : Output; if (!HaveWriteAccess(directory)) { throw new IOException(string.Format(CultureInfo.InvariantCulture, Resources.NoWriteAccessToDirectory, directory)); } try { DataFactoryClient.DownloadFileToBlob(new BlobDownloadParameters() { Directory = directory, SasUri = new Uri(runLog.SasUri), Credentials = new StorageCredentials(runLog.SasToken) }); } catch { throw new Exception(string.Format(CultureInfo.InvariantCulture, Resources.DownloadFailed, directory)); } WriteWarning(string.Format(CultureInfo.InvariantCulture, Resources.DownloadLogCompleted, directory)); } WriteObject(runLog); }
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; } PSDataFactoryGatewayKey gatewayKey = DataFactoryClient.RegenerateGatewayKey(ResourceGroupName, DataFactoryName, GatewayName); WriteObject(gatewayKey); }
public override void ExecuteCmdlet() { WriteWarning("This cmdlet is deprecated and you should use New-AzDataFactoryGatewayAuthKey instead."); if (ParameterSetName == ByFactoryObject) { if (DataFactory == null) { throw new PSArgumentNullException(string.Format(CultureInfo.InvariantCulture, Resources.DataFactoryArgumentInvalid)); } DataFactoryName = DataFactory.DataFactoryName; ResourceGroupName = DataFactory.ResourceGroupName; } PSDataFactoryGatewayKey gatewayKey = DataFactoryClient.RegenerateGatewayKey(ResourceGroupName, DataFactoryName, GatewayName); WriteObject(gatewayKey); }
public override void ExecuteCmdlet() { if (this.ParameterSetName == ByFactoryObject) { if (this.DataFactory == null) { throw new PSArgumentNullException(string.Format(CultureInfo.InvariantCulture, Resources.DataFactoryArgumentInvalid)); } this.DataFactoryName = DataFactory.DataFactoryName; this.ResourceGroupName = DataFactory.ResourceGroupName; } ActivityWindowFilterOptions filterOptions = new ActivityWindowFilterOptions() { ResourceGroupName = this.ResourceGroupName, DataFactoryName = this.DataFactoryName, ActivityName = this.ActivityName, DatasetName = this.DatasetName, PipelineName = this.PipelineName, Filter = Filter, OrderBy = this.OrderBy, RunEnd = this.RunEnd, RunStart = this.RunStart, Top = this.Top, WindowEnd = this.WindowEnd, WindowStart = this.WindowStart, WindowState = this.WindowState, WindowSubstate = this.WindowSubstate }; try { do { List <PSActivityWindow> activityWindows = DataFactoryClient.ProcessListFilterActivityWindows(filterOptions); WriteObject(activityWindows, true); } while (filterOptions.NextLink.IsNextPageLink()); } catch (PSArgumentException e) { WriteWarning(e.Message); } }
public override void ExecuteCmdlet() { if (ParameterSetName == ByFactoryObject) { DataFactoryName = InputObject.DataFactoryName; ResourceGroupName = InputObject.ResourceGroupName; } NewDataFactoryGatewayAuthKeyParameters param = new NewDataFactoryGatewayAuthKeyParameters() { KeyName = KeyName }; if (ShouldProcess(this.DataFactoryName, "New Data Factory Gateway Auth Key")) { PSDataFactoryGatewayAuthKey gatewayKey = DataFactoryClient.RegenerateGatewayAuthKey(ResourceGroupName, DataFactoryName, GatewayName, param); WriteObject(gatewayKey); } }
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; } PSDataFactoryGateway gateway = null; try { gateway = DataFactoryClient.GetGateway(ResourceGroupName, DataFactoryName, Name); } catch (CloudException ex) { if (ex.Response.StatusCode != HttpStatusCode.NotFound) { throw; } } if (gateway != null) { throw new PSInvalidOperationException(string.Format(CultureInfo.InvariantCulture, Resources.DataFactoryGatewayExists, Name, DataFactoryName)); } var request = new PSDataFactoryGateway { Name = Name, Location = NormalizeLocation(Location), Description = Description }; PSDataFactoryGateway response = DataFactoryClient.CreateOrUpdateGateway(ResourceGroupName, DataFactoryName, request); WriteObject(response); }
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; } LinkedServiceFilterOptions filterOptions = new LinkedServiceFilterOptions() { 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() { // 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()); }
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 }; List <PSHub> hubs = DataFactoryClient.FilterPSHubs(filterOptions); if (hubs != null) { if (hubs.Count == 1 && Name != null) { WriteObject(hubs[0]); } else { WriteObject(hubs, true); } } }
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; } string encryptedValue = String.Empty; // On-premises encryption with Gateway encryptedValue = DataFactoryClient.OnPremisesEncryptString(Value, ResourceGroupName, DataFactoryName, GatewayName, Credential, Type, NonCredentialValue, AuthenticationType, Server, Database); WriteObject(encryptedValue); }
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; } PSDataFactoryGateway gateway = new PSDataFactoryGateway { Description = Description, Name = Name }; PSDataFactoryGateway response = DataFactoryClient.PatchGateway(ResourceGroupName, DataFactoryName, gateway); WriteObject(response); }
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; } DataFactoryClient.SetSliceStatus( ResourceGroupName, DataFactoryName, this.DatasetName, Status, UpdateType, StartDateTime, EndDateTime); WriteObject(true); }
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; } if (String.IsNullOrWhiteSpace(Name)) { IEnumerable <PSDataFactoryGateway> gateways = DataFactoryClient.ListGateways(ResourceGroupName, DataFactoryName); WriteObject(gateways, true); } else { PSDataFactoryGateway gateway = DataFactoryClient.GetGateway(ResourceGroupName, DataFactoryName, Name); WriteObject(gateway); } }