public async Task PipelineSample() { #region Snippet:CreatePipelineClient // Replace the string below with your actual endpoint url. string endpoint = "<my-endpoint-url>"; /*@@*/ endpoint = TestEnvironment.EndpointUrl; PipelineClient client = new PipelineClient(endpoint: new Uri(endpoint), credential: new DefaultAzureCredential()); #endregion #region Snippet:CreatePipeline PipelineCreateOrUpdatePipelineOperation operation = client.StartCreateOrUpdatePipeline("MyPipeline", new PipelineResource()); Response <PipelineResource> createdPipeline = await operation.WaitForCompletionAsync(); #endregion #region Snippet:RetrievePipeline PipelineResource retrievedPipeline = client.GetPipeline("MyPipeline"); #endregion #region Snippet:ListPipelines Pageable <PipelineResource> pipelines = client.GetPipelinesByWorkspace(); foreach (PipelineResource pipeline in pipelines) { System.Console.WriteLine(pipeline.Name); } #endregion #region Snippet:DeletePipeline client.StartDeletePipeline("MyPipeline"); #endregion }
public override PipelineDescription ValidatePipeline(PipelineRequest request) { _logger.LogInformation("Validating SYN pipeline."); PipelineResource pipelineResource; try { pipelineResource = _pipelineClient.GetPipeline ( request.PipelineName ); _logger.LogInformation(pipelineResource.Id.ToString()); return(new PipelineDescription() { PipelineExists = "True", PipelineName = pipelineResource.Name, PipelineId = pipelineResource.Id, PipelineType = pipelineResource.Type, ActivityCount = pipelineResource.Activities.Count }); } catch (System.InvalidOperationException) //for bug in underlying activity classes, pipeline does exist { return(new PipelineDescription() { PipelineExists = "True", PipelineName = request.PipelineName, PipelineId = "Unknown", PipelineType = "Unknown", ActivityCount = 0 }); } catch (Azure.RequestFailedException) //expected exception when pipeline doesnt exist { return(new PipelineDescription() { PipelineExists = "False", PipelineName = request.PipelineName, PipelineId = "Unknown", PipelineType = "Unknown", ActivityCount = 0 }); } catch (Exception ex) //other unknown issue { _logger.LogInformation(ex.Message); _logger.LogInformation(ex.GetType().ToString()); throw new InvalidRequestException("Failed to validate pipeline. ", ex); } }
public async Task RunPipeline() { #region Snippet:CreatePipelineClientPrep #if SNIPPET // Replace the string below with your actual endpoint url. string endpoint = "<my-endpoint-url>"; #else string endpoint = TestEnvironment.EndpointUrl; #endif string pipelineName = "Test-Pipeline"; #endregion #region Snippet:CreatePipelineClient var client = new PipelineClient(endpoint: new Uri(endpoint), credential: new DefaultAzureCredential()); #endregion #region Snippet:CreatePipeline PipelineCreateOrUpdatePipelineOperation operation = client.StartCreateOrUpdatePipeline(pipelineName, new PipelineResource()); Response <PipelineResource> createdPipeline = await operation.WaitForCompletionAsync(); #endregion #region Snippet:RetrievePipeline PipelineResource retrievedPipeline = client.GetPipeline(pipelineName); Console.WriteLine("Pipeline ID: {0}", retrievedPipeline.Id); #endregion #region Snippet:RunPipeline Console.WriteLine("Running pipeline."); CreateRunResponse runOperation = await client.CreatePipelineRunAsync(pipelineName); Console.WriteLine("Run started. ID: {0}", runOperation.RunId); #endregion #region Snippet:ListPipelines Pageable <PipelineResource> pipelines = client.GetPipelinesByWorkspace(); foreach (PipelineResource pipeline in pipelines) { Console.WriteLine(pipeline.Name); } #endregion #region Snippet:DeletePipeline PipelineDeletePipelineOperation deleteOperation = client.StartDeletePipeline(pipelineName); await deleteOperation.WaitForCompletionResponseAsync(); #endregion }
public void RetrievePipeline() { #region Snippet:RetrievePipeline PipelineResource pipeline = PipelineClient.GetPipeline("MyPipeline"); #endregion }
public PipelineResource GetPipeline(string pipelineName) { return(_pipelineClient.GetPipeline(pipelineName).Value); }