< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
CreateCreateOrUpdateDataFlowRequest(...)-0%0%
CreateOrUpdateDataFlowAsync()-0%0%
CreateOrUpdateDataFlow(...)-0%0%
CreateGetDataFlowRequest(...)-0%0%
GetDataFlowAsync()-0%0%
GetDataFlow(...)-0%0%
CreateDeleteDataFlowRequest(...)-0%100%
DeleteDataFlowAsync()-0%0%
DeleteDataFlow(...)-0%0%
CreateGetDataFlowsByWorkspaceRequest()-0%100%
GetDataFlowsByWorkspaceAsync()-0%0%
GetDataFlowsByWorkspace(...)-0%0%
CreateGetDataFlowsByWorkspaceNextPageRequest(...)-0%100%
GetDataFlowsByWorkspaceNextPageAsync()-0%0%
GetDataFlowsByWorkspaceNextPage(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\synapse\Azure.Analytics.Synapse.Artifacts\src\Generated\DataFlowRestClient.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.Text.Json;
 10using System.Threading;
 11using System.Threading.Tasks;
 12using Azure;
 13using Azure.Analytics.Synapse.Artifacts.Models;
 14using Azure.Core;
 15using Azure.Core.Pipeline;
 16
 17namespace Azure.Analytics.Synapse.Artifacts
 18{
 19    internal partial class DataFlowRestClient
 20    {
 21        private string endpoint;
 22        private string apiVersion;
 23        private ClientDiagnostics _clientDiagnostics;
 24        private HttpPipeline _pipeline;
 25
 26        /// <summary> Initializes a new instance of DataFlowRestClient. </summary>
 27        /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param>
 28        /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param>
 29        /// <param name="endpoint"> The workspace development endpoint, for example https://myworkspace.dev.azuresynapse
 30        /// <param name="apiVersion"> Api Version. </param>
 31        /// <exception cref="ArgumentNullException"> <paramref name="endpoint"/> or <paramref name="apiVersion"/> is nul
 032        public DataFlowRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, string ap
 33        {
 034            if (endpoint == null)
 35            {
 036                throw new ArgumentNullException(nameof(endpoint));
 37            }
 038            if (apiVersion == null)
 39            {
 040                throw new ArgumentNullException(nameof(apiVersion));
 41            }
 42
 043            this.endpoint = endpoint;
 044            this.apiVersion = apiVersion;
 045            _clientDiagnostics = clientDiagnostics;
 046            _pipeline = pipeline;
 047        }
 48
 49        internal HttpMessage CreateCreateOrUpdateDataFlowRequest(string dataFlowName, DataFlowResource dataFlow, string 
 50        {
 051            var message = _pipeline.CreateMessage();
 052            var request = message.Request;
 053            request.Method = RequestMethod.Put;
 054            var uri = new RawRequestUriBuilder();
 055            uri.AppendRaw(endpoint, false);
 056            uri.AppendPath("/dataflows/", false);
 057            uri.AppendPath(dataFlowName, true);
 058            uri.AppendQuery("api-version", apiVersion, true);
 059            request.Uri = uri;
 060            if (ifMatch != null)
 61            {
 062                request.Headers.Add("If-Match", ifMatch);
 63            }
 064            request.Headers.Add("Content-Type", "application/json");
 065            var content = new Utf8JsonRequestContent();
 066            content.JsonWriter.WriteObjectValue(dataFlow);
 067            request.Content = content;
 068            return message;
 69        }
 70
 71        /// <summary> Creates or updates a data flow. </summary>
 72        /// <param name="dataFlowName"> The data flow name. </param>
 73        /// <param name="dataFlow"> Data flow resource definition. </param>
 74        /// <param name="ifMatch"> ETag of the data flow entity. Should only be specified for update, for which it shoul
 75        /// <param name="cancellationToken"> The cancellation token to use. </param>
 76        /// <exception cref="ArgumentNullException"> <paramref name="dataFlowName"/> or <paramref name="dataFlow"/> is n
 77        public async Task<Response<DataFlowResource>> CreateOrUpdateDataFlowAsync(string dataFlowName, DataFlowResource 
 78        {
 079            if (dataFlowName == null)
 80            {
 081                throw new ArgumentNullException(nameof(dataFlowName));
 82            }
 083            if (dataFlow == null)
 84            {
 085                throw new ArgumentNullException(nameof(dataFlow));
 86            }
 87
 088            using var message = CreateCreateOrUpdateDataFlowRequest(dataFlowName, dataFlow, ifMatch);
 089            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 090            switch (message.Response.Status)
 91            {
 92                case 200:
 93                    {
 94                        DataFlowResource value = default;
 095                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 096                        value = DataFlowResource.DeserializeDataFlowResource(document.RootElement);
 097                        return Response.FromValue(value, message.Response);
 98                    }
 99                default:
 0100                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 101            }
 0102        }
 103
 104        /// <summary> Creates or updates a data flow. </summary>
 105        /// <param name="dataFlowName"> The data flow name. </param>
 106        /// <param name="dataFlow"> Data flow resource definition. </param>
 107        /// <param name="ifMatch"> ETag of the data flow entity. Should only be specified for update, for which it shoul
 108        /// <param name="cancellationToken"> The cancellation token to use. </param>
 109        /// <exception cref="ArgumentNullException"> <paramref name="dataFlowName"/> or <paramref name="dataFlow"/> is n
 110        public Response<DataFlowResource> CreateOrUpdateDataFlow(string dataFlowName, DataFlowResource dataFlow, string 
 111        {
 0112            if (dataFlowName == null)
 113            {
 0114                throw new ArgumentNullException(nameof(dataFlowName));
 115            }
 0116            if (dataFlow == null)
 117            {
 0118                throw new ArgumentNullException(nameof(dataFlow));
 119            }
 120
 0121            using var message = CreateCreateOrUpdateDataFlowRequest(dataFlowName, dataFlow, ifMatch);
 0122            _pipeline.Send(message, cancellationToken);
 0123            switch (message.Response.Status)
 124            {
 125                case 200:
 126                    {
 127                        DataFlowResource value = default;
 0128                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0129                        value = DataFlowResource.DeserializeDataFlowResource(document.RootElement);
 0130                        return Response.FromValue(value, message.Response);
 131                    }
 132                default:
 0133                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 134            }
 0135        }
 136
 137        internal HttpMessage CreateGetDataFlowRequest(string dataFlowName, string ifNoneMatch)
 138        {
 0139            var message = _pipeline.CreateMessage();
 0140            var request = message.Request;
 0141            request.Method = RequestMethod.Get;
 0142            var uri = new RawRequestUriBuilder();
 0143            uri.AppendRaw(endpoint, false);
 0144            uri.AppendPath("/dataflows/", false);
 0145            uri.AppendPath(dataFlowName, true);
 0146            uri.AppendQuery("api-version", apiVersion, true);
 0147            request.Uri = uri;
 0148            if (ifNoneMatch != null)
 149            {
 0150                request.Headers.Add("If-None-Match", ifNoneMatch);
 151            }
 0152            return message;
 153        }
 154
 155        /// <summary> Gets a data flow. </summary>
 156        /// <param name="dataFlowName"> The data flow name. </param>
 157        /// <param name="ifNoneMatch"> ETag of the data flow entity. Should only be specified for get. If the ETag match
 158        /// <param name="cancellationToken"> The cancellation token to use. </param>
 159        /// <exception cref="ArgumentNullException"> <paramref name="dataFlowName"/> is null. </exception>
 160        public async Task<Response<DataFlowResource>> GetDataFlowAsync(string dataFlowName, string ifNoneMatch = null, C
 161        {
 0162            if (dataFlowName == null)
 163            {
 0164                throw new ArgumentNullException(nameof(dataFlowName));
 165            }
 166
 0167            using var message = CreateGetDataFlowRequest(dataFlowName, ifNoneMatch);
 0168            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0169            switch (message.Response.Status)
 170            {
 171                case 200:
 172                    {
 173                        DataFlowResource value = default;
 0174                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0175                        value = DataFlowResource.DeserializeDataFlowResource(document.RootElement);
 0176                        return Response.FromValue(value, message.Response);
 177                    }
 178                default:
 0179                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 180            }
 0181        }
 182
 183        /// <summary> Gets a data flow. </summary>
 184        /// <param name="dataFlowName"> The data flow name. </param>
 185        /// <param name="ifNoneMatch"> ETag of the data flow entity. Should only be specified for get. If the ETag match
 186        /// <param name="cancellationToken"> The cancellation token to use. </param>
 187        /// <exception cref="ArgumentNullException"> <paramref name="dataFlowName"/> is null. </exception>
 188        public Response<DataFlowResource> GetDataFlow(string dataFlowName, string ifNoneMatch = null, CancellationToken 
 189        {
 0190            if (dataFlowName == null)
 191            {
 0192                throw new ArgumentNullException(nameof(dataFlowName));
 193            }
 194
 0195            using var message = CreateGetDataFlowRequest(dataFlowName, ifNoneMatch);
 0196            _pipeline.Send(message, cancellationToken);
 0197            switch (message.Response.Status)
 198            {
 199                case 200:
 200                    {
 201                        DataFlowResource value = default;
 0202                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0203                        value = DataFlowResource.DeserializeDataFlowResource(document.RootElement);
 0204                        return Response.FromValue(value, message.Response);
 205                    }
 206                default:
 0207                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 208            }
 0209        }
 210
 211        internal HttpMessage CreateDeleteDataFlowRequest(string dataFlowName)
 212        {
 0213            var message = _pipeline.CreateMessage();
 0214            var request = message.Request;
 0215            request.Method = RequestMethod.Delete;
 0216            var uri = new RawRequestUriBuilder();
 0217            uri.AppendRaw(endpoint, false);
 0218            uri.AppendPath("/dataflows/", false);
 0219            uri.AppendPath(dataFlowName, true);
 0220            uri.AppendQuery("api-version", apiVersion, true);
 0221            request.Uri = uri;
 0222            return message;
 223        }
 224
 225        /// <summary> Deletes a data flow. </summary>
 226        /// <param name="dataFlowName"> The data flow name. </param>
 227        /// <param name="cancellationToken"> The cancellation token to use. </param>
 228        /// <exception cref="ArgumentNullException"> <paramref name="dataFlowName"/> is null. </exception>
 229        public async Task<Response> DeleteDataFlowAsync(string dataFlowName, CancellationToken cancellationToken = defau
 230        {
 0231            if (dataFlowName == null)
 232            {
 0233                throw new ArgumentNullException(nameof(dataFlowName));
 234            }
 235
 0236            using var message = CreateDeleteDataFlowRequest(dataFlowName);
 0237            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0238            switch (message.Response.Status)
 239            {
 240                case 200:
 241                case 204:
 0242                    return message.Response;
 243                default:
 0244                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 245            }
 0246        }
 247
 248        /// <summary> Deletes a data flow. </summary>
 249        /// <param name="dataFlowName"> The data flow name. </param>
 250        /// <param name="cancellationToken"> The cancellation token to use. </param>
 251        /// <exception cref="ArgumentNullException"> <paramref name="dataFlowName"/> is null. </exception>
 252        public Response DeleteDataFlow(string dataFlowName, CancellationToken cancellationToken = default)
 253        {
 0254            if (dataFlowName == null)
 255            {
 0256                throw new ArgumentNullException(nameof(dataFlowName));
 257            }
 258
 0259            using var message = CreateDeleteDataFlowRequest(dataFlowName);
 0260            _pipeline.Send(message, cancellationToken);
 0261            switch (message.Response.Status)
 262            {
 263                case 200:
 264                case 204:
 0265                    return message.Response;
 266                default:
 0267                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 268            }
 0269        }
 270
 271        internal HttpMessage CreateGetDataFlowsByWorkspaceRequest()
 272        {
 0273            var message = _pipeline.CreateMessage();
 0274            var request = message.Request;
 0275            request.Method = RequestMethod.Get;
 0276            var uri = new RawRequestUriBuilder();
 0277            uri.AppendRaw(endpoint, false);
 0278            uri.AppendPath("/dataflows", false);
 0279            uri.AppendQuery("api-version", apiVersion, true);
 0280            request.Uri = uri;
 0281            return message;
 282        }
 283
 284        /// <summary> Lists data flows. </summary>
 285        /// <param name="cancellationToken"> The cancellation token to use. </param>
 286        public async Task<Response<DataFlowListResponse>> GetDataFlowsByWorkspaceAsync(CancellationToken cancellationTok
 287        {
 0288            using var message = CreateGetDataFlowsByWorkspaceRequest();
 0289            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0290            switch (message.Response.Status)
 291            {
 292                case 200:
 293                    {
 294                        DataFlowListResponse value = default;
 0295                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0296                        value = DataFlowListResponse.DeserializeDataFlowListResponse(document.RootElement);
 0297                        return Response.FromValue(value, message.Response);
 298                    }
 299                default:
 0300                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 301            }
 0302        }
 303
 304        /// <summary> Lists data flows. </summary>
 305        /// <param name="cancellationToken"> The cancellation token to use. </param>
 306        public Response<DataFlowListResponse> GetDataFlowsByWorkspace(CancellationToken cancellationToken = default)
 307        {
 0308            using var message = CreateGetDataFlowsByWorkspaceRequest();
 0309            _pipeline.Send(message, cancellationToken);
 0310            switch (message.Response.Status)
 311            {
 312                case 200:
 313                    {
 314                        DataFlowListResponse value = default;
 0315                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0316                        value = DataFlowListResponse.DeserializeDataFlowListResponse(document.RootElement);
 0317                        return Response.FromValue(value, message.Response);
 318                    }
 319                default:
 0320                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 321            }
 0322        }
 323
 324        internal HttpMessage CreateGetDataFlowsByWorkspaceNextPageRequest(string nextLink)
 325        {
 0326            var message = _pipeline.CreateMessage();
 0327            var request = message.Request;
 0328            request.Method = RequestMethod.Get;
 0329            var uri = new RawRequestUriBuilder();
 0330            uri.AppendRaw(endpoint, false);
 0331            uri.AppendRawNextLink(nextLink, false);
 0332            request.Uri = uri;
 0333            return message;
 334        }
 335
 336        /// <summary> Lists data flows. </summary>
 337        /// <param name="nextLink"> The URL to the next page of results. </param>
 338        /// <param name="cancellationToken"> The cancellation token to use. </param>
 339        /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> is null. </exception>
 340        public async Task<Response<DataFlowListResponse>> GetDataFlowsByWorkspaceNextPageAsync(string nextLink, Cancella
 341        {
 0342            if (nextLink == null)
 343            {
 0344                throw new ArgumentNullException(nameof(nextLink));
 345            }
 346
 0347            using var message = CreateGetDataFlowsByWorkspaceNextPageRequest(nextLink);
 0348            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0349            switch (message.Response.Status)
 350            {
 351                case 200:
 352                    {
 353                        DataFlowListResponse value = default;
 0354                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0355                        value = DataFlowListResponse.DeserializeDataFlowListResponse(document.RootElement);
 0356                        return Response.FromValue(value, message.Response);
 357                    }
 358                default:
 0359                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 360            }
 0361        }
 362
 363        /// <summary> Lists data flows. </summary>
 364        /// <param name="nextLink"> The URL to the next page of results. </param>
 365        /// <param name="cancellationToken"> The cancellation token to use. </param>
 366        /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> is null. </exception>
 367        public Response<DataFlowListResponse> GetDataFlowsByWorkspaceNextPage(string nextLink, CancellationToken cancell
 368        {
 0369            if (nextLink == null)
 370            {
 0371                throw new ArgumentNullException(nameof(nextLink));
 372            }
 373
 0374            using var message = CreateGetDataFlowsByWorkspaceNextPageRequest(nextLink);
 0375            _pipeline.Send(message, cancellationToken);
 0376            switch (message.Response.Status)
 377            {
 378                case 200:
 379                    {
 380                        DataFlowListResponse value = default;
 0381                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0382                        value = DataFlowListResponse.DeserializeDataFlowListResponse(document.RootElement);
 0383                        return Response.FromValue(value, message.Response);
 384                    }
 385                default:
 0386                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 387            }
 0388        }
 389    }
 390}