< Summary

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

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%
CreateOrUpdateSparkJobDefinitionAsync()-0%100%
CreateOrUpdateSparkJobDefinition(...)-0%100%
GetSparkJobDefinitionAsync()-0%100%
GetSparkJobDefinition(...)-0%100%
DeleteSparkJobDefinitionAsync()-0%100%
DeleteSparkJobDefinition(...)-0%100%
<GetSparkJobDefinitionsByWorkspaceAsync()-0%100%
<GetSparkJobDefinitionsByWorkspaceAsync()-0%100%
GetSparkJobDefinitionsByWorkspaceAsync(...)-0%100%
GetSparkJobDefinitionsByWorkspace(...)-0%100%
StartExecuteSparkJobDefinitionAsync()-0%0%
StartExecuteSparkJobDefinition(...)-0%0%
StartDebugSparkJobDefinitionAsync()-0%0%
StartDebugSparkJobDefinition(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\synapse\Azure.Analytics.Synapse.Artifacts\src\Customization\SparkJobDefinitionClient.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 SparkJobDefinitionClient
 11    {
 12        /// <summary>
 13        /// Initializes a new instance of the <see cref="SparkJobDefinitionClient"/>.
 14        /// </summary>
 15        public SparkJobDefinitionClient(Uri endpoint, TokenCredential credential)
 016            : this(endpoint, credential, ArtifactsClientOptions.Default)
 17        {
 018        }
 19
 20        /// <summary>
 21        /// Initializes a new instance of the <see cref="SparkJobDefinitionClient"/>.
 22        /// </summary>
 23        public SparkJobDefinitionClient(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\SparkJobDefinitionClient.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 SparkJobDefinition service client. </summary>
 19    public partial class SparkJobDefinitionClient
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 023        internal SparkJobDefinitionRestClient RestClient { get; }
 024        /// <summary> Initializes a new instance of SparkJobDefinitionClient for mocking. </summary>
 025        protected SparkJobDefinitionClient()
 026        {
 027        }
 28        /// <summary> Initializes a new instance of SparkJobDefinitionClient. </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 SparkJobDefinitionClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, s
 34        {
 035            RestClient = new SparkJobDefinitionRestClient(clientDiagnostics, pipeline, endpoint, apiVersion);
 036            _clientDiagnostics = clientDiagnostics;
 037            _pipeline = pipeline;
 038        }
 39
 40        /// <summary> Creates or updates a Spark Job Definition. </summary>
 41        /// <param name="sparkJobDefinitionName"> The spark job definition name. </param>
 42        /// <param name="sparkJobDefinition"> Spark Job Definition resource definition. </param>
 43        /// <param name="ifMatch"> ETag of the Spark Job Definition entity.  Should only be specified for update, for wh
 44        /// <param name="cancellationToken"> The cancellation token to use. </param>
 45        public virtual async Task<Response<SparkJobDefinitionResource>> CreateOrUpdateSparkJobDefinitionAsync(string spa
 46        {
 047            using var scope = _clientDiagnostics.CreateScope("SparkJobDefinitionClient.CreateOrUpdateSparkJobDefinition"
 048            scope.Start();
 49            try
 50            {
 051                return await RestClient.CreateOrUpdateSparkJobDefinitionAsync(sparkJobDefinitionName, sparkJobDefinition
 52            }
 053            catch (Exception e)
 54            {
 055                scope.Failed(e);
 056                throw;
 57            }
 058        }
 59
 60        /// <summary> Creates or updates a Spark Job Definition. </summary>
 61        /// <param name="sparkJobDefinitionName"> The spark job definition name. </param>
 62        /// <param name="sparkJobDefinition"> Spark Job Definition resource definition. </param>
 63        /// <param name="ifMatch"> ETag of the Spark Job Definition entity.  Should only be specified for update, for wh
 64        /// <param name="cancellationToken"> The cancellation token to use. </param>
 65        public virtual Response<SparkJobDefinitionResource> CreateOrUpdateSparkJobDefinition(string sparkJobDefinitionNa
 66        {
 067            using var scope = _clientDiagnostics.CreateScope("SparkJobDefinitionClient.CreateOrUpdateSparkJobDefinition"
 068            scope.Start();
 69            try
 70            {
 071                return RestClient.CreateOrUpdateSparkJobDefinition(sparkJobDefinitionName, sparkJobDefinition, ifMatch, 
 72            }
 073            catch (Exception e)
 74            {
 075                scope.Failed(e);
 076                throw;
 77            }
 078        }
 79
 80        /// <summary> Gets a Spark Job Definition. </summary>
 81        /// <param name="sparkJobDefinitionName"> The spark job definition name. </param>
 82        /// <param name="ifNoneMatch"> ETag of the Spark Job Definition entity. Should only be specified for get. If the
 83        /// <param name="cancellationToken"> The cancellation token to use. </param>
 84        public virtual async Task<Response<SparkJobDefinitionResource>> GetSparkJobDefinitionAsync(string sparkJobDefini
 85        {
 086            using var scope = _clientDiagnostics.CreateScope("SparkJobDefinitionClient.GetSparkJobDefinition");
 087            scope.Start();
 88            try
 89            {
 090                return await RestClient.GetSparkJobDefinitionAsync(sparkJobDefinitionName, ifNoneMatch, cancellationToke
 91            }
 092            catch (Exception e)
 93            {
 094                scope.Failed(e);
 095                throw;
 96            }
 097        }
 98
 99        /// <summary> Gets a Spark Job Definition. </summary>
 100        /// <param name="sparkJobDefinitionName"> The spark job definition name. </param>
 101        /// <param name="ifNoneMatch"> ETag of the Spark Job Definition entity. Should only be specified for get. If the
 102        /// <param name="cancellationToken"> The cancellation token to use. </param>
 103        public virtual Response<SparkJobDefinitionResource> GetSparkJobDefinition(string sparkJobDefinitionName, string 
 104        {
 0105            using var scope = _clientDiagnostics.CreateScope("SparkJobDefinitionClient.GetSparkJobDefinition");
 0106            scope.Start();
 107            try
 108            {
 0109                return RestClient.GetSparkJobDefinition(sparkJobDefinitionName, ifNoneMatch, cancellationToken);
 110            }
 0111            catch (Exception e)
 112            {
 0113                scope.Failed(e);
 0114                throw;
 115            }
 0116        }
 117
 118        /// <summary> Deletes a Spark Job Definition. </summary>
 119        /// <param name="sparkJobDefinitionName"> The spark job definition name. </param>
 120        /// <param name="cancellationToken"> The cancellation token to use. </param>
 121        public virtual async Task<Response> DeleteSparkJobDefinitionAsync(string sparkJobDefinitionName, CancellationTok
 122        {
 0123            using var scope = _clientDiagnostics.CreateScope("SparkJobDefinitionClient.DeleteSparkJobDefinition");
 0124            scope.Start();
 125            try
 126            {
 0127                return await RestClient.DeleteSparkJobDefinitionAsync(sparkJobDefinitionName, cancellationToken).Configu
 128            }
 0129            catch (Exception e)
 130            {
 0131                scope.Failed(e);
 0132                throw;
 133            }
 0134        }
 135
 136        /// <summary> Deletes a Spark Job Definition. </summary>
 137        /// <param name="sparkJobDefinitionName"> The spark job definition name. </param>
 138        /// <param name="cancellationToken"> The cancellation token to use. </param>
 139        public virtual Response DeleteSparkJobDefinition(string sparkJobDefinitionName, CancellationToken cancellationTo
 140        {
 0141            using var scope = _clientDiagnostics.CreateScope("SparkJobDefinitionClient.DeleteSparkJobDefinition");
 0142            scope.Start();
 143            try
 144            {
 0145                return RestClient.DeleteSparkJobDefinition(sparkJobDefinitionName, cancellationToken);
 146            }
 0147            catch (Exception e)
 148            {
 0149                scope.Failed(e);
 0150                throw;
 151            }
 0152        }
 153
 154        /// <summary> Lists spark job definitions. </summary>
 155        /// <param name="cancellationToken"> The cancellation token to use. </param>
 156        public virtual AsyncPageable<SparkJobDefinitionResource> GetSparkJobDefinitionsByWorkspaceAsync(CancellationToke
 157        {
 158            async Task<Page<SparkJobDefinitionResource>> FirstPageFunc(int? pageSizeHint)
 159            {
 0160                using var scope = _clientDiagnostics.CreateScope("SparkJobDefinitionClient.GetSparkJobDefinitionsByWorks
 0161                scope.Start();
 162                try
 163                {
 0164                    var response = await RestClient.GetSparkJobDefinitionsByWorkspaceAsync(cancellationToken).ConfigureA
 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<SparkJobDefinitionResource>> NextPageFunc(string nextLink, int? pageSizeHint)
 174            {
 0175                using var scope = _clientDiagnostics.CreateScope("SparkJobDefinitionClient.GetSparkJobDefinitionsByWorks
 0176                scope.Start();
 177                try
 178                {
 0179                    var response = await RestClient.GetSparkJobDefinitionsByWorkspaceNextPageAsync(nextLink, cancellatio
 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 spark job definitions. </summary>
 192        /// <param name="cancellationToken"> The cancellation token to use. </param>
 193        public virtual Pageable<SparkJobDefinitionResource> GetSparkJobDefinitionsByWorkspace(CancellationToken cancella
 194        {
 195            Page<SparkJobDefinitionResource> FirstPageFunc(int? pageSizeHint)
 196            {
 0197                using var scope = _clientDiagnostics.CreateScope("SparkJobDefinitionClient.GetSparkJobDefinitionsByWorks
 0198                scope.Start();
 199                try
 200                {
 0201                    var response = RestClient.GetSparkJobDefinitionsByWorkspace(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<SparkJobDefinitionResource> NextPageFunc(string nextLink, int? pageSizeHint)
 211            {
 0212                using var scope = _clientDiagnostics.CreateScope("SparkJobDefinitionClient.GetSparkJobDefinitionsByWorks
 0213                scope.Start();
 214                try
 215                {
 0216                    var response = RestClient.GetSparkJobDefinitionsByWorkspaceNextPage(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        /// <summary> Executes the spark job definition. </summary>
 229        /// <param name="sparkJobDefinitionName"> The spark job definition name. </param>
 230        /// <param name="cancellationToken"> The cancellation token to use. </param>
 231        /// <exception cref="ArgumentNullException"> <paramref name="sparkJobDefinitionName"/> is null. </exception>
 232        public virtual async Task<SparkJobDefinitionExecuteSparkJobDefinitionOperation> StartExecuteSparkJobDefinitionAs
 233        {
 0234            if (sparkJobDefinitionName == null)
 235            {
 0236                throw new ArgumentNullException(nameof(sparkJobDefinitionName));
 237            }
 238
 0239            using var scope = _clientDiagnostics.CreateScope("SparkJobDefinitionClient.StartExecuteSparkJobDefinition");
 0240            scope.Start();
 241            try
 242            {
 0243                var originalResponse = await RestClient.ExecuteSparkJobDefinitionAsync(sparkJobDefinitionName, cancellat
 0244                return new SparkJobDefinitionExecuteSparkJobDefinitionOperation(_clientDiagnostics, _pipeline, RestClien
 245            }
 0246            catch (Exception e)
 247            {
 0248                scope.Failed(e);
 0249                throw;
 250            }
 0251        }
 252
 253        /// <summary> Executes the spark job definition. </summary>
 254        /// <param name="sparkJobDefinitionName"> The spark job definition name. </param>
 255        /// <param name="cancellationToken"> The cancellation token to use. </param>
 256        /// <exception cref="ArgumentNullException"> <paramref name="sparkJobDefinitionName"/> is null. </exception>
 257        public virtual SparkJobDefinitionExecuteSparkJobDefinitionOperation StartExecuteSparkJobDefinition(string sparkJ
 258        {
 0259            if (sparkJobDefinitionName == null)
 260            {
 0261                throw new ArgumentNullException(nameof(sparkJobDefinitionName));
 262            }
 263
 0264            using var scope = _clientDiagnostics.CreateScope("SparkJobDefinitionClient.StartExecuteSparkJobDefinition");
 0265            scope.Start();
 266            try
 267            {
 0268                var originalResponse = RestClient.ExecuteSparkJobDefinition(sparkJobDefinitionName, cancellationToken);
 0269                return new SparkJobDefinitionExecuteSparkJobDefinitionOperation(_clientDiagnostics, _pipeline, RestClien
 270            }
 0271            catch (Exception e)
 272            {
 0273                scope.Failed(e);
 0274                throw;
 275            }
 0276        }
 277
 278        /// <summary> Debug the spark job definition. </summary>
 279        /// <param name="sparkJobDefinitionAzureResource"> Spark Job Definition resource definition. </param>
 280        /// <param name="cancellationToken"> The cancellation token to use. </param>
 281        /// <exception cref="ArgumentNullException"> <paramref name="sparkJobDefinitionAzureResource"/> is null. </excep
 282        public virtual async Task<SparkJobDefinitionDebugSparkJobDefinitionOperation> StartDebugSparkJobDefinitionAsync(
 283        {
 0284            if (sparkJobDefinitionAzureResource == null)
 285            {
 0286                throw new ArgumentNullException(nameof(sparkJobDefinitionAzureResource));
 287            }
 288
 0289            using var scope = _clientDiagnostics.CreateScope("SparkJobDefinitionClient.StartDebugSparkJobDefinition");
 0290            scope.Start();
 291            try
 292            {
 0293                var originalResponse = await RestClient.DebugSparkJobDefinitionAsync(sparkJobDefinitionAzureResource, ca
 0294                return new SparkJobDefinitionDebugSparkJobDefinitionOperation(_clientDiagnostics, _pipeline, RestClient.
 295            }
 0296            catch (Exception e)
 297            {
 0298                scope.Failed(e);
 0299                throw;
 300            }
 0301        }
 302
 303        /// <summary> Debug the spark job definition. </summary>
 304        /// <param name="sparkJobDefinitionAzureResource"> Spark Job Definition resource definition. </param>
 305        /// <param name="cancellationToken"> The cancellation token to use. </param>
 306        /// <exception cref="ArgumentNullException"> <paramref name="sparkJobDefinitionAzureResource"/> is null. </excep
 307        public virtual SparkJobDefinitionDebugSparkJobDefinitionOperation StartDebugSparkJobDefinition(SparkJobDefinitio
 308        {
 0309            if (sparkJobDefinitionAzureResource == null)
 310            {
 0311                throw new ArgumentNullException(nameof(sparkJobDefinitionAzureResource));
 312            }
 313
 0314            using var scope = _clientDiagnostics.CreateScope("SparkJobDefinitionClient.StartDebugSparkJobDefinition");
 0315            scope.Start();
 316            try
 317            {
 0318                var originalResponse = RestClient.DebugSparkJobDefinition(sparkJobDefinitionAzureResource, cancellationT
 0319                return new SparkJobDefinitionDebugSparkJobDefinitionOperation(_clientDiagnostics, _pipeline, RestClient.
 320            }
 0321            catch (Exception e)
 322            {
 0323                scope.Failed(e);
 0324                throw;
 325            }
 0326        }
 327    }
 328}