< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%100%
.ctor(...)-0%100%
.ctor(...)-0%100%
get_RestClient()-0%100%
.ctor(...)-0%100%
.ctor()-0%100%
.ctor(...)-0%100%
CreateOrUpdateLinkedServiceAsync()-0%100%
CreateOrUpdateLinkedService(...)-0%100%
GetLinkedServiceAsync()-0%100%
GetLinkedService(...)-0%100%
DeleteLinkedServiceAsync()-0%100%
DeleteLinkedService(...)-0%100%
<GetLinkedServicesByWorkspaceAsync()-0%100%
<GetLinkedServicesByWorkspaceAsync()-0%100%
GetLinkedServicesByWorkspaceAsync(...)-0%100%
GetLinkedServicesByWorkspace(...)-0%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\synapse\Azure.Analytics.Synapse.Artifacts\src\Customization\LinkedServiceClient.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 LinkedServiceClient
 11    {
 12        /// <summary>
 13        /// Initializes a new instance of the <see cref="LinkedServiceClient"/>.
 14        /// </summary>
 15        public LinkedServiceClient(Uri endpoint, TokenCredential credential)
 016            : this(endpoint, credential, ArtifactsClientOptions.Default)
 17        {
 018        }
 19
 20        /// <summary>
 21        /// Initializes a new instance of the <see cref="LinkedServiceClient"/>.
 22        /// </summary>
 23        public LinkedServiceClient(Uri endpoint, TokenCredential credential, ArtifactsClientOptions options)
 024            : this(new ClientDiagnostics(options),
 025                  SynapseClientPipeline.Build(options, credential),
 026                  endpoint.ToString(),
 027                  options.VersionString)
 28        {
 029        }
 30    }
 31}

