private bool CheckDataFlowExists(string resourceGroupName, string dataFactoryName, string dataFlowName) { try { PSDataFlow dataFlow = this.GetDataFlow(resourceGroupName, dataFactoryName, dataFlowName); return(dataFlow != null); } catch (CloudException e) { //Get throws Exception message with NotFound Status if (e.Response.StatusCode == HttpStatusCode.NotFound) { return(false); } else { throw; } } }
public virtual PSDataFlow CreatePSDataFlow(CreatePSAdfEntityParameters parameters) { if (parameters == null) { throw new ArgumentNullException("parameters"); } PSDataFlow dataFlow = null; Action createDataFlow = () => { dataFlow = new PSDataFlow(this.CreateOrUpdateDataFlow( parameters.ResourceGroupName, parameters.DataFactoryName, parameters.Name, parameters.RawJsonContent), parameters.ResourceGroupName, parameters.DataFactoryName ); }; parameters.ConfirmAction( parameters.Force, // prompt only if the data flow exists string.Format( CultureInfo.InvariantCulture, Resources.DataFlowExists, parameters.Name, parameters.DataFactoryName), string.Format( CultureInfo.InvariantCulture, Resources.DataFlowCreating, parameters.Name, parameters.DataFactoryName), parameters.Name, createDataFlow, () => this.CheckDataFlowExists(parameters.ResourceGroupName, parameters.DataFactoryName, parameters.Name)); return(dataFlow); }