Example #1
0
 public void CreatePipeline()
 {
     #region Snippet:CreatePipeline
     PipelineCreateOrUpdatePipelineOperation operation = PipelineClient.StartCreateOrUpdatePipeline("MyPipeline", new PipelineResource());
     PipelineResource pipeline = operation.WaitForCompletionAsync().ConfigureAwait(true).GetAwaiter().GetResult();
     #endregion
 }
        public PipelineResource CreateOrUpdatePipeline(string pipelineName, string rawJsonContent)
        {
            PipelineResource pipeline = JsonConvert.DeserializeObject <PipelineResource>(rawJsonContent);
            var operation             = _pipelineClient.StartCreateOrUpdatePipeline(pipelineName, pipeline);

            return(operation.Poll().Value);
        }
Example #3
0
        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 PipelineResource CreateOrUpdatePipeline(string pipelineName, string rawJsonContent)
        {
            PSPipelineResource psPipeline = JsonConvert.DeserializeObject <PSPipelineResource>(rawJsonContent, Settings);
            PipelineResource   pipeline   = psPipeline.ToSdkObject();
            var operation = _pipelineClient.StartCreateOrUpdatePipeline(pipelineName, pipeline);

            while (!operation.HasValue)
            {
                operation.UpdateStatus();
            }
            return(operation.Value);
        }
Example #5
0
        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
        }