C:\Git\azure-sdk-for-net\sdk\synapse\Azure.Analytics.Synapse.Artifacts\src\Generated\LinkedServiceClient.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.Threading;
 10using System.Threading.Tasks;
 11using Azure;
 12using Azure.Analytics.Synapse.Artifacts.Models;
 13using Azure.Core;
 14using Azure.Core.Pipeline;
 15
 016namespace Azure.Analytics.Synapse.Artifacts
 17{
 018    /// <summary> The LinkedService service client. </summary>
 19    public partial class LinkedServiceClient
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 023        internal LinkedServiceRestClient RestClient { get; }
 024        /// <summary> Initializes a new instance of LinkedServiceClient for mocking. </summary>
 025        protected LinkedServiceClient()
 026        {
 027        }
 28        /// <summary> Initializes a new instance of LinkedServiceClient. </summary>
 029        /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param>
 30        /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param>
 31        /// <param name="endpoint"> The workspace development endpoint, for example https://myworkspace.dev.azuresynapse
 32        /// <param name="apiVersion"> Api Version. </param>
 033        internal LinkedServiceClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, string
 34        {
 035            RestClient = new LinkedServiceRestClient(clientDiagnostics, pipeline, endpoint, apiVersion);
 036            _clientDiagnostics = clientDiagnostics;
 037            _pipeline = pipeline;
 038        }
 39
 40        /// <summary> Creates or updates a linked service. </summary>
 41        /// <param name="linkedServiceName"> The linked service name. </param>
 42        /// <param name="linkedService"> Linked service resource definition. </param>
 43        /// <param name="ifMatch"> ETag of the linkedService entity.  Should only be specified for update, for which it 
 44        /// <param name="cancellationToken"> The cancellation token to use. </param>
 45        public virtual async Task<Response<LinkedServiceResource>> CreateOrUpdateLinkedServiceAsync(string linkedService
 46        {
 047            using var scope = _clientDiagnostics.CreateScope("LinkedServiceClient.CreateOrUpdateLinkedService");
 048            scope.Start();
 49            try
 50            {
 051                return await RestClient.CreateOrUpdateLinkedServiceAsync(linkedServiceName, linkedService, ifMatch, canc
 52            }
 053            catch (Exception e)
 54            {
 055                scope.Failed(e);
 056                throw;
 57            }
 058        }
 59
 60        /// <summary> Creates or updates a linked service. </summary>
 61        /// <param name="linkedServiceName"> The linked service name. </param>
 62        /// <param name="linkedService"> Linked service resource definition. </param>
 63        /// <param name="ifMatch"> ETag of the linkedService entity.  Should only be specified for update, for which it 
 64        /// <param name="cancellationToken"> The cancellation token to use. </param>
 65        public virtual Response<LinkedServiceResource> CreateOrUpdateLinkedService(string linkedServiceName, LinkedServi
 66        {
 067            using var scope = _clientDiagnostics.CreateScope("LinkedServiceClient.CreateOrUpdateLinkedService");
 068            scope.Start();
 69            try
 70            {
 071                return RestClient.CreateOrUpdateLinkedService(linkedServiceName, linkedService, ifMatch, cancellationTok
 72            }
 073            catch (Exception e)
 74            {
 075                scope.Failed(e);
 076                throw;
 77            }
 078        }
 79
 80        /// <summary> Gets a linked service. </summary>
 81        /// <param name="linkedServiceName"> The linked service name. </param>
 82        /// <param name="ifNoneMatch"> ETag of the linked service entity. Should only be specified for get. If the ETag 
 83        /// <param name="cancellationToken"> The cancellation token to use. </param>
 84        public virtual async Task<Response<LinkedServiceResource>> GetLinkedServiceAsync(string linkedServiceName, strin
 85        {
 086            using var scope = _clientDiagnostics.CreateScope("LinkedServiceClient.GetLinkedService");
 087            scope.Start();
 88            try
 89            {
 090                return await RestClient.GetLinkedServiceAsync(linkedServiceName, ifNoneMatch, cancellationToken).Configu
 91            }
 092            catch (Exception e)
 93            {
 094                scope.Failed(e);
 095                throw;
 96            }
 097        }
 98
 99        /// <summary> Gets a linked service. </summary>
 100        /// <param name="linkedServiceName"> The linked service name. </param>
 101        /// <param name="ifNoneMatch"> ETag of the linked service entity. Should only be specified for get. If the ETag 
 102        /// <param name="cancellationToken"> The cancellation token to use. </param>
 103        public virtual Response<LinkedServiceResource> GetLinkedService(string linkedServiceName, string ifNoneMatch = n
 104        {
 0105            using var scope = _clientDiagnostics.CreateScope("LinkedServiceClient.GetLinkedService");
 0106            scope.Start();
 107            try
 108            {
 0109                return RestClient.GetLinkedService(linkedServiceName, ifNoneMatch, cancellationToken);
 110            }
 0111            catch (Exception e)
 112            {
 0113                scope.Failed(e);
 0114                throw;
 115            }
 0116        }
 117
 118        /// <summary> Deletes a linked service. </summary>
 119        /// <param name="linkedServiceName"> The linked service name. </param>
 120        /// <param name="cancellationToken"> The cancellation token to use. </param>
 121        public virtual async Task<Response> DeleteLinkedServiceAsync(string linkedServiceName, CancellationToken cancell
 122        {
 0123            using var scope = _clientDiagnostics.CreateScope("LinkedServiceClient.DeleteLinkedService");
 0124            scope.Start();
 125            try
 126            {
 0127                return await RestClient.DeleteLinkedServiceAsync(linkedServiceName, cancellationToken).ConfigureAwait(fa
 128            }
 0129            catch (Exception e)
 130            {
 0131                scope.Failed(e);
 0132                throw;
 133            }
 0134        }
 135
 136        /// <summary> Deletes a linked service. </summary>
 137        /// <param name="linkedServiceName"> The linked service name. </param>
 138        /// <param name="cancellationToken"> The cancellation token to use. </param>
 139        public virtual Response DeleteLinkedService(string linkedServiceName, CancellationToken cancellationToken = defa
 140        {
 0141            using var scope = _clientDiagnostics.CreateScope("LinkedServiceClient.DeleteLinkedService");
 0142            scope.Start();
 143            try
 144            {
 0145                return RestClient.DeleteLinkedService(linkedServiceName, cancellationToken);
 146            }
 0147            catch (Exception e)
 148            {
 0149                scope.Failed(e);
 0150                throw;
 151            }
 0152        }
 153
 154        /// <summary> Lists linked services. </summary>
 155        /// <param name="cancellationToken"> The cancellation token to use. </param>
 156        public virtual AsyncPageable<LinkedServiceResource> GetLinkedServicesByWorkspaceAsync(CancellationToken cancella
 157        {
 158            async Task<Page<LinkedServiceResource>> FirstPageFunc(int? pageSizeHint)
 159            {
 0160                using var scope = _clientDiagnostics.CreateScope("LinkedServiceClient.GetLinkedServicesByWorkspace");
 0161                scope.Start();
 162                try
 163                {
 0164                    var response = await RestClient.GetLinkedServicesByWorkspaceAsync(cancellationToken).ConfigureAwait(
 0165                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 166                }
 0167                catch (Exception e)
 168                {
 0169                    scope.Failed(e);
 0170                    throw;
 171                }
 0172            }
 173            async Task<Page<LinkedServiceResource>> NextPageFunc(string nextLink, int? pageSizeHint)
 174            {
 0175                using var scope = _clientDiagnostics.CreateScope("LinkedServiceClient.GetLinkedServicesByWorkspace");
 0176                scope.Start();
 177                try
 178                {
 0179                    var response = await RestClient.GetLinkedServicesByWorkspaceNextPageAsync(nextLink, cancellationToke
 0180                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 181                }
 0182                catch (Exception e)
 183                {
 0184                    scope.Failed(e);
 0185                    throw;
 186                }
 0187            }
 0188            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 189        }
 190
 191        /// <summary> Lists linked services. </summary>
 192        /// <param name="cancellationToken"> The cancellation token to use. </param>
 193        public virtual Pageable<LinkedServiceResource> GetLinkedServicesByWorkspace(CancellationToken cancellationToken 
 194        {
 195            Page<LinkedServiceResource> FirstPageFunc(int? pageSizeHint)
 196            {
 0197                using var scope = _clientDiagnostics.CreateScope("LinkedServiceClient.GetLinkedServicesByWorkspace");
 0198                scope.Start();
 199                try
 200                {
 0201                    var response = RestClient.GetLinkedServicesByWorkspace(cancellationToken);
 0202                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 203                }
 0204                catch (Exception e)
 205                {
 0206                    scope.Failed(e);
 0207                    throw;
 208                }
 0209            }
 210            Page<LinkedServiceResource> NextPageFunc(string nextLink, int? pageSizeHint)
 211            {
 0212                using var scope = _clientDiagnostics.CreateScope("LinkedServiceClient.GetLinkedServicesByWorkspace");
 0213                scope.Start();
 214                try
 215                {
 0216                    var response = RestClient.GetLinkedServicesByWorkspaceNextPage(nextLink, cancellationToken);
 0217                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 218                }
 0219                catch (Exception e)
 220                {
 0221                    scope.Failed(e);
 0222                    throw;
 223                }
 0224            }
 0225            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 226        }
 227    }
 228}