< Summary

Class:Azure.ResourceManager.Resources.ApplicationsRestOperations
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\ApplicationsRestOperations.cs
Covered lines:0
Uncovered lines:463
Coverable lines:463
Total lines:1026
Line coverage:0% (0 of 463)
Covered branches:0
Total branches:176
Branch coverage:0% (0 of 176)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
CreateGetRequest(...)-0%100%
GetAsync()-0%0%
Get(...)-0%0%
CreateDeleteRequest(...)-0%100%
DeleteAsync()-0%0%
Delete(...)-0%0%
CreateCreateOrUpdateRequest(...)-0%100%
CreateOrUpdateAsync()-0%0%
CreateOrUpdate(...)-0%0%
CreateUpdateRequest(...)-0%0%
UpdateAsync()-0%0%
Update(...)-0%0%
CreateListByResourceGroupRequest(...)-0%100%
ListByResourceGroupAsync()-0%0%
ListByResourceGroup(...)-0%0%
CreateListBySubscriptionRequest()-0%100%
ListBySubscriptionAsync()-0%0%
ListBySubscription(...)-0%0%
CreateGetByIdRequest(...)-0%100%
GetByIdAsync()-0%0%
GetById(...)-0%0%
CreateDeleteByIdRequest(...)-0%100%
DeleteByIdAsync()-0%0%
DeleteById(...)-0%0%
CreateCreateOrUpdateByIdRequest(...)-0%100%
CreateOrUpdateByIdAsync()-0%0%
CreateOrUpdateById(...)-0%0%
CreateUpdateByIdRequest(...)-0%0%
UpdateByIdAsync()-0%0%
UpdateById(...)-0%0%
CreateListByResourceGroupNextPageRequest(...)-0%100%
ListByResourceGroupNextPageAsync()-0%0%
ListByResourceGroupNextPage(...)-0%0%
CreateListBySubscriptionNextPageRequest(...)-0%100%
ListBySubscriptionNextPageAsync()-0%0%
ListBySubscriptionNextPage(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\ApplicationsRestOperations.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.Core;
 14using Azure.Core.Pipeline;
 15using Azure.ResourceManager.Resources.Models;
 16
 17namespace Azure.ResourceManager.Resources
 18{
 19    internal partial class ApplicationsRestOperations
 20    {
 21        private string subscriptionId;
 22        private Uri endpoint;
 23        private ClientDiagnostics _clientDiagnostics;
 24        private HttpPipeline _pipeline;
 25
 26        /// <summary> Initializes a new instance of ApplicationsRestOperations. </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="subscriptionId"> The ID of the target subscription. </param>
 30        /// <param name="endpoint"> server parameter. </param>
 31        /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception
 032        public ApplicationsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptio
 33        {
 034            if (subscriptionId == null)
 35            {
 036                throw new ArgumentNullException(nameof(subscriptionId));
 37            }
 038            endpoint ??= new Uri("https://management.azure.com");
 39
 040            this.subscriptionId = subscriptionId;
 041            this.endpoint = endpoint;
 042            _clientDiagnostics = clientDiagnostics;
 043            _pipeline = pipeline;
 044        }
 45
 46        internal Core.HttpMessage CreateGetRequest(string resourceGroupName, string applicationName)
 47        {
 048            var message = _pipeline.CreateMessage();
 049            var request = message.Request;
 050            request.Method = RequestMethod.Get;
 051            var uri = new RawRequestUriBuilder();
 052            uri.Reset(endpoint);
 053            uri.AppendPath("/subscriptions/", false);
 054            uri.AppendPath(subscriptionId, true);
 055            uri.AppendPath("/resourceGroups/", false);
 056            uri.AppendPath(resourceGroupName, true);
 057            uri.AppendPath("/providers/Microsoft.Solutions/applications/", false);
 058            uri.AppendPath(applicationName, true);
 059            uri.AppendQuery("api-version", "2018-06-01", true);
 060            request.Uri = uri;
 061            return message;
 62        }
 63
 64        /// <summary> Gets the managed application. </summary>
 65        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 66        /// <param name="applicationName"> The name of the managed application. </param>
 67        /// <param name="cancellationToken"> The cancellation token to use. </param>
 68        public async Task<Response<Application>> GetAsync(string resourceGroupName, string applicationName, Cancellation
 69        {
 070            if (resourceGroupName == null)
 71            {
 072                throw new ArgumentNullException(nameof(resourceGroupName));
 73            }
 074            if (applicationName == null)
 75            {
 076                throw new ArgumentNullException(nameof(applicationName));
 77            }
 78
 079            using var message = CreateGetRequest(resourceGroupName, applicationName);
 080            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 081            switch (message.Response.Status)
 82            {
 83                case 200:
 84                    {
 085                        Application value = default;
 086                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 087                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 88                        {
 089                            value = null;
 90                        }
 91                        else
 92                        {
 093                            value = Application.DeserializeApplication(document.RootElement);
 94                        }
 095                        return Response.FromValue(value, message.Response);
 96                    }
 97                case 404:
 098                    return Response.FromValue<Application>(null, message.Response);
 99                default:
 0100                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 101            }
 0102        }
 103
 104        /// <summary> Gets the managed application. </summary>
 105        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 106        /// <param name="applicationName"> The name of the managed application. </param>
 107        /// <param name="cancellationToken"> The cancellation token to use. </param>
 108        public Response<Application> Get(string resourceGroupName, string applicationName, CancellationToken cancellatio
 109        {
 0110            if (resourceGroupName == null)
 111            {
 0112                throw new ArgumentNullException(nameof(resourceGroupName));
 113            }
 0114            if (applicationName == null)
 115            {
 0116                throw new ArgumentNullException(nameof(applicationName));
 117            }
 118
 0119            using var message = CreateGetRequest(resourceGroupName, applicationName);
 0120            _pipeline.Send(message, cancellationToken);
 0121            switch (message.Response.Status)
 122            {
 123                case 200:
 124                    {
 0125                        Application value = default;
 0126                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0127                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 128                        {
 0129                            value = null;
 130                        }
 131                        else
 132                        {
 0133                            value = Application.DeserializeApplication(document.RootElement);
 134                        }
 0135                        return Response.FromValue(value, message.Response);
 136                    }
 137                case 404:
 0138                    return Response.FromValue<Application>(null, message.Response);
 139                default:
 0140                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 141            }
 0142        }
 143
 144        internal Core.HttpMessage CreateDeleteRequest(string resourceGroupName, string applicationName)
 145        {
 0146            var message = _pipeline.CreateMessage();
 0147            var request = message.Request;
 0148            request.Method = RequestMethod.Delete;
 0149            var uri = new RawRequestUriBuilder();
 0150            uri.Reset(endpoint);
 0151            uri.AppendPath("/subscriptions/", false);
 0152            uri.AppendPath(subscriptionId, true);
 0153            uri.AppendPath("/resourceGroups/", false);
 0154            uri.AppendPath(resourceGroupName, true);
 0155            uri.AppendPath("/providers/Microsoft.Solutions/applications/", false);
 0156            uri.AppendPath(applicationName, true);
 0157            uri.AppendQuery("api-version", "2018-06-01", true);
 0158            request.Uri = uri;
 0159            return message;
 160        }
 161
 162        /// <summary> Deletes the managed application. </summary>
 163        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 164        /// <param name="applicationName"> The name of the managed application. </param>
 165        /// <param name="cancellationToken"> The cancellation token to use. </param>
 166        public async Task<Response> DeleteAsync(string resourceGroupName, string applicationName, CancellationToken canc
 167        {
 0168            if (resourceGroupName == null)
 169            {
 0170                throw new ArgumentNullException(nameof(resourceGroupName));
 171            }
 0172            if (applicationName == null)
 173            {
 0174                throw new ArgumentNullException(nameof(applicationName));
 175            }
 176
 0177            using var message = CreateDeleteRequest(resourceGroupName, applicationName);
 0178            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0179            switch (message.Response.Status)
 180            {
 181                case 202:
 182                case 204:
 0183                    return message.Response;
 184                default:
 0185                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 186            }
 0187        }
 188
 189        /// <summary> Deletes the managed application. </summary>
 190        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 191        /// <param name="applicationName"> The name of the managed application. </param>
 192        /// <param name="cancellationToken"> The cancellation token to use. </param>
 193        public Response Delete(string resourceGroupName, string applicationName, CancellationToken cancellationToken = d
 194        {
 0195            if (resourceGroupName == null)
 196            {
 0197                throw new ArgumentNullException(nameof(resourceGroupName));
 198            }
 0199            if (applicationName == null)
 200            {
 0201                throw new ArgumentNullException(nameof(applicationName));
 202            }
 203
 0204            using var message = CreateDeleteRequest(resourceGroupName, applicationName);
 0205            _pipeline.Send(message, cancellationToken);
 0206            switch (message.Response.Status)
 207            {
 208                case 202:
 209                case 204:
 0210                    return message.Response;
 211                default:
 0212                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 213            }
 0214        }
 215
 216        internal Core.HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string applicationName, Applicat
 217        {
 0218            var message = _pipeline.CreateMessage();
 0219            var request = message.Request;
 0220            request.Method = RequestMethod.Put;
 0221            var uri = new RawRequestUriBuilder();
 0222            uri.Reset(endpoint);
 0223            uri.AppendPath("/subscriptions/", false);
 0224            uri.AppendPath(subscriptionId, true);
 0225            uri.AppendPath("/resourceGroups/", false);
 0226            uri.AppendPath(resourceGroupName, true);
 0227            uri.AppendPath("/providers/Microsoft.Solutions/applications/", false);
 0228            uri.AppendPath(applicationName, true);
 0229            uri.AppendQuery("api-version", "2018-06-01", true);
 0230            request.Uri = uri;
 0231            request.Headers.Add("Content-Type", "application/json");
 0232            var content = new Utf8JsonRequestContent();
 0233            content.JsonWriter.WriteObjectValue(parameters);
 0234            request.Content = content;
 0235            return message;
 236        }
 237
 238        /// <summary> Creates a new managed application. </summary>
 239        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 240        /// <param name="applicationName"> The name of the managed application. </param>
 241        /// <param name="parameters"> Parameters supplied to the create or update a managed application. </param>
 242        /// <param name="cancellationToken"> The cancellation token to use. </param>
 243        public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string applicationName, Application pa
 244        {
 0245            if (resourceGroupName == null)
 246            {
 0247                throw new ArgumentNullException(nameof(resourceGroupName));
 248            }
 0249            if (applicationName == null)
 250            {
 0251                throw new ArgumentNullException(nameof(applicationName));
 252            }
 0253            if (parameters == null)
 254            {
 0255                throw new ArgumentNullException(nameof(parameters));
 256            }
 257
 0258            using var message = CreateCreateOrUpdateRequest(resourceGroupName, applicationName, parameters);
 0259            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0260            switch (message.Response.Status)
 261            {
 262                case 200:
 263                case 201:
 0264                    return message.Response;
 265                default:
 0266                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 267            }
 0268        }
 269
 270        /// <summary> Creates a new managed application. </summary>
 271        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 272        /// <param name="applicationName"> The name of the managed application. </param>
 273        /// <param name="parameters"> Parameters supplied to the create or update a managed application. </param>
 274        /// <param name="cancellationToken"> The cancellation token to use. </param>
 275        public Response CreateOrUpdate(string resourceGroupName, string applicationName, Application parameters, Cancell
 276        {
 0277            if (resourceGroupName == null)
 278            {
 0279                throw new ArgumentNullException(nameof(resourceGroupName));
 280            }
 0281            if (applicationName == null)
 282            {
 0283                throw new ArgumentNullException(nameof(applicationName));
 284            }
 0285            if (parameters == null)
 286            {
 0287                throw new ArgumentNullException(nameof(parameters));
 288            }
 289
 0290            using var message = CreateCreateOrUpdateRequest(resourceGroupName, applicationName, parameters);
 0291            _pipeline.Send(message, cancellationToken);
 0292            switch (message.Response.Status)
 293            {
 294                case 200:
 295                case 201:
 0296                    return message.Response;
 297                default:
 0298                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 299            }
 0300        }
 301
 302        internal Core.HttpMessage CreateUpdateRequest(string resourceGroupName, string applicationName, Application para
 303        {
 0304            var message = _pipeline.CreateMessage();
 0305            var request = message.Request;
 0306            request.Method = RequestMethod.Patch;
 0307            var uri = new RawRequestUriBuilder();
 0308            uri.Reset(endpoint);
 0309            uri.AppendPath("/subscriptions/", false);
 0310            uri.AppendPath(subscriptionId, true);
 0311            uri.AppendPath("/resourceGroups/", false);
 0312            uri.AppendPath(resourceGroupName, true);
 0313            uri.AppendPath("/providers/Microsoft.Solutions/applications/", false);
 0314            uri.AppendPath(applicationName, true);
 0315            uri.AppendQuery("api-version", "2018-06-01", true);
 0316            request.Uri = uri;
 0317            request.Headers.Add("Content-Type", "application/json");
 0318            if (parameters != null)
 319            {
 0320                var content = new Utf8JsonRequestContent();
 0321                content.JsonWriter.WriteObjectValue(parameters);
 0322                request.Content = content;
 323            }
 0324            return message;
 325        }
 326
 327        /// <summary> Updates an existing managed application. The only value that can be updated via PATCH currently is
 328        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 329        /// <param name="applicationName"> The name of the managed application. </param>
 330        /// <param name="parameters"> Parameters supplied to update an existing managed application. </param>
 331        /// <param name="cancellationToken"> The cancellation token to use. </param>
 332        public async Task<Response<Application>> UpdateAsync(string resourceGroupName, string applicationName, Applicati
 333        {
 0334            if (resourceGroupName == null)
 335            {
 0336                throw new ArgumentNullException(nameof(resourceGroupName));
 337            }
 0338            if (applicationName == null)
 339            {
 0340                throw new ArgumentNullException(nameof(applicationName));
 341            }
 342
 0343            using var message = CreateUpdateRequest(resourceGroupName, applicationName, parameters);
 0344            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0345            switch (message.Response.Status)
 346            {
 347                case 200:
 348                    {
 0349                        Application value = default;
 0350                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0351                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 352                        {
 0353                            value = null;
 354                        }
 355                        else
 356                        {
 0357                            value = Application.DeserializeApplication(document.RootElement);
 358                        }
 0359                        return Response.FromValue(value, message.Response);
 360                    }
 361                default:
 0362                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 363            }
 0364        }
 365
 366        /// <summary> Updates an existing managed application. The only value that can be updated via PATCH currently is
 367        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 368        /// <param name="applicationName"> The name of the managed application. </param>
 369        /// <param name="parameters"> Parameters supplied to update an existing managed application. </param>
 370        /// <param name="cancellationToken"> The cancellation token to use. </param>
 371        public Response<Application> Update(string resourceGroupName, string applicationName, Application parameters = n
 372        {
 0373            if (resourceGroupName == null)
 374            {
 0375                throw new ArgumentNullException(nameof(resourceGroupName));
 376            }
 0377            if (applicationName == null)
 378            {
 0379                throw new ArgumentNullException(nameof(applicationName));
 380            }
 381
 0382            using var message = CreateUpdateRequest(resourceGroupName, applicationName, parameters);
 0383            _pipeline.Send(message, cancellationToken);
 0384            switch (message.Response.Status)
 385            {
 386                case 200:
 387                    {
 0388                        Application value = default;
 0389                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0390                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 391                        {
 0392                            value = null;
 393                        }
 394                        else
 395                        {
 0396                            value = Application.DeserializeApplication(document.RootElement);
 397                        }
 0398                        return Response.FromValue(value, message.Response);
 399                    }
 400                default:
 0401                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 402            }
 0403        }
 404
 405        internal Core.HttpMessage CreateListByResourceGroupRequest(string resourceGroupName)
 406        {
 0407            var message = _pipeline.CreateMessage();
 0408            var request = message.Request;
 0409            request.Method = RequestMethod.Get;
 0410            var uri = new RawRequestUriBuilder();
 0411            uri.Reset(endpoint);
 0412            uri.AppendPath("/subscriptions/", false);
 0413            uri.AppendPath(subscriptionId, true);
 0414            uri.AppendPath("/resourceGroups/", false);
 0415            uri.AppendPath(resourceGroupName, true);
 0416            uri.AppendPath("/providers/Microsoft.Solutions/applications", false);
 0417            uri.AppendQuery("api-version", "2018-06-01", true);
 0418            request.Uri = uri;
 0419            return message;
 420        }
 421
 422        /// <summary> Gets all the applications within a resource group. </summary>
 423        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 424        /// <param name="cancellationToken"> The cancellation token to use. </param>
 425        public async Task<Response<ApplicationListResult>> ListByResourceGroupAsync(string resourceGroupName, Cancellati
 426        {
 0427            if (resourceGroupName == null)
 428            {
 0429                throw new ArgumentNullException(nameof(resourceGroupName));
 430            }
 431
 0432            using var message = CreateListByResourceGroupRequest(resourceGroupName);
 0433            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0434            switch (message.Response.Status)
 435            {
 436                case 200:
 437                    {
 0438                        ApplicationListResult value = default;
 0439                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0440                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 441                        {
 0442                            value = null;
 443                        }
 444                        else
 445                        {
 0446                            value = ApplicationListResult.DeserializeApplicationListResult(document.RootElement);
 447                        }
 0448                        return Response.FromValue(value, message.Response);
 449                    }
 450                default:
 0451                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 452            }
 0453        }
 454
 455        /// <summary> Gets all the applications within a resource group. </summary>
 456        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 457        /// <param name="cancellationToken"> The cancellation token to use. </param>
 458        public Response<ApplicationListResult> ListByResourceGroup(string resourceGroupName, CancellationToken cancellat
 459        {
 0460            if (resourceGroupName == null)
 461            {
 0462                throw new ArgumentNullException(nameof(resourceGroupName));
 463            }
 464
 0465            using var message = CreateListByResourceGroupRequest(resourceGroupName);
 0466            _pipeline.Send(message, cancellationToken);
 0467            switch (message.Response.Status)
 468            {
 469                case 200:
 470                    {
 0471                        ApplicationListResult value = default;
 0472                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0473                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 474                        {
 0475                            value = null;
 476                        }
 477                        else
 478                        {
 0479                            value = ApplicationListResult.DeserializeApplicationListResult(document.RootElement);
 480                        }
 0481                        return Response.FromValue(value, message.Response);
 482                    }
 483                default:
 0484                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 485            }
 0486        }
 487
 488        internal Core.HttpMessage CreateListBySubscriptionRequest()
 489        {
 0490            var message = _pipeline.CreateMessage();
 0491            var request = message.Request;
 0492            request.Method = RequestMethod.Get;
 0493            var uri = new RawRequestUriBuilder();
 0494            uri.Reset(endpoint);
 0495            uri.AppendPath("/subscriptions/", false);
 0496            uri.AppendPath(subscriptionId, true);
 0497            uri.AppendPath("/providers/Microsoft.Solutions/applications", false);
 0498            uri.AppendQuery("api-version", "2018-06-01", true);
 0499            request.Uri = uri;
 0500            return message;
 501        }
 502
 503        /// <summary> Gets all the applications within a subscription. </summary>
 504        /// <param name="cancellationToken"> The cancellation token to use. </param>
 505        public async Task<Response<ApplicationListResult>> ListBySubscriptionAsync(CancellationToken cancellationToken =
 506        {
 0507            using var message = CreateListBySubscriptionRequest();
 0508            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0509            switch (message.Response.Status)
 510            {
 511                case 200:
 512                    {
 0513                        ApplicationListResult value = default;
 0514                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0515                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 516                        {
 0517                            value = null;
 518                        }
 519                        else
 520                        {
 0521                            value = ApplicationListResult.DeserializeApplicationListResult(document.RootElement);
 522                        }
 0523                        return Response.FromValue(value, message.Response);
 524                    }
 525                default:
 0526                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 527            }
 0528        }
 529
 530        /// <summary> Gets all the applications within a subscription. </summary>
 531        /// <param name="cancellationToken"> The cancellation token to use. </param>
 532        public Response<ApplicationListResult> ListBySubscription(CancellationToken cancellationToken = default)
 533        {
 0534            using var message = CreateListBySubscriptionRequest();
 0535            _pipeline.Send(message, cancellationToken);
 0536            switch (message.Response.Status)
 537            {
 538                case 200:
 539                    {
 0540                        ApplicationListResult value = default;
 0541                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0542                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 543                        {
 0544                            value = null;
 545                        }
 546                        else
 547                        {
 0548                            value = ApplicationListResult.DeserializeApplicationListResult(document.RootElement);
 549                        }
 0550                        return Response.FromValue(value, message.Response);
 551                    }
 552                default:
 0553                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 554            }
 0555        }
 556
 557        internal Core.HttpMessage CreateGetByIdRequest(string applicationId)
 558        {
 0559            var message = _pipeline.CreateMessage();
 0560            var request = message.Request;
 0561            request.Method = RequestMethod.Get;
 0562            var uri = new RawRequestUriBuilder();
 0563            uri.Reset(endpoint);
 0564            uri.AppendPath("/", false);
 0565            uri.AppendPath(applicationId, false);
 0566            uri.AppendQuery("api-version", "2018-06-01", true);
 0567            request.Uri = uri;
 0568            return message;
 569        }
 570
 571        /// <summary> Gets the managed application. </summary>
 572        /// <param name="applicationId"> The fully qualified ID of the managed application, including the managed applic
 573        /// <param name="cancellationToken"> The cancellation token to use. </param>
 574        public async Task<Response<Application>> GetByIdAsync(string applicationId, CancellationToken cancellationToken 
 575        {
 0576            if (applicationId == null)
 577            {
 0578                throw new ArgumentNullException(nameof(applicationId));
 579            }
 580
 0581            using var message = CreateGetByIdRequest(applicationId);
 0582            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0583            switch (message.Response.Status)
 584            {
 585                case 200:
 586                    {
 0587                        Application value = default;
 0588                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0589                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 590                        {
 0591                            value = null;
 592                        }
 593                        else
 594                        {
 0595                            value = Application.DeserializeApplication(document.RootElement);
 596                        }
 0597                        return Response.FromValue(value, message.Response);
 598                    }
 599                case 404:
 0600                    return Response.FromValue<Application>(null, message.Response);
 601                default:
 0602                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 603            }
 0604        }
 605
 606        /// <summary> Gets the managed application. </summary>
 607        /// <param name="applicationId"> The fully qualified ID of the managed application, including the managed applic
 608        /// <param name="cancellationToken"> The cancellation token to use. </param>
 609        public Response<Application> GetById(string applicationId, CancellationToken cancellationToken = default)
 610        {
 0611            if (applicationId == null)
 612            {
 0613                throw new ArgumentNullException(nameof(applicationId));
 614            }
 615
 0616            using var message = CreateGetByIdRequest(applicationId);
 0617            _pipeline.Send(message, cancellationToken);
 0618            switch (message.Response.Status)
 619            {
 620                case 200:
 621                    {
 0622                        Application value = default;
 0623                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0624                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 625                        {
 0626                            value = null;
 627                        }
 628                        else
 629                        {
 0630                            value = Application.DeserializeApplication(document.RootElement);
 631                        }
 0632                        return Response.FromValue(value, message.Response);
 633                    }
 634                case 404:
 0635                    return Response.FromValue<Application>(null, message.Response);
 636                default:
 0637                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 638            }
 0639        }
 640
 641        internal Core.HttpMessage CreateDeleteByIdRequest(string applicationId)
 642        {
 0643            var message = _pipeline.CreateMessage();
 0644            var request = message.Request;
 0645            request.Method = RequestMethod.Delete;
 0646            var uri = new RawRequestUriBuilder();
 0647            uri.Reset(endpoint);
 0648            uri.AppendPath("/", false);
 0649            uri.AppendPath(applicationId, false);
 0650            uri.AppendQuery("api-version", "2018-06-01", true);
 0651            request.Uri = uri;
 0652            return message;
 653        }
 654
 655        /// <summary> Deletes the managed application. </summary>
 656        /// <param name="applicationId"> The fully qualified ID of the managed application, including the managed applic
 657        /// <param name="cancellationToken"> The cancellation token to use. </param>
 658        public async Task<Response> DeleteByIdAsync(string applicationId, CancellationToken cancellationToken = default)
 659        {
 0660            if (applicationId == null)
 661            {
 0662                throw new ArgumentNullException(nameof(applicationId));
 663            }
 664
 0665            using var message = CreateDeleteByIdRequest(applicationId);
 0666            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0667            switch (message.Response.Status)
 668            {
 669                case 202:
 670                case 204:
 0671                    return message.Response;
 672                default:
 0673                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 674            }
 0675        }
 676
 677        /// <summary> Deletes the managed application. </summary>
 678        /// <param name="applicationId"> The fully qualified ID of the managed application, including the managed applic
 679        /// <param name="cancellationToken"> The cancellation token to use. </param>
 680        public Response DeleteById(string applicationId, CancellationToken cancellationToken = default)
 681        {
 0682            if (applicationId == null)
 683            {
 0684                throw new ArgumentNullException(nameof(applicationId));
 685            }
 686
 0687            using var message = CreateDeleteByIdRequest(applicationId);
 0688            _pipeline.Send(message, cancellationToken);
 0689            switch (message.Response.Status)
 690            {
 691                case 202:
 692                case 204:
 0693                    return message.Response;
 694                default:
 0695                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 696            }
 0697        }
 698
 699        internal Core.HttpMessage CreateCreateOrUpdateByIdRequest(string applicationId, Application parameters)
 700        {
 0701            var message = _pipeline.CreateMessage();
 0702            var request = message.Request;
 0703            request.Method = RequestMethod.Put;
 0704            var uri = new RawRequestUriBuilder();
 0705            uri.Reset(endpoint);
 0706            uri.AppendPath("/", false);
 0707            uri.AppendPath(applicationId, false);
 0708            uri.AppendQuery("api-version", "2018-06-01", true);
 0709            request.Uri = uri;
 0710            request.Headers.Add("Content-Type", "application/json");
 0711            var content = new Utf8JsonRequestContent();
 0712            content.JsonWriter.WriteObjectValue(parameters);
 0713            request.Content = content;
 0714            return message;
 715        }
 716
 717        /// <summary> Creates a new managed application. </summary>
 718        /// <param name="applicationId"> The fully qualified ID of the managed application, including the managed applic
 719        /// <param name="parameters"> Parameters supplied to the create or update a managed application. </param>
 720        /// <param name="cancellationToken"> The cancellation token to use. </param>
 721        public async Task<Response> CreateOrUpdateByIdAsync(string applicationId, Application parameters, CancellationTo
 722        {
 0723            if (applicationId == null)
 724            {
 0725                throw new ArgumentNullException(nameof(applicationId));
 726            }
 0727            if (parameters == null)
 728            {
 0729                throw new ArgumentNullException(nameof(parameters));
 730            }
 731
 0732            using var message = CreateCreateOrUpdateByIdRequest(applicationId, parameters);
 0733            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0734            switch (message.Response.Status)
 735            {
 736                case 200:
 737                case 201:
 0738                    return message.Response;
 739                default:
 0740                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 741            }
 0742        }
 743
 744        /// <summary> Creates a new managed application. </summary>
 745        /// <param name="applicationId"> The fully qualified ID of the managed application, including the managed applic
 746        /// <param name="parameters"> Parameters supplied to the create or update a managed application. </param>
 747        /// <param name="cancellationToken"> The cancellation token to use. </param>
 748        public Response CreateOrUpdateById(string applicationId, Application parameters, CancellationToken cancellationT
 749        {
 0750            if (applicationId == null)
 751            {
 0752                throw new ArgumentNullException(nameof(applicationId));
 753            }
 0754            if (parameters == null)
 755            {
 0756                throw new ArgumentNullException(nameof(parameters));
 757            }
 758
 0759            using var message = CreateCreateOrUpdateByIdRequest(applicationId, parameters);
 0760            _pipeline.Send(message, cancellationToken);
 0761            switch (message.Response.Status)
 762            {
 763                case 200:
 764                case 201:
 0765                    return message.Response;
 766                default:
 0767                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 768            }
 0769        }
 770
 771        internal Core.HttpMessage CreateUpdateByIdRequest(string applicationId, Application parameters)
 772        {
 0773            var message = _pipeline.CreateMessage();
 0774            var request = message.Request;
 0775            request.Method = RequestMethod.Patch;
 0776            var uri = new RawRequestUriBuilder();
 0777            uri.Reset(endpoint);
 0778            uri.AppendPath("/", false);
 0779            uri.AppendPath(applicationId, false);
 0780            uri.AppendQuery("api-version", "2018-06-01", true);
 0781            request.Uri = uri;
 0782            request.Headers.Add("Content-Type", "application/json");
 0783            if (parameters != null)
 784            {
 0785                var content = new Utf8JsonRequestContent();
 0786                content.JsonWriter.WriteObjectValue(parameters);
 0787                request.Content = content;
 788            }
 0789            return message;
 790        }
 791
 792        /// <summary> Updates an existing managed application. The only value that can be updated via PATCH currently is
 793        /// <param name="applicationId"> The fully qualified ID of the managed application, including the managed applic
 794        /// <param name="parameters"> Parameters supplied to update an existing managed application. </param>
 795        /// <param name="cancellationToken"> The cancellation token to use. </param>
 796        public async Task<Response<Application>> UpdateByIdAsync(string applicationId, Application parameters = null, Ca
 797        {
 0798            if (applicationId == null)
 799            {
 0800                throw new ArgumentNullException(nameof(applicationId));
 801            }
 802
 0803            using var message = CreateUpdateByIdRequest(applicationId, parameters);
 0804            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0805            switch (message.Response.Status)
 806            {
 807                case 200:
 808                    {
 0809                        Application value = default;
 0810                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0811                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 812                        {
 0813                            value = null;
 814                        }
 815                        else
 816                        {
 0817                            value = Application.DeserializeApplication(document.RootElement);
 818                        }
 0819                        return Response.FromValue(value, message.Response);
 820                    }
 821                default:
 0822                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 823            }
 0824        }
 825
 826        /// <summary> Updates an existing managed application. The only value that can be updated via PATCH currently is
 827        /// <param name="applicationId"> The fully qualified ID of the managed application, including the managed applic
 828        /// <param name="parameters"> Parameters supplied to update an existing managed application. </param>
 829        /// <param name="cancellationToken"> The cancellation token to use. </param>
 830        public Response<Application> UpdateById(string applicationId, Application parameters = null, CancellationToken c
 831        {
 0832            if (applicationId == null)
 833            {
 0834                throw new ArgumentNullException(nameof(applicationId));
 835            }
 836
 0837            using var message = CreateUpdateByIdRequest(applicationId, parameters);
 0838            _pipeline.Send(message, cancellationToken);
 0839            switch (message.Response.Status)
 840            {
 841                case 200:
 842                    {
 0843                        Application value = default;
 0844                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0845                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 846                        {
 0847                            value = null;
 848                        }
 849                        else
 850                        {
 0851                            value = Application.DeserializeApplication(document.RootElement);
 852                        }
 0853                        return Response.FromValue(value, message.Response);
 854                    }
 855                default:
 0856                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 857            }
 0858        }
 859
 860        internal Core.HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName)
 861        {
 0862            var message = _pipeline.CreateMessage();
 0863            var request = message.Request;
 0864            request.Method = RequestMethod.Get;
 0865            var uri = new RawRequestUriBuilder();
 0866            uri.Reset(endpoint);
 0867            uri.AppendRawNextLink(nextLink, false);
 0868            request.Uri = uri;
 0869            return message;
 870        }
 871
 872        /// <summary> Gets all the applications within a resource group. </summary>
 873        /// <param name="nextLink"> The URL to the next page of results. </param>
 874        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 875        /// <param name="cancellationToken"> The cancellation token to use. </param>
 876        public async Task<Response<ApplicationListResult>> ListByResourceGroupNextPageAsync(string nextLink, string reso
 877        {
 0878            if (nextLink == null)
 879            {
 0880                throw new ArgumentNullException(nameof(nextLink));
 881            }
 0882            if (resourceGroupName == null)
 883            {
 0884                throw new ArgumentNullException(nameof(resourceGroupName));
 885            }
 886
 0887            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName);
 0888            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0889            switch (message.Response.Status)
 890            {
 891                case 200:
 892                    {
 0893                        ApplicationListResult value = default;
 0894                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0895                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 896                        {
 0897                            value = null;
 898                        }
 899                        else
 900                        {
 0901                            value = ApplicationListResult.DeserializeApplicationListResult(document.RootElement);
 902                        }
 0903                        return Response.FromValue(value, message.Response);
 904                    }
 905                default:
 0906                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 907            }
 0908        }
 909
 910        /// <summary> Gets all the applications within a resource group. </summary>
 911        /// <param name="nextLink"> The URL to the next page of results. </param>
 912        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 913        /// <param name="cancellationToken"> The cancellation token to use. </param>
 914        public Response<ApplicationListResult> ListByResourceGroupNextPage(string nextLink, string resourceGroupName, Ca
 915        {
 0916            if (nextLink == null)
 917            {
 0918                throw new ArgumentNullException(nameof(nextLink));
 919            }
 0920            if (resourceGroupName == null)
 921            {
 0922                throw new ArgumentNullException(nameof(resourceGroupName));
 923            }
 924
 0925            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName);
 0926            _pipeline.Send(message, cancellationToken);
 0927            switch (message.Response.Status)
 928            {
 929                case 200:
 930                    {
 0931                        ApplicationListResult value = default;
 0932                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0933                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 934                        {
 0935                            value = null;
 936                        }
 937                        else
 938                        {
 0939                            value = ApplicationListResult.DeserializeApplicationListResult(document.RootElement);
 940                        }
 0941                        return Response.FromValue(value, message.Response);
 942                    }
 943                default:
 0944                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 945            }
 0946        }
 947
 948        internal Core.HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink)
 949        {
 0950            var message = _pipeline.CreateMessage();
 0951            var request = message.Request;
 0952            request.Method = RequestMethod.Get;
 0953            var uri = new RawRequestUriBuilder();
 0954            uri.Reset(endpoint);
 0955            uri.AppendRawNextLink(nextLink, false);
 0956            request.Uri = uri;
 0957            return message;
 958        }
 959
 960        /// <summary> Gets all the applications within a subscription. </summary>
 961        /// <param name="nextLink"> The URL to the next page of results. </param>
 962        /// <param name="cancellationToken"> The cancellation token to use. </param>
 963        public async Task<Response<ApplicationListResult>> ListBySubscriptionNextPageAsync(string nextLink, Cancellation
 964        {
 0965            if (nextLink == null)
 966            {
 0967                throw new ArgumentNullException(nameof(nextLink));
 968            }
 969
 0970            using var message = CreateListBySubscriptionNextPageRequest(nextLink);
 0971            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0972            switch (message.Response.Status)
 973            {
 974                case 200:
 975                    {
 0976                        ApplicationListResult value = default;
 0977                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0978                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 979                        {
 0980                            value = null;
 981                        }
 982                        else
 983                        {
 0984                            value = ApplicationListResult.DeserializeApplicationListResult(document.RootElement);
 985                        }
 0986                        return Response.FromValue(value, message.Response);
 987                    }
 988                default:
 0989                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 990            }
 0991        }
 992
 993        /// <summary> Gets all the applications within a subscription. </summary>
 994        /// <param name="nextLink"> The URL to the next page of results. </param>
 995        /// <param name="cancellationToken"> The cancellation token to use. </param>
 996        public Response<ApplicationListResult> ListBySubscriptionNextPage(string nextLink, CancellationToken cancellatio
 997        {
 0998            if (nextLink == null)
 999            {
 01000                throw new ArgumentNullException(nameof(nextLink));
 1001            }
 1002
 01003            using var message = CreateListBySubscriptionNextPageRequest(nextLink);
 01004            _pipeline.Send(message, cancellationToken);
 01005            switch (message.Response.Status)
 1006            {
 1007                case 200:
 1008                    {
 01009                        ApplicationListResult value = default;
 01010                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 01011                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1012                        {
 01013                            value = null;
 1014                        }
 1015                        else
 1016                        {
 01017                            value = ApplicationListResult.DeserializeApplicationListResult(document.RootElement);
 1018                        }
 01019                        return Response.FromValue(value, message.Response);
 1020                    }
 1021                default:
 01022                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1023            }
 01024        }
 1025    }
 1026}