< Summary

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

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%
CreateListByResourceGroupRequest(...)-0%100%
ListByResourceGroupAsync()-0%0%
ListByResourceGroup(...)-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%
CreateListByResourceGroupNextPageRequest(...)-0%100%
ListByResourceGroupNextPageAsync()-0%0%
ListByResourceGroupNextPage(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\ApplicationDefinitionsRestOperations.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 ApplicationDefinitionsRestOperations
 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 ApplicationDefinitionsRestOperations. </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 ApplicationDefinitionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string s
 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 applicationDefinitionName)
 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/applicationDefinitions/", false);
 058            uri.AppendPath(applicationDefinitionName, 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 definition. </summary>
 65        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 66        /// <param name="applicationDefinitionName"> The name of the managed application definition. </param>
 67        /// <param name="cancellationToken"> The cancellation token to use. </param>
 68        public async Task<Response<ApplicationDefinition>> GetAsync(string resourceGroupName, string applicationDefiniti
 69        {
 070            if (resourceGroupName == null)
 71            {
 072                throw new ArgumentNullException(nameof(resourceGroupName));
 73            }
 074            if (applicationDefinitionName == null)
 75            {
 076                throw new ArgumentNullException(nameof(applicationDefinitionName));
 77            }
 78
 079            using var message = CreateGetRequest(resourceGroupName, applicationDefinitionName);
 080            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 081            switch (message.Response.Status)
 82            {
 83                case 200:
 84                    {
 085                        ApplicationDefinition 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 = ApplicationDefinition.DeserializeApplicationDefinition(document.RootElement);
 94                        }
 095                        return Response.FromValue(value, message.Response);
 96                    }
 97                case 404:
 098                    return Response.FromValue<ApplicationDefinition>(null, message.Response);
 99                default:
 0100                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 101            }
 0102        }
 103
 104        /// <summary> Gets the managed application definition. </summary>
 105        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 106        /// <param name="applicationDefinitionName"> The name of the managed application definition. </param>
 107        /// <param name="cancellationToken"> The cancellation token to use. </param>
 108        public Response<ApplicationDefinition> Get(string resourceGroupName, string applicationDefinitionName, Cancellat
 109        {
 0110            if (resourceGroupName == null)
 111            {
 0112                throw new ArgumentNullException(nameof(resourceGroupName));
 113            }
 0114            if (applicationDefinitionName == null)
 115            {
 0116                throw new ArgumentNullException(nameof(applicationDefinitionName));
 117            }
 118
 0119            using var message = CreateGetRequest(resourceGroupName, applicationDefinitionName);
 0120            _pipeline.Send(message, cancellationToken);
 0121            switch (message.Response.Status)
 122            {
 123                case 200:
 124                    {
 0125                        ApplicationDefinition 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 = ApplicationDefinition.DeserializeApplicationDefinition(document.RootElement);
 134                        }
 0135                        return Response.FromValue(value, message.Response);
 136                    }
 137                case 404:
 0138                    return Response.FromValue<ApplicationDefinition>(null, message.Response);
 139                default:
 0140                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 141            }
 0142        }
 143
 144        internal Core.HttpMessage CreateDeleteRequest(string resourceGroupName, string applicationDefinitionName)
 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/applicationDefinitions/", false);
 0156            uri.AppendPath(applicationDefinitionName, 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 definition. </summary>
 163        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 164        /// <param name="applicationDefinitionName"> The name of the managed application definition to delete. </param>
 165        /// <param name="cancellationToken"> The cancellation token to use. </param>
 166        public async Task<Response> DeleteAsync(string resourceGroupName, string applicationDefinitionName, Cancellation
 167        {
 0168            if (resourceGroupName == null)
 169            {
 0170                throw new ArgumentNullException(nameof(resourceGroupName));
 171            }
 0172            if (applicationDefinitionName == null)
 173            {
 0174                throw new ArgumentNullException(nameof(applicationDefinitionName));
 175            }
 176
 0177            using var message = CreateDeleteRequest(resourceGroupName, applicationDefinitionName);
 0178            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0179            switch (message.Response.Status)
 180            {
 181                case 200:
 182                case 202:
 183                case 204:
 0184                    return message.Response;
 185                default:
 0186                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 187            }
 0188        }
 189
 190        /// <summary> Deletes the managed application definition. </summary>
 191        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 192        /// <param name="applicationDefinitionName"> The name of the managed application definition to delete. </param>
 193        /// <param name="cancellationToken"> The cancellation token to use. </param>
 194        public Response Delete(string resourceGroupName, string applicationDefinitionName, CancellationToken cancellatio
 195        {
 0196            if (resourceGroupName == null)
 197            {
 0198                throw new ArgumentNullException(nameof(resourceGroupName));
 199            }
 0200            if (applicationDefinitionName == null)
 201            {
 0202                throw new ArgumentNullException(nameof(applicationDefinitionName));
 203            }
 204
 0205            using var message = CreateDeleteRequest(resourceGroupName, applicationDefinitionName);
 0206            _pipeline.Send(message, cancellationToken);
 0207            switch (message.Response.Status)
 208            {
 209                case 200:
 210                case 202:
 211                case 204:
 0212                    return message.Response;
 213                default:
 0214                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 215            }
 0216        }
 217
 218        internal Core.HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string applicationDefinitionName
 219        {
 0220            var message = _pipeline.CreateMessage();
 0221            var request = message.Request;
 0222            request.Method = RequestMethod.Put;
 0223            var uri = new RawRequestUriBuilder();
 0224            uri.Reset(endpoint);
 0225            uri.AppendPath("/subscriptions/", false);
 0226            uri.AppendPath(subscriptionId, true);
 0227            uri.AppendPath("/resourceGroups/", false);
 0228            uri.AppendPath(resourceGroupName, true);
 0229            uri.AppendPath("/providers/Microsoft.Solutions/applicationDefinitions/", false);
 0230            uri.AppendPath(applicationDefinitionName, true);
 0231            uri.AppendQuery("api-version", "2018-06-01", true);
 0232            request.Uri = uri;
 0233            request.Headers.Add("Content-Type", "application/json");
 0234            var content = new Utf8JsonRequestContent();
 0235            content.JsonWriter.WriteObjectValue(parameters);
 0236            request.Content = content;
 0237            return message;
 238        }
 239
 240        /// <summary> Creates a new managed application definition. </summary>
 241        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 242        /// <param name="applicationDefinitionName"> The name of the managed application definition. </param>
 243        /// <param name="parameters"> Parameters supplied to the create or update an managed application definition. </p
 244        /// <param name="cancellationToken"> The cancellation token to use. </param>
 245        public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string applicationDefinitionName, Appl
 246        {
 0247            if (resourceGroupName == null)
 248            {
 0249                throw new ArgumentNullException(nameof(resourceGroupName));
 250            }
 0251            if (applicationDefinitionName == null)
 252            {
 0253                throw new ArgumentNullException(nameof(applicationDefinitionName));
 254            }
 0255            if (parameters == null)
 256            {
 0257                throw new ArgumentNullException(nameof(parameters));
 258            }
 259
 0260            using var message = CreateCreateOrUpdateRequest(resourceGroupName, applicationDefinitionName, parameters);
 0261            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0262            switch (message.Response.Status)
 263            {
 264                case 200:
 265                case 201:
 0266                    return message.Response;
 267                default:
 0268                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 269            }
 0270        }
 271
 272        /// <summary> Creates a new managed application definition. </summary>
 273        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 274        /// <param name="applicationDefinitionName"> The name of the managed application definition. </param>
 275        /// <param name="parameters"> Parameters supplied to the create or update an managed application definition. </p
 276        /// <param name="cancellationToken"> The cancellation token to use. </param>
 277        public Response CreateOrUpdate(string resourceGroupName, string applicationDefinitionName, ApplicationDefinition
 278        {
 0279            if (resourceGroupName == null)
 280            {
 0281                throw new ArgumentNullException(nameof(resourceGroupName));
 282            }
 0283            if (applicationDefinitionName == null)
 284            {
 0285                throw new ArgumentNullException(nameof(applicationDefinitionName));
 286            }
 0287            if (parameters == null)
 288            {
 0289                throw new ArgumentNullException(nameof(parameters));
 290            }
 291
 0292            using var message = CreateCreateOrUpdateRequest(resourceGroupName, applicationDefinitionName, parameters);
 0293            _pipeline.Send(message, cancellationToken);
 0294            switch (message.Response.Status)
 295            {
 296                case 200:
 297                case 201:
 0298                    return message.Response;
 299                default:
 0300                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 301            }
 0302        }
 303
 304        internal Core.HttpMessage CreateListByResourceGroupRequest(string resourceGroupName)
 305        {
 0306            var message = _pipeline.CreateMessage();
 0307            var request = message.Request;
 0308            request.Method = RequestMethod.Get;
 0309            var uri = new RawRequestUriBuilder();
 0310            uri.Reset(endpoint);
 0311            uri.AppendPath("/subscriptions/", false);
 0312            uri.AppendPath(subscriptionId, true);
 0313            uri.AppendPath("/resourceGroups/", false);
 0314            uri.AppendPath(resourceGroupName, true);
 0315            uri.AppendPath("/providers/Microsoft.Solutions/applicationDefinitions", false);
 0316            uri.AppendQuery("api-version", "2018-06-01", true);
 0317            request.Uri = uri;
 0318            return message;
 319        }
 320
 321        /// <summary> Lists the managed application definitions in a resource group. </summary>
 322        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 323        /// <param name="cancellationToken"> The cancellation token to use. </param>
 324        public async Task<Response<ApplicationDefinitionListResult>> ListByResourceGroupAsync(string resourceGroupName, 
 325        {
 0326            if (resourceGroupName == null)
 327            {
 0328                throw new ArgumentNullException(nameof(resourceGroupName));
 329            }
 330
 0331            using var message = CreateListByResourceGroupRequest(resourceGroupName);
 0332            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0333            switch (message.Response.Status)
 334            {
 335                case 200:
 336                    {
 0337                        ApplicationDefinitionListResult value = default;
 0338                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0339                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 340                        {
 0341                            value = null;
 342                        }
 343                        else
 344                        {
 0345                            value = ApplicationDefinitionListResult.DeserializeApplicationDefinitionListResult(document.
 346                        }
 0347                        return Response.FromValue(value, message.Response);
 348                    }
 349                default:
 0350                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 351            }
 0352        }
 353
 354        /// <summary> Lists the managed application definitions in a resource group. </summary>
 355        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 356        /// <param name="cancellationToken"> The cancellation token to use. </param>
 357        public Response<ApplicationDefinitionListResult> ListByResourceGroup(string resourceGroupName, CancellationToken
 358        {
 0359            if (resourceGroupName == null)
 360            {
 0361                throw new ArgumentNullException(nameof(resourceGroupName));
 362            }
 363
 0364            using var message = CreateListByResourceGroupRequest(resourceGroupName);
 0365            _pipeline.Send(message, cancellationToken);
 0366            switch (message.Response.Status)
 367            {
 368                case 200:
 369                    {
 0370                        ApplicationDefinitionListResult value = default;
 0371                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0372                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 373                        {
 0374                            value = null;
 375                        }
 376                        else
 377                        {
 0378                            value = ApplicationDefinitionListResult.DeserializeApplicationDefinitionListResult(document.
 379                        }
 0380                        return Response.FromValue(value, message.Response);
 381                    }
 382                default:
 0383                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 384            }
 0385        }
 386
 387        internal Core.HttpMessage CreateGetByIdRequest(string applicationDefinitionId)
 388        {
 0389            var message = _pipeline.CreateMessage();
 0390            var request = message.Request;
 0391            request.Method = RequestMethod.Get;
 0392            var uri = new RawRequestUriBuilder();
 0393            uri.Reset(endpoint);
 0394            uri.AppendPath("/", false);
 0395            uri.AppendPath(applicationDefinitionId, false);
 0396            uri.AppendQuery("api-version", "2018-06-01", true);
 0397            request.Uri = uri;
 0398            return message;
 399        }
 400
 401        /// <summary> Gets the managed application definition. </summary>
 402        /// <param name="applicationDefinitionId"> The fully qualified ID of the managed application definition, includi
 403        /// <param name="cancellationToken"> The cancellation token to use. </param>
 404        public async Task<Response<ApplicationDefinition>> GetByIdAsync(string applicationDefinitionId, CancellationToke
 405        {
 0406            if (applicationDefinitionId == null)
 407            {
 0408                throw new ArgumentNullException(nameof(applicationDefinitionId));
 409            }
 410
 0411            using var message = CreateGetByIdRequest(applicationDefinitionId);
 0412            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0413            switch (message.Response.Status)
 414            {
 415                case 200:
 416                    {
 0417                        ApplicationDefinition value = default;
 0418                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0419                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 420                        {
 0421                            value = null;
 422                        }
 423                        else
 424                        {
 0425                            value = ApplicationDefinition.DeserializeApplicationDefinition(document.RootElement);
 426                        }
 0427                        return Response.FromValue(value, message.Response);
 428                    }
 429                case 404:
 0430                    return Response.FromValue<ApplicationDefinition>(null, message.Response);
 431                default:
 0432                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 433            }
 0434        }
 435
 436        /// <summary> Gets the managed application definition. </summary>
 437        /// <param name="applicationDefinitionId"> The fully qualified ID of the managed application definition, includi
 438        /// <param name="cancellationToken"> The cancellation token to use. </param>
 439        public Response<ApplicationDefinition> GetById(string applicationDefinitionId, CancellationToken cancellationTok
 440        {
 0441            if (applicationDefinitionId == null)
 442            {
 0443                throw new ArgumentNullException(nameof(applicationDefinitionId));
 444            }
 445
 0446            using var message = CreateGetByIdRequest(applicationDefinitionId);
 0447            _pipeline.Send(message, cancellationToken);
 0448            switch (message.Response.Status)
 449            {
 450                case 200:
 451                    {
 0452                        ApplicationDefinition value = default;
 0453                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0454                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 455                        {
 0456                            value = null;
 457                        }
 458                        else
 459                        {
 0460                            value = ApplicationDefinition.DeserializeApplicationDefinition(document.RootElement);
 461                        }
 0462                        return Response.FromValue(value, message.Response);
 463                    }
 464                case 404:
 0465                    return Response.FromValue<ApplicationDefinition>(null, message.Response);
 466                default:
 0467                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 468            }
 0469        }
 470
 471        internal Core.HttpMessage CreateDeleteByIdRequest(string applicationDefinitionId)
 472        {
 0473            var message = _pipeline.CreateMessage();
 0474            var request = message.Request;
 0475            request.Method = RequestMethod.Delete;
 0476            var uri = new RawRequestUriBuilder();
 0477            uri.Reset(endpoint);
 0478            uri.AppendPath("/", false);
 0479            uri.AppendPath(applicationDefinitionId, false);
 0480            uri.AppendQuery("api-version", "2018-06-01", true);
 0481            request.Uri = uri;
 0482            return message;
 483        }
 484
 485        /// <summary> Deletes the managed application definition. </summary>
 486        /// <param name="applicationDefinitionId"> The fully qualified ID of the managed application definition, includi
 487        /// <param name="cancellationToken"> The cancellation token to use. </param>
 488        public async Task<Response> DeleteByIdAsync(string applicationDefinitionId, CancellationToken cancellationToken 
 489        {
 0490            if (applicationDefinitionId == null)
 491            {
 0492                throw new ArgumentNullException(nameof(applicationDefinitionId));
 493            }
 494
 0495            using var message = CreateDeleteByIdRequest(applicationDefinitionId);
 0496            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0497            switch (message.Response.Status)
 498            {
 499                case 200:
 500                case 202:
 501                case 204:
 0502                    return message.Response;
 503                default:
 0504                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 505            }
 0506        }
 507
 508        /// <summary> Deletes the managed application definition. </summary>
 509        /// <param name="applicationDefinitionId"> The fully qualified ID of the managed application definition, includi
 510        /// <param name="cancellationToken"> The cancellation token to use. </param>
 511        public Response DeleteById(string applicationDefinitionId, CancellationToken cancellationToken = default)
 512        {
 0513            if (applicationDefinitionId == null)
 514            {
 0515                throw new ArgumentNullException(nameof(applicationDefinitionId));
 516            }
 517
 0518            using var message = CreateDeleteByIdRequest(applicationDefinitionId);
 0519            _pipeline.Send(message, cancellationToken);
 0520            switch (message.Response.Status)
 521            {
 522                case 200:
 523                case 202:
 524                case 204:
 0525                    return message.Response;
 526                default:
 0527                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 528            }
 0529        }
 530
 531        internal Core.HttpMessage CreateCreateOrUpdateByIdRequest(string applicationDefinitionId, ApplicationDefinition 
 532        {
 0533            var message = _pipeline.CreateMessage();
 0534            var request = message.Request;
 0535            request.Method = RequestMethod.Put;
 0536            var uri = new RawRequestUriBuilder();
 0537            uri.Reset(endpoint);
 0538            uri.AppendPath("/", false);
 0539            uri.AppendPath(applicationDefinitionId, false);
 0540            uri.AppendQuery("api-version", "2018-06-01", true);
 0541            request.Uri = uri;
 0542            request.Headers.Add("Content-Type", "application/json");
 0543            var content = new Utf8JsonRequestContent();
 0544            content.JsonWriter.WriteObjectValue(parameters);
 0545            request.Content = content;
 0546            return message;
 547        }
 548
 549        /// <summary> Creates a new managed application definition. </summary>
 550        /// <param name="applicationDefinitionId"> The fully qualified ID of the managed application definition, includi
 551        /// <param name="parameters"> Parameters supplied to the create or update a managed application definition. </pa
 552        /// <param name="cancellationToken"> The cancellation token to use. </param>
 553        public async Task<Response> CreateOrUpdateByIdAsync(string applicationDefinitionId, ApplicationDefinition parame
 554        {
 0555            if (applicationDefinitionId == null)
 556            {
 0557                throw new ArgumentNullException(nameof(applicationDefinitionId));
 558            }
 0559            if (parameters == null)
 560            {
 0561                throw new ArgumentNullException(nameof(parameters));
 562            }
 563
 0564            using var message = CreateCreateOrUpdateByIdRequest(applicationDefinitionId, parameters);
 0565            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0566            switch (message.Response.Status)
 567            {
 568                case 200:
 569                case 201:
 0570                    return message.Response;
 571                default:
 0572                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 573            }
 0574        }
 575
 576        /// <summary> Creates a new managed application definition. </summary>
 577        /// <param name="applicationDefinitionId"> The fully qualified ID of the managed application definition, includi
 578        /// <param name="parameters"> Parameters supplied to the create or update a managed application definition. </pa
 579        /// <param name="cancellationToken"> The cancellation token to use. </param>
 580        public Response CreateOrUpdateById(string applicationDefinitionId, ApplicationDefinition parameters, Cancellatio
 581        {
 0582            if (applicationDefinitionId == null)
 583            {
 0584                throw new ArgumentNullException(nameof(applicationDefinitionId));
 585            }
 0586            if (parameters == null)
 587            {
 0588                throw new ArgumentNullException(nameof(parameters));
 589            }
 590
 0591            using var message = CreateCreateOrUpdateByIdRequest(applicationDefinitionId, parameters);
 0592            _pipeline.Send(message, cancellationToken);
 0593            switch (message.Response.Status)
 594            {
 595                case 200:
 596                case 201:
 0597                    return message.Response;
 598                default:
 0599                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 600            }
 0601        }
 602
 603        internal Core.HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName)
 604        {
 0605            var message = _pipeline.CreateMessage();
 0606            var request = message.Request;
 0607            request.Method = RequestMethod.Get;
 0608            var uri = new RawRequestUriBuilder();
 0609            uri.Reset(endpoint);
 0610            uri.AppendRawNextLink(nextLink, false);
 0611            request.Uri = uri;
 0612            return message;
 613        }
 614
 615        /// <summary> Lists the managed application definitions in a resource group. </summary>
 616        /// <param name="nextLink"> The URL to the next page of results. </param>
 617        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 618        /// <param name="cancellationToken"> The cancellation token to use. </param>
 619        public async Task<Response<ApplicationDefinitionListResult>> ListByResourceGroupNextPageAsync(string nextLink, s
 620        {
 0621            if (nextLink == null)
 622            {
 0623                throw new ArgumentNullException(nameof(nextLink));
 624            }
 0625            if (resourceGroupName == null)
 626            {
 0627                throw new ArgumentNullException(nameof(resourceGroupName));
 628            }
 629
 0630            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName);
 0631            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0632            switch (message.Response.Status)
 633            {
 634                case 200:
 635                    {
 0636                        ApplicationDefinitionListResult value = default;
 0637                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0638                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 639                        {
 0640                            value = null;
 641                        }
 642                        else
 643                        {
 0644                            value = ApplicationDefinitionListResult.DeserializeApplicationDefinitionListResult(document.
 645                        }
 0646                        return Response.FromValue(value, message.Response);
 647                    }
 648                default:
 0649                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 650            }
 0651        }
 652
 653        /// <summary> Lists the managed application definitions in a resource group. </summary>
 654        /// <param name="nextLink"> The URL to the next page of results. </param>
 655        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 656        /// <param name="cancellationToken"> The cancellation token to use. </param>
 657        public Response<ApplicationDefinitionListResult> ListByResourceGroupNextPage(string nextLink, string resourceGro
 658        {
 0659            if (nextLink == null)
 660            {
 0661                throw new ArgumentNullException(nameof(nextLink));
 662            }
 0663            if (resourceGroupName == null)
 664            {
 0665                throw new ArgumentNullException(nameof(resourceGroupName));
 666            }
 667
 0668            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName);
 0669            _pipeline.Send(message, cancellationToken);
 0670            switch (message.Response.Status)
 671            {
 672                case 200:
 673                    {
 0674                        ApplicationDefinitionListResult value = default;
 0675                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0676                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 677                        {
 0678                            value = null;
 679                        }
 680                        else
 681                        {
 0682                            value = ApplicationDefinitionListResult.DeserializeApplicationDefinitionListResult(document.
 683                        }
 0684                        return Response.FromValue(value, message.Response);
 685                    }
 686                default:
 0687                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 688            }
 0689        }
 690    }
 691}