< Summary

Class:Azure.Analytics.Synapse.Artifacts.PipelineClient
Assembly:Azure.Analytics.Synapse.Artifacts
File(s):C:\Git\azure-sdk-for-net\sdk\synapse\Azure.Analytics.Synapse.Artifacts\src\Customization\PipelineClient.cs
C:\Git\azure-sdk-for-net\sdk\synapse\Azure.Analytics.Synapse.Artifacts\src\Generated\PipelineClient.cs
Covered lines:36
Uncovered lines:74
Coverable lines:110
Total lines:304
Line coverage:32.7% (36 of 110)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%100%
.ctor(...)-100%100%
.ctor(...)-0%100%
get_RestClient()-100%100%
.ctor(...)-100%100%
.ctor()-100%100%
.ctor(...)-100%100%
CreateOrUpdatePipelineAsync()-0%100%
CreateOrUpdatePipeline(...)-0%100%
GetPipelineAsync()-57.14%100%
GetPipeline(...)-57.14%100%
DeletePipelineAsync()-0%100%
DeletePipeline(...)-0%100%
CreatePipelineRunAsync()-0%100%
CreatePipelineRun(...)-0%100%
<GetPipelinesByWorkspaceAsync()-62.5%100%
<GetPipelinesByWorkspaceAsync()-0%100%
GetPipelinesByWorkspaceAsync(...)-100%100%
GetPipelinesByWorkspace(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\synapse\Azure.Analytics.Synapse.Artifacts\src\Customization\PipelineClient.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using Azure.Core;
 6using Azure.Core.Pipeline;
 7
 8namespace Azure.Analytics.Synapse.Artifacts
 9{
 10    public partial class PipelineClient
 11    {
 12        /// <summary>
 13        /// Initializes a new instance of the <see cref="PipelineClient"/>.
 14        /// </summary>
 15        public PipelineClient(Uri endpoint, TokenCredential credential)
 016            : this(endpoint, credential, ArtifactsClientOptions.Default)
 17        {
 018        }
 19
 20        /// <summary>
 21        /// Initializes a new instance of the <see cref="PipelineClient"/>.
 22        /// </summary>
 23        public PipelineClient(Uri endpoint, TokenCredential credential, ArtifactsClientOptions options)
 424            : this(new ClientDiagnostics(options),
 425                  SynapseClientPipeline.Build(options, credential),
 426                  endpoint.ToString(),
 427                  options.VersionString)
 28        {
 429        }
 30    }
 31}

C:\Git\azure-sdk-for-net\sdk\synapse\Azure.Analytics.Synapse.Artifacts\src\Generated\PipelineClient.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System;
 9using System.Collections.Generic;
 10using System.Threading;
 11using System.Threading.Tasks;
 12using Azure;
 13using Azure.Analytics.Synapse.Artifacts.Models;
 14using Azure.Core;
 15using Azure.Core.Pipeline;
 016
 17namespace Azure.Analytics.Synapse.Artifacts
 018{
 19    /// <summary> The Pipeline service client. </summary>
 20    public partial class PipelineClient
 21    {
 22        private readonly ClientDiagnostics _clientDiagnostics;
 23        private readonly HttpPipeline _pipeline;
 1224        internal PipelineRestClient RestClient { get; }
 425        /// <summary> Initializes a new instance of PipelineClient for mocking. </summary>
 1226        protected PipelineClient()
 427        {
 828        }
 429        /// <summary> Initializes a new instance of PipelineClient. </summary>
 30        /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param>
 31        /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param>
 32        /// <param name="endpoint"> The workspace development endpoint, for example https://myworkspace.dev.azuresynapse
 33        /// <param name="apiVersion"> Api Version. </param>
 834        internal PipelineClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, string apiV
 35        {
 836            RestClient = new PipelineRestClient(clientDiagnostics, pipeline, endpoint, apiVersion);
 837            _clientDiagnostics = clientDiagnostics;
 838            _pipeline = pipeline;
 839        }
 40
 41        /// <summary> Creates or updates a pipeline. </summary>
 42        /// <param name="pipelineName"> The pipeline name. </param>
 43        /// <param name="pipeline"> Pipeline resource definition. </param>
 44        /// <param name="ifMatch"> ETag of the pipeline entity.  Should only be specified for update, for which it shoul
 45        /// <param name="cancellationToken"> The cancellation token to use. </param>
 46        public virtual async Task<Response<PipelineResource>> CreateOrUpdatePipelineAsync(string pipelineName, PipelineR
 47        {
 048            using var scope = _clientDiagnostics.CreateScope("PipelineClient.CreateOrUpdatePipeline");
 049            scope.Start();
 50            try
 51            {
 052                return await RestClient.CreateOrUpdatePipelineAsync(pipelineName, pipeline, ifMatch, cancellationToken).
 53            }
 054            catch (Exception e)
 55            {
 056                scope.Failed(e);
 057                throw;
 58            }
 059        }
 60
 61        /// <summary> Creates or updates a pipeline. </summary>
 62        /// <param name="pipelineName"> The pipeline name. </param>
 63        /// <param name="pipeline"> Pipeline resource definition. </param>
 64        /// <param name="ifMatch"> ETag of the pipeline entity.  Should only be specified for update, for which it shoul
 65        /// <param name="cancellationToken"> The cancellation token to use. </param>
 66        public virtual Response<PipelineResource> CreateOrUpdatePipeline(string pipelineName, PipelineResource pipeline,
 67        {
 068            using var scope = _clientDiagnostics.CreateScope("PipelineClient.CreateOrUpdatePipeline");
 069            scope.Start();
 70            try
 71            {
 072                return RestClient.CreateOrUpdatePipeline(pipelineName, pipeline, ifMatch, cancellationToken);
 73            }
 074            catch (Exception e)
 75            {
 076                scope.Failed(e);
 077                throw;
 78            }
 079        }
 80
 81        /// <summary> Gets a pipeline. </summary>
 82        /// <param name="pipelineName"> The pipeline name. </param>
 83        /// <param name="ifNoneMatch"> ETag of the pipeline entity. Should only be specified for get. If the ETag matche
 84        /// <param name="cancellationToken"> The cancellation token to use. </param>
 85        public virtual async Task<Response<PipelineResource>> GetPipelineAsync(string pipelineName, string ifNoneMatch =
 86        {
 287            using var scope = _clientDiagnostics.CreateScope("PipelineClient.GetPipeline");
 288            scope.Start();
 89            try
 90            {
 291                return await RestClient.GetPipelineAsync(pipelineName, ifNoneMatch, cancellationToken).ConfigureAwait(fa
 92            }
 093            catch (Exception e)
 94            {
 095                scope.Failed(e);
 096                throw;
 97            }
 298        }
 99
 100        /// <summary> Gets a pipeline. </summary>
 101        /// <param name="pipelineName"> The pipeline name. </param>
 102        /// <param name="ifNoneMatch"> ETag of the pipeline entity. Should only be specified for get. If the ETag matche
 103        /// <param name="cancellationToken"> The cancellation token to use. </param>
 104        public virtual Response<PipelineResource> GetPipeline(string pipelineName, string ifNoneMatch = null, Cancellati
 105        {
 2106            using var scope = _clientDiagnostics.CreateScope("PipelineClient.GetPipeline");
 2107            scope.Start();
 108            try
 109            {
 2110                return RestClient.GetPipeline(pipelineName, ifNoneMatch, cancellationToken);
 111            }
 0112            catch (Exception e)
 113            {
 0114                scope.Failed(e);
 0115                throw;
 116            }
 2117        }
 118
 119        /// <summary> Deletes a pipeline. </summary>
 120        /// <param name="pipelineName"> The pipeline name. </param>
 121        /// <param name="cancellationToken"> The cancellation token to use. </param>
 122        public virtual async Task<Response> DeletePipelineAsync(string pipelineName, CancellationToken cancellationToken
 123        {
 0124            using var scope = _clientDiagnostics.CreateScope("PipelineClient.DeletePipeline");
 0125            scope.Start();
 126            try
 127            {
 0128                return await RestClient.DeletePipelineAsync(pipelineName, cancellationToken).ConfigureAwait(false);
 129            }
 0130            catch (Exception e)
 131            {
 0132                scope.Failed(e);
 0133                throw;
 134            }
 0135        }
 136
 137        /// <summary> Deletes a pipeline. </summary>
 138        /// <param name="pipelineName"> The pipeline name. </param>
 139        /// <param name="cancellationToken"> The cancellation token to use. </param>
 140        public virtual Response DeletePipeline(string pipelineName, CancellationToken cancellationToken = default)
 141        {
 0142            using var scope = _clientDiagnostics.CreateScope("PipelineClient.DeletePipeline");
 0143            scope.Start();
 144            try
 145            {
 0146                return RestClient.DeletePipeline(pipelineName, cancellationToken);
 147            }
 0148            catch (Exception e)
 149            {
 0150                scope.Failed(e);
 0151                throw;
 152            }
 0153        }
 154
 155        /// <summary> Creates a run of a pipeline. </summary>
 156        /// <param name="pipelineName"> The pipeline name. </param>
 157        /// <param name="referencePipelineRunId"> The pipeline run identifier. If run ID is specified the parameters of 
 158        /// <param name="isRecovery"> Recovery mode flag. If recovery mode is set to true, the specified referenced pipe
 159        /// <param name="startActivityName"> In recovery mode, the rerun will start from this activity. If not specified
 160        /// <param name="parameters"> Parameters of the pipeline run. These parameters will be used only if the runId is
 161        /// <param name="cancellationToken"> The cancellation token to use. </param>
 162        public virtual async Task<Response<CreateRunResponse>> CreatePipelineRunAsync(string pipelineName, string refere
 163        {
 0164            using var scope = _clientDiagnostics.CreateScope("PipelineClient.CreatePipelineRun");
 0165            scope.Start();
 166            try
 167            {
 0168                return await RestClient.CreatePipelineRunAsync(pipelineName, referencePipelineRunId, isRecovery, startAc
 169            }
 0170            catch (Exception e)
 171            {
 0172                scope.Failed(e);
 0173                throw;
 174            }
 0175        }
 176
 177        /// <summary> Creates a run of a pipeline. </summary>
 178        /// <param name="pipelineName"> The pipeline name. </param>
 179        /// <param name="referencePipelineRunId"> The pipeline run identifier. If run ID is specified the parameters of 
 180        /// <param name="isRecovery"> Recovery mode flag. If recovery mode is set to true, the specified referenced pipe
 181        /// <param name="startActivityName"> In recovery mode, the rerun will start from this activity. If not specified
 182        /// <param name="parameters"> Parameters of the pipeline run. These parameters will be used only if the runId is
 183        /// <param name="cancellationToken"> The cancellation token to use. </param>
 184        public virtual Response<CreateRunResponse> CreatePipelineRun(string pipelineName, string referencePipelineRunId 
 185        {
 0186            using var scope = _clientDiagnostics.CreateScope("PipelineClient.CreatePipelineRun");
 0187            scope.Start();
 188            try
 189            {
 0190                return RestClient.CreatePipelineRun(pipelineName, referencePipelineRunId, isRecovery, startActivityName,
 191            }
 0192            catch (Exception e)
 193            {
 0194                scope.Failed(e);
 0195                throw;
 196            }
 0197        }
 198
 199        /// <summary> Lists pipelines. </summary>
 200        /// <param name="cancellationToken"> The cancellation token to use. </param>
 201        public virtual AsyncPageable<PipelineResource> GetPipelinesByWorkspaceAsync(CancellationToken cancellationToken 
 202        {
 203            async Task<Page<PipelineResource>> FirstPageFunc(int? pageSizeHint)
 204            {
 2205                using var scope = _clientDiagnostics.CreateScope("PipelineClient.GetPipelinesByWorkspace");
 2206                scope.Start();
 207                try
 208                {
 2209                    var response = await RestClient.GetPipelinesByWorkspaceAsync(cancellationToken).ConfigureAwait(false
 2210                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 211                }
 0212                catch (Exception e)
 213                {
 0214                    scope.Failed(e);
 0215                    throw;
 216                }
 2217            }
 218            async Task<Page<PipelineResource>> NextPageFunc(string nextLink, int? pageSizeHint)
 219            {
 0220                using var scope = _clientDiagnostics.CreateScope("PipelineClient.GetPipelinesByWorkspace");
 0221                scope.Start();
 222                try
 223                {
 0224                    var response = await RestClient.GetPipelinesByWorkspaceNextPageAsync(nextLink, cancellationToken).Co
 0225                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 226                }
 0227                catch (Exception e)
 228                {
 0229                    scope.Failed(e);
 0230                    throw;
 231                }
 0232            }
 2233            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 234        }
 235
 236        /// <summary> Lists pipelines. </summary>
 237        /// <param name="cancellationToken"> The cancellation token to use. </param>
 238        public virtual Pageable<PipelineResource> GetPipelinesByWorkspace(CancellationToken cancellationToken = default)
 239        {
 240            Page<PipelineResource> FirstPageFunc(int? pageSizeHint)
 241            {
 2242                using var scope = _clientDiagnostics.CreateScope("PipelineClient.GetPipelinesByWorkspace");
 2243                scope.Start();
 244                try
 245                {
 2246                    var response = RestClient.GetPipelinesByWorkspace(cancellationToken);
 2247                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 248                }
 0249                catch (Exception e)
 250                {
 0251                    scope.Failed(e);
 0252                    throw;
 253                }
 2254            }
 255            Page<PipelineResource> NextPageFunc(string nextLink, int? pageSizeHint)
 256            {
 0257                using var scope = _clientDiagnostics.CreateScope("PipelineClient.GetPipelinesByWorkspace");
 0258                scope.Start();
 259                try
 260                {
 0261                    var response = RestClient.GetPipelinesByWorkspaceNextPage(nextLink, cancellationToken);
 0262                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 263                }
 0264                catch (Exception e)
 265                {
 0266                    scope.Failed(e);
 0267                    throw;
 268                }
 0269            }
 2270            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 271        }
 272    }
 273}