< Summary

Class:Azure.Analytics.Synapse.Artifacts.NotebookClient
Assembly:Azure.Analytics.Synapse.Artifacts
File(s):C:\Git\azure-sdk-for-net\sdk\synapse\Azure.Analytics.Synapse.Artifacts\src\Customization\NotebookClient.cs
C:\Git\azure-sdk-for-net\sdk\synapse\Azure.Analytics.Synapse.Artifacts\src\Generated\NotebookClient.cs
Covered lines:36
Uncovered lines:94
Coverable lines:130
Total lines:333
Line coverage:27.6% (36 of 130)
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%
CreateOrUpdateNotebookAsync()-0%100%
CreateOrUpdateNotebook(...)-0%100%
GetNotebookAsync()-57.14%100%
GetNotebook(...)-57.14%100%
DeleteNotebookAsync()-0%100%
DeleteNotebook(...)-0%100%
<GetNotebooksByWorkspaceAsync()-62.5%100%
<GetNotebooksByWorkspaceAsync()-0%100%
GetNotebooksByWorkspaceAsync(...)-100%100%
GetNotebooksByWorkspace(...)-100%100%
<GetNotebookSummaryByWorkSpaceAsync()-0%100%
<GetNotebookSummaryByWorkSpaceAsync()-0%100%
GetNotebookSummaryByWorkSpaceAsync(...)-0%100%
GetNotebookSummaryByWorkSpace(...)-0%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\synapse\Azure.Analytics.Synapse.Artifacts\src\Customization\NotebookClient.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 NotebookClient
 11    {
 12        /// <summary>
 13        /// Initializes a new instance of the <see cref="NotebookClient"/>.
 14        /// </summary>
 15        public NotebookClient(Uri endpoint, TokenCredential credential)
 016            : this(endpoint, credential, ArtifactsClientOptions.Default)
 17        {
 018        }
 19
 20        /// <summary>
 21        /// Initializes a new instance of the <see cref="NotebookClient"/>.
 22        /// </summary>
 23        public NotebookClient(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\NotebookClient.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 Notebook service client. </summary>
 19    public partial class NotebookClient
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 1623        internal NotebookRestClient RestClient { get; }
 424        /// <summary> Initializes a new instance of NotebookClient for mocking. </summary>
 1225        protected NotebookClient()
 426        {
 1227        }
 28        /// <summary> Initializes a new instance of NotebookClient. </summary>
 429        /// <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>
 833        internal NotebookClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, string apiV
 34        {
 835            RestClient = new NotebookRestClient(clientDiagnostics, pipeline, endpoint, apiVersion);
 836            _clientDiagnostics = clientDiagnostics;
 837            _pipeline = pipeline;
 838        }
 39
 40        /// <summary> Creates or updates a Note Book. </summary>
 41        /// <param name="notebookName"> The notebook name. </param>
 42        /// <param name="notebook"> Note book resource definition. </param>
 43        /// <param name="ifMatch"> ETag of the Note book entity.  Should only be specified for update, for which it shou
 44        /// <param name="cancellationToken"> The cancellation token to use. </param>
 45        public virtual async Task<Response<NotebookResource>> CreateOrUpdateNotebookAsync(string notebookName, NotebookR
 46        {
 047            using var scope = _clientDiagnostics.CreateScope("NotebookClient.CreateOrUpdateNotebook");
 048            scope.Start();
 49            try
 50            {
 051                return await RestClient.CreateOrUpdateNotebookAsync(notebookName, notebook, ifMatch, cancellationToken).
 52            }
 053            catch (Exception e)
 54            {
 055                scope.Failed(e);
 056                throw;
 57            }
 058        }
 59
 60        /// <summary> Creates or updates a Note Book. </summary>
 61        /// <param name="notebookName"> The notebook name. </param>
 62        /// <param name="notebook"> Note book resource definition. </param>
 63        /// <param name="ifMatch"> ETag of the Note book entity.  Should only be specified for update, for which it shou
 64        /// <param name="cancellationToken"> The cancellation token to use. </param>
 65        public virtual Response<NotebookResource> CreateOrUpdateNotebook(string notebookName, NotebookResource notebook,
 66        {
 067            using var scope = _clientDiagnostics.CreateScope("NotebookClient.CreateOrUpdateNotebook");
 068            scope.Start();
 69            try
 70            {
 071                return RestClient.CreateOrUpdateNotebook(notebookName, notebook, ifMatch, cancellationToken);
 72            }
 073            catch (Exception e)
 74            {
 075                scope.Failed(e);
 076                throw;
 77            }
 078        }
 79
 80        /// <summary> Gets a Note Book. </summary>
 81        /// <param name="notebookName"> The notebook name. </param>
 82        /// <param name="ifNoneMatch"> ETag of the Notebook entity. Should only be specified for get. If the ETag matche
 83        /// <param name="cancellationToken"> The cancellation token to use. </param>
 84        public virtual async Task<Response<NotebookResource>> GetNotebookAsync(string notebookName, string ifNoneMatch =
 85        {
 686            using var scope = _clientDiagnostics.CreateScope("NotebookClient.GetNotebook");
 687            scope.Start();
 88            try
 89            {
 690                return await RestClient.GetNotebookAsync(notebookName, ifNoneMatch, cancellationToken).ConfigureAwait(fa
 91            }
 092            catch (Exception e)
 93            {
 094                scope.Failed(e);
 095                throw;
 96            }
 697        }
 98
 99        /// <summary> Gets a Note Book. </summary>
 100        /// <param name="notebookName"> The notebook name. </param>
 101        /// <param name="ifNoneMatch"> ETag of the Notebook entity. Should only be specified for get. If the ETag matche
 102        /// <param name="cancellationToken"> The cancellation token to use. </param>
 103        public virtual Response<NotebookResource> GetNotebook(string notebookName, string ifNoneMatch = null, Cancellati
 104        {
 6105            using var scope = _clientDiagnostics.CreateScope("NotebookClient.GetNotebook");
 6106            scope.Start();
 107            try
 108            {
 6109                return RestClient.GetNotebook(notebookName, ifNoneMatch, cancellationToken);
 110            }
 0111            catch (Exception e)
 112            {
 0113                scope.Failed(e);
 0114                throw;
 115            }
 6116        }
 117
 118        /// <summary> Deletes a Note book. </summary>
 119        /// <param name="notebookName"> The notebook name. </param>
 120        /// <param name="cancellationToken"> The cancellation token to use. </param>
 121        public virtual async Task<Response> DeleteNotebookAsync(string notebookName, CancellationToken cancellationToken
 122        {
 0123            using var scope = _clientDiagnostics.CreateScope("NotebookClient.DeleteNotebook");
 0124            scope.Start();
 125            try
 126            {
 0127                return await RestClient.DeleteNotebookAsync(notebookName, cancellationToken).ConfigureAwait(false);
 128            }
 0129            catch (Exception e)
 130            {
 0131                scope.Failed(e);
 0132                throw;
 133            }
 0134        }
 135
 136        /// <summary> Deletes a Note book. </summary>
 137        /// <param name="notebookName"> The notebook name. </param>
 138        /// <param name="cancellationToken"> The cancellation token to use. </param>
 139        public virtual Response DeleteNotebook(string notebookName, CancellationToken cancellationToken = default)
 140        {
 0141            using var scope = _clientDiagnostics.CreateScope("NotebookClient.DeleteNotebook");
 0142            scope.Start();
 143            try
 144            {
 0145                return RestClient.DeleteNotebook(notebookName, cancellationToken);
 146            }
 0147            catch (Exception e)
 148            {
 0149                scope.Failed(e);
 0150                throw;
 151            }
 0152        }
 153
 154        /// <summary> Lists Notebooks. </summary>
 155        /// <param name="cancellationToken"> The cancellation token to use. </param>
 156        public virtual AsyncPageable<NotebookResource> GetNotebooksByWorkspaceAsync(CancellationToken cancellationToken 
 157        {
 158            async Task<Page<NotebookResource>> FirstPageFunc(int? pageSizeHint)
 159            {
 2160                using var scope = _clientDiagnostics.CreateScope("NotebookClient.GetNotebooksByWorkspace");
 2161                scope.Start();
 162                try
 163                {
 2164                    var response = await RestClient.GetNotebooksByWorkspaceAsync(cancellationToken).ConfigureAwait(false
 2165                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 166                }
 0167                catch (Exception e)
 168                {
 0169                    scope.Failed(e);
 0170                    throw;
 171                }
 2172            }
 173            async Task<Page<NotebookResource>> NextPageFunc(string nextLink, int? pageSizeHint)
 174            {
 0175                using var scope = _clientDiagnostics.CreateScope("NotebookClient.GetNotebooksByWorkspace");
 0176                scope.Start();
 177                try
 178                {
 0179                    var response = await RestClient.GetNotebooksByWorkspaceNextPageAsync(nextLink, cancellationToken).Co
 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            }
 2188            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 189        }
 190
 191        /// <summary> Lists Notebooks. </summary>
 192        /// <param name="cancellationToken"> The cancellation token to use. </param>
 193        public virtual Pageable<NotebookResource> GetNotebooksByWorkspace(CancellationToken cancellationToken = default)
 194        {
 195            Page<NotebookResource> FirstPageFunc(int? pageSizeHint)
 196            {
 2197                using var scope = _clientDiagnostics.CreateScope("NotebookClient.GetNotebooksByWorkspace");
 2198                scope.Start();
 199                try
 200                {
 2201                    var response = RestClient.GetNotebooksByWorkspace(cancellationToken);
 2202                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 203                }
 0204                catch (Exception e)
 205                {
 0206                    scope.Failed(e);
 0207                    throw;
 208                }
 2209            }
 210            Page<NotebookResource> NextPageFunc(string nextLink, int? pageSizeHint)
 211            {
 0212                using var scope = _clientDiagnostics.CreateScope("NotebookClient.GetNotebooksByWorkspace");
 0213                scope.Start();
 214                try
 215                {
 0216                    var response = RestClient.GetNotebooksByWorkspaceNextPage(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            }
 2225            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 226        }
 227
 228        /// <summary> Lists a summary of Notebooks. </summary>
 229        /// <param name="cancellationToken"> The cancellation token to use. </param>
 230        public virtual AsyncPageable<NotebookResource> GetNotebookSummaryByWorkSpaceAsync(CancellationToken cancellation
 231        {
 232            async Task<Page<NotebookResource>> FirstPageFunc(int? pageSizeHint)
 233            {
 0234                using var scope = _clientDiagnostics.CreateScope("NotebookClient.GetNotebookSummaryByWorkSpace");
 0235                scope.Start();
 236                try
 237                {
 0238                    var response = await RestClient.GetNotebookSummaryByWorkSpaceAsync(cancellationToken).ConfigureAwait
 0239                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 240                }
 0241                catch (Exception e)
 242                {
 0243                    scope.Failed(e);
 0244                    throw;
 245                }
 0246            }
 247            async Task<Page<NotebookResource>> NextPageFunc(string nextLink, int? pageSizeHint)
 248            {
 0249                using var scope = _clientDiagnostics.CreateScope("NotebookClient.GetNotebookSummaryByWorkSpace");
 0250                scope.Start();
 251                try
 252                {
 0253                    var response = await RestClient.GetNotebookSummaryByWorkSpaceNextPageAsync(nextLink, cancellationTok
 0254                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 255                }
 0256                catch (Exception e)
 257                {
 0258                    scope.Failed(e);
 0259                    throw;
 260                }
 0261            }
 0262            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 263        }
 264
 265        /// <summary> Lists a summary of Notebooks. </summary>
 266        /// <param name="cancellationToken"> The cancellation token to use. </param>
 267        public virtual Pageable<NotebookResource> GetNotebookSummaryByWorkSpace(CancellationToken cancellationToken = de
 268        {
 269            Page<NotebookResource> FirstPageFunc(int? pageSizeHint)
 270            {
 0271                using var scope = _clientDiagnostics.CreateScope("NotebookClient.GetNotebookSummaryByWorkSpace");
 0272                scope.Start();
 273                try
 274                {
 0275                    var response = RestClient.GetNotebookSummaryByWorkSpace(cancellationToken);
 0276                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 277                }
 0278                catch (Exception e)
 279                {
 0280                    scope.Failed(e);
 0281                    throw;
 282                }
 0283            }
 284            Page<NotebookResource> NextPageFunc(string nextLink, int? pageSizeHint)
 285            {
 0286                using var scope = _clientDiagnostics.CreateScope("NotebookClient.GetNotebookSummaryByWorkSpace");
 0287                scope.Start();
 288                try
 289                {
 0290                    var response = RestClient.GetNotebookSummaryByWorkSpaceNextPage(nextLink, cancellationToken);
 0291                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 292                }
 0293                catch (Exception e)
 294                {
 0295                    scope.Failed(e);
 0296                    throw;
 297                }
 0298            }
 0299            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 300        }
 301    }
 302}