< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
CreateCreateOrUpdateAtResourceGroupLevelRequest(...)-0%100%
CreateOrUpdateAtResourceGroupLevelAsync()-0%0%
CreateOrUpdateAtResourceGroupLevel(...)-0%0%
CreateDeleteAtResourceGroupLevelRequest(...)-0%100%
DeleteAtResourceGroupLevelAsync()-0%0%
DeleteAtResourceGroupLevel(...)-0%0%
CreateGetAtResourceGroupLevelRequest(...)-0%100%
GetAtResourceGroupLevelAsync()-0%0%
GetAtResourceGroupLevel(...)-0%0%
CreateCreateOrUpdateByScopeRequest(...)-0%100%
CreateOrUpdateByScopeAsync()-0%0%
CreateOrUpdateByScope(...)-0%0%
CreateDeleteByScopeRequest(...)-0%100%
DeleteByScopeAsync()-0%0%
DeleteByScope(...)-0%0%
CreateGetByScopeRequest(...)-0%100%
GetByScopeAsync()-0%0%
GetByScope(...)-0%0%
CreateCreateOrUpdateAtResourceLevelRequest(...)-0%100%
CreateOrUpdateAtResourceLevelAsync()-0%0%
CreateOrUpdateAtResourceLevel(...)-0%0%
CreateDeleteAtResourceLevelRequest(...)-0%100%
DeleteAtResourceLevelAsync()-0%0%
DeleteAtResourceLevel(...)-0%0%
CreateGetAtResourceLevelRequest(...)-0%100%
GetAtResourceLevelAsync()-0%0%
GetAtResourceLevel(...)-0%0%
CreateCreateOrUpdateAtSubscriptionLevelRequest(...)-0%100%
CreateOrUpdateAtSubscriptionLevelAsync()-0%0%
CreateOrUpdateAtSubscriptionLevel(...)-0%0%
CreateDeleteAtSubscriptionLevelRequest(...)-0%100%
DeleteAtSubscriptionLevelAsync()-0%0%
DeleteAtSubscriptionLevel(...)-0%0%
CreateGetAtSubscriptionLevelRequest(...)-0%100%
GetAtSubscriptionLevelAsync()-0%0%
GetAtSubscriptionLevel(...)-0%0%
CreateListAtResourceGroupLevelRequest(...)-0%0%
ListAtResourceGroupLevelAsync()-0%0%
ListAtResourceGroupLevel(...)-0%0%
CreateListAtResourceLevelRequest(...)-0%0%
ListAtResourceLevelAsync()-0%0%
ListAtResourceLevel(...)-0%0%
CreateListAtSubscriptionLevelRequest(...)-0%0%
ListAtSubscriptionLevelAsync()-0%0%
ListAtSubscriptionLevel(...)-0%0%
CreateListByScopeRequest(...)-0%0%
ListByScopeAsync()-0%0%
ListByScope(...)-0%0%
CreateListAtResourceGroupLevelNextPageRequest(...)-0%100%
ListAtResourceGroupLevelNextPageAsync()-0%0%
ListAtResourceGroupLevelNextPage(...)-0%0%
CreateListAtResourceLevelNextPageRequest(...)-0%100%
ListAtResourceLevelNextPageAsync()-0%0%
ListAtResourceLevelNextPage(...)-0%0%
CreateListAtSubscriptionLevelNextPageRequest(...)-0%100%
ListAtSubscriptionLevelNextPageAsync()-0%0%
ListAtSubscriptionLevelNextPage(...)-0%0%
CreateListByScopeNextPageRequest(...)-0%100%
ListByScopeNextPageAsync()-0%0%
ListByScopeNextPage(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\ManagementLocksRestOperations.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 ManagementLocksRestOperations
 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 ManagementLocksRestOperations. </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 ManagementLocksRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscrip
 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 CreateCreateOrUpdateAtResourceGroupLevelRequest(string resourceGroupName, string lockN
 47        {
 048            var message = _pipeline.CreateMessage();
 049            var request = message.Request;
 050            request.Method = RequestMethod.Put;
 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.Authorization/locks/", false);
 058            uri.AppendPath(lockName, true);
 059            uri.AppendQuery("api-version", "2016-09-01", true);
 060            request.Uri = uri;
 061            request.Headers.Add("Content-Type", "application/json");
 062            var content = new Utf8JsonRequestContent();
 063            content.JsonWriter.WriteObjectValue(parameters);
 064            request.Content = content;
 065            return message;
 66        }
 67
 68        /// <summary> When you apply a lock at a parent scope, all child resources inherit the same lock. To create mana
 69        /// <param name="resourceGroupName"> The name of the resource group to lock. </param>
 70        /// <param name="lockName"> The lock name. The lock name can be a maximum of 260 characters. It cannot contain &
 71        /// <param name="parameters"> The management lock parameters. </param>
 72        /// <param name="cancellationToken"> The cancellation token to use. </param>
 73        public async Task<Response<ManagementLockObject>> CreateOrUpdateAtResourceGroupLevelAsync(string resourceGroupNa
 74        {
 075            if (resourceGroupName == null)
 76            {
 077                throw new ArgumentNullException(nameof(resourceGroupName));
 78            }
 079            if (lockName == null)
 80            {
 081                throw new ArgumentNullException(nameof(lockName));
 82            }
 083            if (parameters == null)
 84            {
 085                throw new ArgumentNullException(nameof(parameters));
 86            }
 87
 088            using var message = CreateCreateOrUpdateAtResourceGroupLevelRequest(resourceGroupName, lockName, parameters)
 089            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 090            switch (message.Response.Status)
 91            {
 92                case 200:
 93                case 201:
 94                    {
 095                        ManagementLockObject value = default;
 096                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 097                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 98                        {
 099                            value = null;
 100                        }
 101                        else
 102                        {
 0103                            value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement);
 104                        }
 0105                        return Response.FromValue(value, message.Response);
 106                    }
 107                default:
 0108                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 109            }
 0110        }
 111
 112        /// <summary> When you apply a lock at a parent scope, all child resources inherit the same lock. To create mana
 113        /// <param name="resourceGroupName"> The name of the resource group to lock. </param>
 114        /// <param name="lockName"> The lock name. The lock name can be a maximum of 260 characters. It cannot contain &
 115        /// <param name="parameters"> The management lock parameters. </param>
 116        /// <param name="cancellationToken"> The cancellation token to use. </param>
 117        public Response<ManagementLockObject> CreateOrUpdateAtResourceGroupLevel(string resourceGroupName, string lockNa
 118        {
 0119            if (resourceGroupName == null)
 120            {
 0121                throw new ArgumentNullException(nameof(resourceGroupName));
 122            }
 0123            if (lockName == null)
 124            {
 0125                throw new ArgumentNullException(nameof(lockName));
 126            }
 0127            if (parameters == null)
 128            {
 0129                throw new ArgumentNullException(nameof(parameters));
 130            }
 131
 0132            using var message = CreateCreateOrUpdateAtResourceGroupLevelRequest(resourceGroupName, lockName, parameters)
 0133            _pipeline.Send(message, cancellationToken);
 0134            switch (message.Response.Status)
 135            {
 136                case 200:
 137                case 201:
 138                    {
 0139                        ManagementLockObject value = default;
 0140                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0141                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 142                        {
 0143                            value = null;
 144                        }
 145                        else
 146                        {
 0147                            value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement);
 148                        }
 0149                        return Response.FromValue(value, message.Response);
 150                    }
 151                default:
 0152                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 153            }
 0154        }
 155
 156        internal Core.HttpMessage CreateDeleteAtResourceGroupLevelRequest(string resourceGroupName, string lockName)
 157        {
 0158            var message = _pipeline.CreateMessage();
 0159            var request = message.Request;
 0160            request.Method = RequestMethod.Delete;
 0161            var uri = new RawRequestUriBuilder();
 0162            uri.Reset(endpoint);
 0163            uri.AppendPath("/subscriptions/", false);
 0164            uri.AppendPath(subscriptionId, true);
 0165            uri.AppendPath("/resourceGroups/", false);
 0166            uri.AppendPath(resourceGroupName, true);
 0167            uri.AppendPath("/providers/Microsoft.Authorization/locks/", false);
 0168            uri.AppendPath(lockName, true);
 0169            uri.AppendQuery("api-version", "2016-09-01", true);
 0170            request.Uri = uri;
 0171            return message;
 172        }
 173
 174        /// <summary> To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authori
 175        /// <param name="resourceGroupName"> The name of the resource group containing the lock. </param>
 176        /// <param name="lockName"> The name of lock to delete. </param>
 177        /// <param name="cancellationToken"> The cancellation token to use. </param>
 178        public async Task<Response> DeleteAtResourceGroupLevelAsync(string resourceGroupName, string lockName, Cancellat
 179        {
 0180            if (resourceGroupName == null)
 181            {
 0182                throw new ArgumentNullException(nameof(resourceGroupName));
 183            }
 0184            if (lockName == null)
 185            {
 0186                throw new ArgumentNullException(nameof(lockName));
 187            }
 188
 0189            using var message = CreateDeleteAtResourceGroupLevelRequest(resourceGroupName, lockName);
 0190            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0191            switch (message.Response.Status)
 192            {
 193                case 200:
 194                case 204:
 0195                    return message.Response;
 196                default:
 0197                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 198            }
 0199        }
 200
 201        /// <summary> To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authori
 202        /// <param name="resourceGroupName"> The name of the resource group containing the lock. </param>
 203        /// <param name="lockName"> The name of lock to delete. </param>
 204        /// <param name="cancellationToken"> The cancellation token to use. </param>
 205        public Response DeleteAtResourceGroupLevel(string resourceGroupName, string lockName, CancellationToken cancella
 206        {
 0207            if (resourceGroupName == null)
 208            {
 0209                throw new ArgumentNullException(nameof(resourceGroupName));
 210            }
 0211            if (lockName == null)
 212            {
 0213                throw new ArgumentNullException(nameof(lockName));
 214            }
 215
 0216            using var message = CreateDeleteAtResourceGroupLevelRequest(resourceGroupName, lockName);
 0217            _pipeline.Send(message, cancellationToken);
 0218            switch (message.Response.Status)
 219            {
 220                case 200:
 221                case 204:
 0222                    return message.Response;
 223                default:
 0224                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 225            }
 0226        }
 227
 228        internal Core.HttpMessage CreateGetAtResourceGroupLevelRequest(string resourceGroupName, string lockName)
 229        {
 0230            var message = _pipeline.CreateMessage();
 0231            var request = message.Request;
 0232            request.Method = RequestMethod.Get;
 0233            var uri = new RawRequestUriBuilder();
 0234            uri.Reset(endpoint);
 0235            uri.AppendPath("/subscriptions/", false);
 0236            uri.AppendPath(subscriptionId, true);
 0237            uri.AppendPath("/resourceGroups/", false);
 0238            uri.AppendPath(resourceGroupName, true);
 0239            uri.AppendPath("/providers/Microsoft.Authorization/locks/", false);
 0240            uri.AppendPath(lockName, true);
 0241            uri.AppendQuery("api-version", "2016-09-01", true);
 0242            request.Uri = uri;
 0243            return message;
 244        }
 245
 246        /// <summary> Gets a management lock at the resource group level. </summary>
 247        /// <param name="resourceGroupName"> The name of the locked resource group. </param>
 248        /// <param name="lockName"> The name of the lock to get. </param>
 249        /// <param name="cancellationToken"> The cancellation token to use. </param>
 250        public async Task<Response<ManagementLockObject>> GetAtResourceGroupLevelAsync(string resourceGroupName, string 
 251        {
 0252            if (resourceGroupName == null)
 253            {
 0254                throw new ArgumentNullException(nameof(resourceGroupName));
 255            }
 0256            if (lockName == null)
 257            {
 0258                throw new ArgumentNullException(nameof(lockName));
 259            }
 260
 0261            using var message = CreateGetAtResourceGroupLevelRequest(resourceGroupName, lockName);
 0262            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0263            switch (message.Response.Status)
 264            {
 265                case 200:
 266                    {
 0267                        ManagementLockObject value = default;
 0268                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0269                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 270                        {
 0271                            value = null;
 272                        }
 273                        else
 274                        {
 0275                            value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement);
 276                        }
 0277                        return Response.FromValue(value, message.Response);
 278                    }
 279                default:
 0280                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 281            }
 0282        }
 283
 284        /// <summary> Gets a management lock at the resource group level. </summary>
 285        /// <param name="resourceGroupName"> The name of the locked resource group. </param>
 286        /// <param name="lockName"> The name of the lock to get. </param>
 287        /// <param name="cancellationToken"> The cancellation token to use. </param>
 288        public Response<ManagementLockObject> GetAtResourceGroupLevel(string resourceGroupName, string lockName, Cancell
 289        {
 0290            if (resourceGroupName == null)
 291            {
 0292                throw new ArgumentNullException(nameof(resourceGroupName));
 293            }
 0294            if (lockName == null)
 295            {
 0296                throw new ArgumentNullException(nameof(lockName));
 297            }
 298
 0299            using var message = CreateGetAtResourceGroupLevelRequest(resourceGroupName, lockName);
 0300            _pipeline.Send(message, cancellationToken);
 0301            switch (message.Response.Status)
 302            {
 303                case 200:
 304                    {
 0305                        ManagementLockObject value = default;
 0306                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0307                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 308                        {
 0309                            value = null;
 310                        }
 311                        else
 312                        {
 0313                            value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement);
 314                        }
 0315                        return Response.FromValue(value, message.Response);
 316                    }
 317                default:
 0318                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 319            }
 0320        }
 321
 322        internal Core.HttpMessage CreateCreateOrUpdateByScopeRequest(string scope, string lockName, ManagementLockObject
 323        {
 0324            var message = _pipeline.CreateMessage();
 0325            var request = message.Request;
 0326            request.Method = RequestMethod.Put;
 0327            var uri = new RawRequestUriBuilder();
 0328            uri.Reset(endpoint);
 0329            uri.AppendPath("/", false);
 0330            uri.AppendPath(scope, true);
 0331            uri.AppendPath("/providers/Microsoft.Authorization/locks/", false);
 0332            uri.AppendPath(lockName, true);
 0333            uri.AppendQuery("api-version", "2016-09-01", true);
 0334            request.Uri = uri;
 0335            request.Headers.Add("Content-Type", "application/json");
 0336            var content = new Utf8JsonRequestContent();
 0337            content.JsonWriter.WriteObjectValue(parameters);
 0338            request.Content = content;
 0339            return message;
 340        }
 341
 342        /// <summary> Create or update a management lock by scope. </summary>
 343        /// <param name="scope"> The scope for the lock. When providing a scope for the assignment, use &apos;/subscript
 344        /// <param name="lockName"> The name of lock. </param>
 345        /// <param name="parameters"> Create or update management lock parameters. </param>
 346        /// <param name="cancellationToken"> The cancellation token to use. </param>
 347        public async Task<Response<ManagementLockObject>> CreateOrUpdateByScopeAsync(string scope, string lockName, Mana
 348        {
 0349            if (scope == null)
 350            {
 0351                throw new ArgumentNullException(nameof(scope));
 352            }
 0353            if (lockName == null)
 354            {
 0355                throw new ArgumentNullException(nameof(lockName));
 356            }
 0357            if (parameters == null)
 358            {
 0359                throw new ArgumentNullException(nameof(parameters));
 360            }
 361
 0362            using var message = CreateCreateOrUpdateByScopeRequest(scope, lockName, parameters);
 0363            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0364            switch (message.Response.Status)
 365            {
 366                case 200:
 367                case 201:
 368                    {
 0369                        ManagementLockObject value = default;
 0370                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0371                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 372                        {
 0373                            value = null;
 374                        }
 375                        else
 376                        {
 0377                            value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement);
 378                        }
 0379                        return Response.FromValue(value, message.Response);
 380                    }
 381                default:
 0382                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 383            }
 0384        }
 385
 386        /// <summary> Create or update a management lock by scope. </summary>
 387        /// <param name="scope"> The scope for the lock. When providing a scope for the assignment, use &apos;/subscript
 388        /// <param name="lockName"> The name of lock. </param>
 389        /// <param name="parameters"> Create or update management lock parameters. </param>
 390        /// <param name="cancellationToken"> The cancellation token to use. </param>
 391        public Response<ManagementLockObject> CreateOrUpdateByScope(string scope, string lockName, ManagementLockObject 
 392        {
 0393            if (scope == null)
 394            {
 0395                throw new ArgumentNullException(nameof(scope));
 396            }
 0397            if (lockName == null)
 398            {
 0399                throw new ArgumentNullException(nameof(lockName));
 400            }
 0401            if (parameters == null)
 402            {
 0403                throw new ArgumentNullException(nameof(parameters));
 404            }
 405
 0406            using var message = CreateCreateOrUpdateByScopeRequest(scope, lockName, parameters);
 0407            _pipeline.Send(message, cancellationToken);
 0408            switch (message.Response.Status)
 409            {
 410                case 200:
 411                case 201:
 412                    {
 0413                        ManagementLockObject value = default;
 0414                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0415                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 416                        {
 0417                            value = null;
 418                        }
 419                        else
 420                        {
 0421                            value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement);
 422                        }
 0423                        return Response.FromValue(value, message.Response);
 424                    }
 425                default:
 0426                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 427            }
 0428        }
 429
 430        internal Core.HttpMessage CreateDeleteByScopeRequest(string scope, string lockName)
 431        {
 0432            var message = _pipeline.CreateMessage();
 0433            var request = message.Request;
 0434            request.Method = RequestMethod.Delete;
 0435            var uri = new RawRequestUriBuilder();
 0436            uri.Reset(endpoint);
 0437            uri.AppendPath("/", false);
 0438            uri.AppendPath(scope, true);
 0439            uri.AppendPath("/providers/Microsoft.Authorization/locks/", false);
 0440            uri.AppendPath(lockName, true);
 0441            uri.AppendQuery("api-version", "2016-09-01", true);
 0442            request.Uri = uri;
 0443            return message;
 444        }
 445
 446        /// <summary> Delete a management lock by scope. </summary>
 447        /// <param name="scope"> The scope for the lock. </param>
 448        /// <param name="lockName"> The name of lock. </param>
 449        /// <param name="cancellationToken"> The cancellation token to use. </param>
 450        public async Task<Response> DeleteByScopeAsync(string scope, string lockName, CancellationToken cancellationToke
 451        {
 0452            if (scope == null)
 453            {
 0454                throw new ArgumentNullException(nameof(scope));
 455            }
 0456            if (lockName == null)
 457            {
 0458                throw new ArgumentNullException(nameof(lockName));
 459            }
 460
 0461            using var message = CreateDeleteByScopeRequest(scope, lockName);
 0462            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0463            switch (message.Response.Status)
 464            {
 465                case 200:
 466                case 204:
 0467                    return message.Response;
 468                default:
 0469                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 470            }
 0471        }
 472
 473        /// <summary> Delete a management lock by scope. </summary>
 474        /// <param name="scope"> The scope for the lock. </param>
 475        /// <param name="lockName"> The name of lock. </param>
 476        /// <param name="cancellationToken"> The cancellation token to use. </param>
 477        public Response DeleteByScope(string scope, string lockName, CancellationToken cancellationToken = default)
 478        {
 0479            if (scope == null)
 480            {
 0481                throw new ArgumentNullException(nameof(scope));
 482            }
 0483            if (lockName == null)
 484            {
 0485                throw new ArgumentNullException(nameof(lockName));
 486            }
 487
 0488            using var message = CreateDeleteByScopeRequest(scope, lockName);
 0489            _pipeline.Send(message, cancellationToken);
 0490            switch (message.Response.Status)
 491            {
 492                case 200:
 493                case 204:
 0494                    return message.Response;
 495                default:
 0496                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 497            }
 0498        }
 499
 500        internal Core.HttpMessage CreateGetByScopeRequest(string scope, string lockName)
 501        {
 0502            var message = _pipeline.CreateMessage();
 0503            var request = message.Request;
 0504            request.Method = RequestMethod.Get;
 0505            var uri = new RawRequestUriBuilder();
 0506            uri.Reset(endpoint);
 0507            uri.AppendPath("/", false);
 0508            uri.AppendPath(scope, true);
 0509            uri.AppendPath("/providers/Microsoft.Authorization/locks/", false);
 0510            uri.AppendPath(lockName, true);
 0511            uri.AppendQuery("api-version", "2016-09-01", true);
 0512            request.Uri = uri;
 0513            return message;
 514        }
 515
 516        /// <summary> Get a management lock by scope. </summary>
 517        /// <param name="scope"> The scope for the lock. </param>
 518        /// <param name="lockName"> The name of lock. </param>
 519        /// <param name="cancellationToken"> The cancellation token to use. </param>
 520        public async Task<Response<ManagementLockObject>> GetByScopeAsync(string scope, string lockName, CancellationTok
 521        {
 0522            if (scope == null)
 523            {
 0524                throw new ArgumentNullException(nameof(scope));
 525            }
 0526            if (lockName == null)
 527            {
 0528                throw new ArgumentNullException(nameof(lockName));
 529            }
 530
 0531            using var message = CreateGetByScopeRequest(scope, lockName);
 0532            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0533            switch (message.Response.Status)
 534            {
 535                case 200:
 536                    {
 0537                        ManagementLockObject value = default;
 0538                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0539                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 540                        {
 0541                            value = null;
 542                        }
 543                        else
 544                        {
 0545                            value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement);
 546                        }
 0547                        return Response.FromValue(value, message.Response);
 548                    }
 549                default:
 0550                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 551            }
 0552        }
 553
 554        /// <summary> Get a management lock by scope. </summary>
 555        /// <param name="scope"> The scope for the lock. </param>
 556        /// <param name="lockName"> The name of lock. </param>
 557        /// <param name="cancellationToken"> The cancellation token to use. </param>
 558        public Response<ManagementLockObject> GetByScope(string scope, string lockName, CancellationToken cancellationTo
 559        {
 0560            if (scope == null)
 561            {
 0562                throw new ArgumentNullException(nameof(scope));
 563            }
 0564            if (lockName == null)
 565            {
 0566                throw new ArgumentNullException(nameof(lockName));
 567            }
 568
 0569            using var message = CreateGetByScopeRequest(scope, lockName);
 0570            _pipeline.Send(message, cancellationToken);
 0571            switch (message.Response.Status)
 572            {
 573                case 200:
 574                    {
 0575                        ManagementLockObject value = default;
 0576                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0577                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 578                        {
 0579                            value = null;
 580                        }
 581                        else
 582                        {
 0583                            value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement);
 584                        }
 0585                        return Response.FromValue(value, message.Response);
 586                    }
 587                default:
 0588                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 589            }
 0590        }
 591
 592        internal Core.HttpMessage CreateCreateOrUpdateAtResourceLevelRequest(string resourceGroupName, string resourcePr
 593        {
 0594            var message = _pipeline.CreateMessage();
 0595            var request = message.Request;
 0596            request.Method = RequestMethod.Put;
 0597            var uri = new RawRequestUriBuilder();
 0598            uri.Reset(endpoint);
 0599            uri.AppendPath("/subscriptions/", false);
 0600            uri.AppendPath(subscriptionId, true);
 0601            uri.AppendPath("/resourcegroups/", false);
 0602            uri.AppendPath(resourceGroupName, true);
 0603            uri.AppendPath("/providers/", false);
 0604            uri.AppendPath(resourceProviderNamespace, true);
 0605            uri.AppendPath("/", false);
 0606            uri.AppendPath(parentResourcePath, false);
 0607            uri.AppendPath("/", false);
 0608            uri.AppendPath(resourceType, false);
 0609            uri.AppendPath("/", false);
 0610            uri.AppendPath(resourceName, true);
 0611            uri.AppendPath("/providers/Microsoft.Authorization/locks/", false);
 0612            uri.AppendPath(lockName, true);
 0613            uri.AppendQuery("api-version", "2016-09-01", true);
 0614            request.Uri = uri;
 0615            request.Headers.Add("Content-Type", "application/json");
 0616            var content = new Utf8JsonRequestContent();
 0617            content.JsonWriter.WriteObjectValue(parameters);
 0618            request.Content = content;
 0619            return message;
 620        }
 621
 622        /// <summary> When you apply a lock at a parent scope, all child resources inherit the same lock. To create mana
 623        /// <param name="resourceGroupName"> The name of the resource group containing the resource to lock. </param>
 624        /// <param name="resourceProviderNamespace"> The resource provider namespace of the resource to lock. </param>
 625        /// <param name="parentResourcePath"> The parent resource identity. </param>
 626        /// <param name="resourceType"> The resource type of the resource to lock. </param>
 627        /// <param name="resourceName"> The name of the resource to lock. </param>
 628        /// <param name="lockName"> The name of lock. The lock name can be a maximum of 260 characters. It cannot contai
 629        /// <param name="parameters"> Parameters for creating or updating a  management lock. </param>
 630        /// <param name="cancellationToken"> The cancellation token to use. </param>
 631        public async Task<Response<ManagementLockObject>> CreateOrUpdateAtResourceLevelAsync(string resourceGroupName, s
 632        {
 0633            if (resourceGroupName == null)
 634            {
 0635                throw new ArgumentNullException(nameof(resourceGroupName));
 636            }
 0637            if (resourceProviderNamespace == null)
 638            {
 0639                throw new ArgumentNullException(nameof(resourceProviderNamespace));
 640            }
 0641            if (parentResourcePath == null)
 642            {
 0643                throw new ArgumentNullException(nameof(parentResourcePath));
 644            }
 0645            if (resourceType == null)
 646            {
 0647                throw new ArgumentNullException(nameof(resourceType));
 648            }
 0649            if (resourceName == null)
 650            {
 0651                throw new ArgumentNullException(nameof(resourceName));
 652            }
 0653            if (lockName == null)
 654            {
 0655                throw new ArgumentNullException(nameof(lockName));
 656            }
 0657            if (parameters == null)
 658            {
 0659                throw new ArgumentNullException(nameof(parameters));
 660            }
 661
 0662            using var message = CreateCreateOrUpdateAtResourceLevelRequest(resourceGroupName, resourceProviderNamespace,
 0663            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0664            switch (message.Response.Status)
 665            {
 666                case 200:
 667                case 201:
 668                    {
 0669                        ManagementLockObject value = default;
 0670                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0671                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 672                        {
 0673                            value = null;
 674                        }
 675                        else
 676                        {
 0677                            value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement);
 678                        }
 0679                        return Response.FromValue(value, message.Response);
 680                    }
 681                default:
 0682                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 683            }
 0684        }
 685
 686        /// <summary> When you apply a lock at a parent scope, all child resources inherit the same lock. To create mana
 687        /// <param name="resourceGroupName"> The name of the resource group containing the resource to lock. </param>
 688        /// <param name="resourceProviderNamespace"> The resource provider namespace of the resource to lock. </param>
 689        /// <param name="parentResourcePath"> The parent resource identity. </param>
 690        /// <param name="resourceType"> The resource type of the resource to lock. </param>
 691        /// <param name="resourceName"> The name of the resource to lock. </param>
 692        /// <param name="lockName"> The name of lock. The lock name can be a maximum of 260 characters. It cannot contai
 693        /// <param name="parameters"> Parameters for creating or updating a  management lock. </param>
 694        /// <param name="cancellationToken"> The cancellation token to use. </param>
 695        public Response<ManagementLockObject> CreateOrUpdateAtResourceLevel(string resourceGroupName, string resourcePro
 696        {
 0697            if (resourceGroupName == null)
 698            {
 0699                throw new ArgumentNullException(nameof(resourceGroupName));
 700            }
 0701            if (resourceProviderNamespace == null)
 702            {
 0703                throw new ArgumentNullException(nameof(resourceProviderNamespace));
 704            }
 0705            if (parentResourcePath == null)
 706            {
 0707                throw new ArgumentNullException(nameof(parentResourcePath));
 708            }
 0709            if (resourceType == null)
 710            {
 0711                throw new ArgumentNullException(nameof(resourceType));
 712            }
 0713            if (resourceName == null)
 714            {
 0715                throw new ArgumentNullException(nameof(resourceName));
 716            }
 0717            if (lockName == null)
 718            {
 0719                throw new ArgumentNullException(nameof(lockName));
 720            }
 0721            if (parameters == null)
 722            {
 0723                throw new ArgumentNullException(nameof(parameters));
 724            }
 725
 0726            using var message = CreateCreateOrUpdateAtResourceLevelRequest(resourceGroupName, resourceProviderNamespace,
 0727            _pipeline.Send(message, cancellationToken);
 0728            switch (message.Response.Status)
 729            {
 730                case 200:
 731                case 201:
 732                    {
 0733                        ManagementLockObject value = default;
 0734                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0735                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 736                        {
 0737                            value = null;
 738                        }
 739                        else
 740                        {
 0741                            value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement);
 742                        }
 0743                        return Response.FromValue(value, message.Response);
 744                    }
 745                default:
 0746                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 747            }
 0748        }
 749
 750        internal Core.HttpMessage CreateDeleteAtResourceLevelRequest(string resourceGroupName, string resourceProviderNa
 751        {
 0752            var message = _pipeline.CreateMessage();
 0753            var request = message.Request;
 0754            request.Method = RequestMethod.Delete;
 0755            var uri = new RawRequestUriBuilder();
 0756            uri.Reset(endpoint);
 0757            uri.AppendPath("/subscriptions/", false);
 0758            uri.AppendPath(subscriptionId, true);
 0759            uri.AppendPath("/resourcegroups/", false);
 0760            uri.AppendPath(resourceGroupName, true);
 0761            uri.AppendPath("/providers/", false);
 0762            uri.AppendPath(resourceProviderNamespace, true);
 0763            uri.AppendPath("/", false);
 0764            uri.AppendPath(parentResourcePath, false);
 0765            uri.AppendPath("/", false);
 0766            uri.AppendPath(resourceType, false);
 0767            uri.AppendPath("/", false);
 0768            uri.AppendPath(resourceName, true);
 0769            uri.AppendPath("/providers/Microsoft.Authorization/locks/", false);
 0770            uri.AppendPath(lockName, true);
 0771            uri.AppendQuery("api-version", "2016-09-01", true);
 0772            request.Uri = uri;
 0773            return message;
 774        }
 775
 776        /// <summary> To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authori
 777        /// <param name="resourceGroupName"> The name of the resource group containing the resource with the lock to del
 778        /// <param name="resourceProviderNamespace"> The resource provider namespace of the resource with the lock to de
 779        /// <param name="parentResourcePath"> The parent resource identity. </param>
 780        /// <param name="resourceType"> The resource type of the resource with the lock to delete. </param>
 781        /// <param name="resourceName"> The name of the resource with the lock to delete. </param>
 782        /// <param name="lockName"> The name of the lock to delete. </param>
 783        /// <param name="cancellationToken"> The cancellation token to use. </param>
 784        public async Task<Response> DeleteAtResourceLevelAsync(string resourceGroupName, string resourceProviderNamespac
 785        {
 0786            if (resourceGroupName == null)
 787            {
 0788                throw new ArgumentNullException(nameof(resourceGroupName));
 789            }
 0790            if (resourceProviderNamespace == null)
 791            {
 0792                throw new ArgumentNullException(nameof(resourceProviderNamespace));
 793            }
 0794            if (parentResourcePath == null)
 795            {
 0796                throw new ArgumentNullException(nameof(parentResourcePath));
 797            }
 0798            if (resourceType == null)
 799            {
 0800                throw new ArgumentNullException(nameof(resourceType));
 801            }
 0802            if (resourceName == null)
 803            {
 0804                throw new ArgumentNullException(nameof(resourceName));
 805            }
 0806            if (lockName == null)
 807            {
 0808                throw new ArgumentNullException(nameof(lockName));
 809            }
 810
 0811            using var message = CreateDeleteAtResourceLevelRequest(resourceGroupName, resourceProviderNamespace, parentR
 0812            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0813            switch (message.Response.Status)
 814            {
 815                case 200:
 816                case 204:
 0817                    return message.Response;
 818                default:
 0819                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 820            }
 0821        }
 822
 823        /// <summary> To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authori
 824        /// <param name="resourceGroupName"> The name of the resource group containing the resource with the lock to del
 825        /// <param name="resourceProviderNamespace"> The resource provider namespace of the resource with the lock to de
 826        /// <param name="parentResourcePath"> The parent resource identity. </param>
 827        /// <param name="resourceType"> The resource type of the resource with the lock to delete. </param>
 828        /// <param name="resourceName"> The name of the resource with the lock to delete. </param>
 829        /// <param name="lockName"> The name of the lock to delete. </param>
 830        /// <param name="cancellationToken"> The cancellation token to use. </param>
 831        public Response DeleteAtResourceLevel(string resourceGroupName, string resourceProviderNamespace, string parentR
 832        {
 0833            if (resourceGroupName == null)
 834            {
 0835                throw new ArgumentNullException(nameof(resourceGroupName));
 836            }
 0837            if (resourceProviderNamespace == null)
 838            {
 0839                throw new ArgumentNullException(nameof(resourceProviderNamespace));
 840            }
 0841            if (parentResourcePath == null)
 842            {
 0843                throw new ArgumentNullException(nameof(parentResourcePath));
 844            }
 0845            if (resourceType == null)
 846            {
 0847                throw new ArgumentNullException(nameof(resourceType));
 848            }
 0849            if (resourceName == null)
 850            {
 0851                throw new ArgumentNullException(nameof(resourceName));
 852            }
 0853            if (lockName == null)
 854            {
 0855                throw new ArgumentNullException(nameof(lockName));
 856            }
 857
 0858            using var message = CreateDeleteAtResourceLevelRequest(resourceGroupName, resourceProviderNamespace, parentR
 0859            _pipeline.Send(message, cancellationToken);
 0860            switch (message.Response.Status)
 861            {
 862                case 200:
 863                case 204:
 0864                    return message.Response;
 865                default:
 0866                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 867            }
 0868        }
 869
 870        internal Core.HttpMessage CreateGetAtResourceLevelRequest(string resourceGroupName, string resourceProviderNames
 871        {
 0872            var message = _pipeline.CreateMessage();
 0873            var request = message.Request;
 0874            request.Method = RequestMethod.Get;
 0875            var uri = new RawRequestUriBuilder();
 0876            uri.Reset(endpoint);
 0877            uri.AppendPath("/subscriptions/", false);
 0878            uri.AppendPath(subscriptionId, true);
 0879            uri.AppendPath("/resourcegroups/", false);
 0880            uri.AppendPath(resourceGroupName, true);
 0881            uri.AppendPath("/providers/", false);
 0882            uri.AppendPath(resourceProviderNamespace, true);
 0883            uri.AppendPath("/", false);
 0884            uri.AppendPath(parentResourcePath, false);
 0885            uri.AppendPath("/", false);
 0886            uri.AppendPath(resourceType, false);
 0887            uri.AppendPath("/", false);
 0888            uri.AppendPath(resourceName, true);
 0889            uri.AppendPath("/providers/Microsoft.Authorization/locks/", false);
 0890            uri.AppendPath(lockName, true);
 0891            uri.AppendQuery("api-version", "2016-09-01", true);
 0892            request.Uri = uri;
 0893            return message;
 894        }
 895
 896        /// <summary> Get the management lock of a resource or any level below resource. </summary>
 897        /// <param name="resourceGroupName"> The name of the resource group. </param>
 898        /// <param name="resourceProviderNamespace"> The namespace of the resource provider. </param>
 899        /// <param name="parentResourcePath"> An extra path parameter needed in some services, like SQL Databases. </par
 900        /// <param name="resourceType"> The type of the resource. </param>
 901        /// <param name="resourceName"> The name of the resource. </param>
 902        /// <param name="lockName"> The name of lock. </param>
 903        /// <param name="cancellationToken"> The cancellation token to use. </param>
 904        public async Task<Response<ManagementLockObject>> GetAtResourceLevelAsync(string resourceGroupName, string resou
 905        {
 0906            if (resourceGroupName == null)
 907            {
 0908                throw new ArgumentNullException(nameof(resourceGroupName));
 909            }
 0910            if (resourceProviderNamespace == null)
 911            {
 0912                throw new ArgumentNullException(nameof(resourceProviderNamespace));
 913            }
 0914            if (parentResourcePath == null)
 915            {
 0916                throw new ArgumentNullException(nameof(parentResourcePath));
 917            }
 0918            if (resourceType == null)
 919            {
 0920                throw new ArgumentNullException(nameof(resourceType));
 921            }
 0922            if (resourceName == null)
 923            {
 0924                throw new ArgumentNullException(nameof(resourceName));
 925            }
 0926            if (lockName == null)
 927            {
 0928                throw new ArgumentNullException(nameof(lockName));
 929            }
 930
 0931            using var message = CreateGetAtResourceLevelRequest(resourceGroupName, resourceProviderNamespace, parentReso
 0932            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0933            switch (message.Response.Status)
 934            {
 935                case 200:
 936                    {
 0937                        ManagementLockObject value = default;
 0938                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0939                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 940                        {
 0941                            value = null;
 942                        }
 943                        else
 944                        {
 0945                            value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement);
 946                        }
 0947                        return Response.FromValue(value, message.Response);
 948                    }
 949                default:
 0950                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 951            }
 0952        }
 953
 954        /// <summary> Get the management lock of a resource or any level below resource. </summary>
 955        /// <param name="resourceGroupName"> The name of the resource group. </param>
 956        /// <param name="resourceProviderNamespace"> The namespace of the resource provider. </param>
 957        /// <param name="parentResourcePath"> An extra path parameter needed in some services, like SQL Databases. </par
 958        /// <param name="resourceType"> The type of the resource. </param>
 959        /// <param name="resourceName"> The name of the resource. </param>
 960        /// <param name="lockName"> The name of lock. </param>
 961        /// <param name="cancellationToken"> The cancellation token to use. </param>
 962        public Response<ManagementLockObject> GetAtResourceLevel(string resourceGroupName, string resourceProviderNamesp
 963        {
 0964            if (resourceGroupName == null)
 965            {
 0966                throw new ArgumentNullException(nameof(resourceGroupName));
 967            }
 0968            if (resourceProviderNamespace == null)
 969            {
 0970                throw new ArgumentNullException(nameof(resourceProviderNamespace));
 971            }
 0972            if (parentResourcePath == null)
 973            {
 0974                throw new ArgumentNullException(nameof(parentResourcePath));
 975            }
 0976            if (resourceType == null)
 977            {
 0978                throw new ArgumentNullException(nameof(resourceType));
 979            }
 0980            if (resourceName == null)
 981            {
 0982                throw new ArgumentNullException(nameof(resourceName));
 983            }
 0984            if (lockName == null)
 985            {
 0986                throw new ArgumentNullException(nameof(lockName));
 987            }
 988
 0989            using var message = CreateGetAtResourceLevelRequest(resourceGroupName, resourceProviderNamespace, parentReso
 0990            _pipeline.Send(message, cancellationToken);
 0991            switch (message.Response.Status)
 992            {
 993                case 200:
 994                    {
 0995                        ManagementLockObject value = default;
 0996                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0997                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 998                        {
 0999                            value = null;
 1000                        }
 1001                        else
 1002                        {
 01003                            value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement);
 1004                        }
 01005                        return Response.FromValue(value, message.Response);
 1006                    }
 1007                default:
 01008                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1009            }
 01010        }
 1011
 1012        internal Core.HttpMessage CreateCreateOrUpdateAtSubscriptionLevelRequest(string lockName, ManagementLockObject p
 1013        {
 01014            var message = _pipeline.CreateMessage();
 01015            var request = message.Request;
 01016            request.Method = RequestMethod.Put;
 01017            var uri = new RawRequestUriBuilder();
 01018            uri.Reset(endpoint);
 01019            uri.AppendPath("/subscriptions/", false);
 01020            uri.AppendPath(subscriptionId, true);
 01021            uri.AppendPath("/providers/Microsoft.Authorization/locks/", false);
 01022            uri.AppendPath(lockName, true);
 01023            uri.AppendQuery("api-version", "2016-09-01", true);
 01024            request.Uri = uri;
 01025            request.Headers.Add("Content-Type", "application/json");
 01026            var content = new Utf8JsonRequestContent();
 01027            content.JsonWriter.WriteObjectValue(parameters);
 01028            request.Content = content;
 01029            return message;
 1030        }
 1031
 1032        /// <summary> When you apply a lock at a parent scope, all child resources inherit the same lock. To create mana
 1033        /// <param name="lockName"> The name of lock. The lock name can be a maximum of 260 characters. It cannot contai
 1034        /// <param name="parameters"> The management lock parameters. </param>
 1035        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1036        public async Task<Response<ManagementLockObject>> CreateOrUpdateAtSubscriptionLevelAsync(string lockName, Manage
 1037        {
 01038            if (lockName == null)
 1039            {
 01040                throw new ArgumentNullException(nameof(lockName));
 1041            }
 01042            if (parameters == null)
 1043            {
 01044                throw new ArgumentNullException(nameof(parameters));
 1045            }
 1046
 01047            using var message = CreateCreateOrUpdateAtSubscriptionLevelRequest(lockName, parameters);
 01048            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01049            switch (message.Response.Status)
 1050            {
 1051                case 200:
 1052                case 201:
 1053                    {
 01054                        ManagementLockObject value = default;
 01055                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 01056                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1057                        {
 01058                            value = null;
 1059                        }
 1060                        else
 1061                        {
 01062                            value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement);
 1063                        }
 01064                        return Response.FromValue(value, message.Response);
 1065                    }
 1066                default:
 01067                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1068            }
 01069        }
 1070
 1071        /// <summary> When you apply a lock at a parent scope, all child resources inherit the same lock. To create mana
 1072        /// <param name="lockName"> The name of lock. The lock name can be a maximum of 260 characters. It cannot contai
 1073        /// <param name="parameters"> The management lock parameters. </param>
 1074        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1075        public Response<ManagementLockObject> CreateOrUpdateAtSubscriptionLevel(string lockName, ManagementLockObject pa
 1076        {
 01077            if (lockName == null)
 1078            {
 01079                throw new ArgumentNullException(nameof(lockName));
 1080            }
 01081            if (parameters == null)
 1082            {
 01083                throw new ArgumentNullException(nameof(parameters));
 1084            }
 1085
 01086            using var message = CreateCreateOrUpdateAtSubscriptionLevelRequest(lockName, parameters);
 01087            _pipeline.Send(message, cancellationToken);
 01088            switch (message.Response.Status)
 1089            {
 1090                case 200:
 1091                case 201:
 1092                    {
 01093                        ManagementLockObject value = default;
 01094                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 01095                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1096                        {
 01097                            value = null;
 1098                        }
 1099                        else
 1100                        {
 01101                            value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement);
 1102                        }
 01103                        return Response.FromValue(value, message.Response);
 1104                    }
 1105                default:
 01106                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1107            }
 01108        }
 1109
 1110        internal Core.HttpMessage CreateDeleteAtSubscriptionLevelRequest(string lockName)
 1111        {
 01112            var message = _pipeline.CreateMessage();
 01113            var request = message.Request;
 01114            request.Method = RequestMethod.Delete;
 01115            var uri = new RawRequestUriBuilder();
 01116            uri.Reset(endpoint);
 01117            uri.AppendPath("/subscriptions/", false);
 01118            uri.AppendPath(subscriptionId, true);
 01119            uri.AppendPath("/providers/Microsoft.Authorization/locks/", false);
 01120            uri.AppendPath(lockName, true);
 01121            uri.AppendQuery("api-version", "2016-09-01", true);
 01122            request.Uri = uri;
 01123            return message;
 1124        }
 1125
 1126        /// <summary> To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authori
 1127        /// <param name="lockName"> The name of lock to delete. </param>
 1128        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1129        public async Task<Response> DeleteAtSubscriptionLevelAsync(string lockName, CancellationToken cancellationToken 
 1130        {
 01131            if (lockName == null)
 1132            {
 01133                throw new ArgumentNullException(nameof(lockName));
 1134            }
 1135
 01136            using var message = CreateDeleteAtSubscriptionLevelRequest(lockName);
 01137            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01138            switch (message.Response.Status)
 1139            {
 1140                case 200:
 1141                case 204:
 01142                    return message.Response;
 1143                default:
 01144                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1145            }
 01146        }
 1147
 1148        /// <summary> To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authori
 1149        /// <param name="lockName"> The name of lock to delete. </param>
 1150        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1151        public Response DeleteAtSubscriptionLevel(string lockName, CancellationToken cancellationToken = default)
 1152        {
 01153            if (lockName == null)
 1154            {
 01155                throw new ArgumentNullException(nameof(lockName));
 1156            }
 1157
 01158            using var message = CreateDeleteAtSubscriptionLevelRequest(lockName);
 01159            _pipeline.Send(message, cancellationToken);
 01160            switch (message.Response.Status)
 1161            {
 1162                case 200:
 1163                case 204:
 01164                    return message.Response;
 1165                default:
 01166                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1167            }
 01168        }
 1169
 1170        internal Core.HttpMessage CreateGetAtSubscriptionLevelRequest(string lockName)
 1171        {
 01172            var message = _pipeline.CreateMessage();
 01173            var request = message.Request;
 01174            request.Method = RequestMethod.Get;
 01175            var uri = new RawRequestUriBuilder();
 01176            uri.Reset(endpoint);
 01177            uri.AppendPath("/subscriptions/", false);
 01178            uri.AppendPath(subscriptionId, true);
 01179            uri.AppendPath("/providers/Microsoft.Authorization/locks/", false);
 01180            uri.AppendPath(lockName, true);
 01181            uri.AppendQuery("api-version", "2016-09-01", true);
 01182            request.Uri = uri;
 01183            return message;
 1184        }
 1185
 1186        /// <summary> Gets a management lock at the subscription level. </summary>
 1187        /// <param name="lockName"> The name of the lock to get. </param>
 1188        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1189        public async Task<Response<ManagementLockObject>> GetAtSubscriptionLevelAsync(string lockName, CancellationToken
 1190        {
 01191            if (lockName == null)
 1192            {
 01193                throw new ArgumentNullException(nameof(lockName));
 1194            }
 1195
 01196            using var message = CreateGetAtSubscriptionLevelRequest(lockName);
 01197            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01198            switch (message.Response.Status)
 1199            {
 1200                case 200:
 1201                    {
 01202                        ManagementLockObject value = default;
 01203                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 01204                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1205                        {
 01206                            value = null;
 1207                        }
 1208                        else
 1209                        {
 01210                            value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement);
 1211                        }
 01212                        return Response.FromValue(value, message.Response);
 1213                    }
 1214                default:
 01215                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1216            }
 01217        }
 1218
 1219        /// <summary> Gets a management lock at the subscription level. </summary>
 1220        /// <param name="lockName"> The name of the lock to get. </param>
 1221        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1222        public Response<ManagementLockObject> GetAtSubscriptionLevel(string lockName, CancellationToken cancellationToke
 1223        {
 01224            if (lockName == null)
 1225            {
 01226                throw new ArgumentNullException(nameof(lockName));
 1227            }
 1228
 01229            using var message = CreateGetAtSubscriptionLevelRequest(lockName);
 01230            _pipeline.Send(message, cancellationToken);
 01231            switch (message.Response.Status)
 1232            {
 1233                case 200:
 1234                    {
 01235                        ManagementLockObject value = default;
 01236                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 01237                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1238                        {
 01239                            value = null;
 1240                        }
 1241                        else
 1242                        {
 01243                            value = ManagementLockObject.DeserializeManagementLockObject(document.RootElement);
 1244                        }
 01245                        return Response.FromValue(value, message.Response);
 1246                    }
 1247                default:
 01248                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1249            }
 01250        }
 1251
 1252        internal Core.HttpMessage CreateListAtResourceGroupLevelRequest(string resourceGroupName, string filter)
 1253        {
 01254            var message = _pipeline.CreateMessage();
 01255            var request = message.Request;
 01256            request.Method = RequestMethod.Get;
 01257            var uri = new RawRequestUriBuilder();
 01258            uri.Reset(endpoint);
 01259            uri.AppendPath("/subscriptions/", false);
 01260            uri.AppendPath(subscriptionId, true);
 01261            uri.AppendPath("/resourceGroups/", false);
 01262            uri.AppendPath(resourceGroupName, true);
 01263            uri.AppendPath("/providers/Microsoft.Authorization/locks", false);
 01264            if (filter != null)
 1265            {
 01266                uri.AppendQuery("$filter", filter, true);
 1267            }
 01268            uri.AppendQuery("api-version", "2016-09-01", true);
 01269            request.Uri = uri;
 01270            return message;
 1271        }
 1272
 1273        /// <summary> Gets all the management locks for a resource group. </summary>
 1274        /// <param name="resourceGroupName"> The name of the resource group containing the locks to get. </param>
 1275        /// <param name="filter"> The filter to apply on the operation. </param>
 1276        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1277        public async Task<Response<ManagementLockListResult>> ListAtResourceGroupLevelAsync(string resourceGroupName, st
 1278        {
 01279            if (resourceGroupName == null)
 1280            {
 01281                throw new ArgumentNullException(nameof(resourceGroupName));
 1282            }
 1283
 01284            using var message = CreateListAtResourceGroupLevelRequest(resourceGroupName, filter);
 01285            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01286            switch (message.Response.Status)
 1287            {
 1288                case 200:
 1289                    {
 01290                        ManagementLockListResult value = default;
 01291                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 01292                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1293                        {
 01294                            value = null;
 1295                        }
 1296                        else
 1297                        {
 01298                            value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement);
 1299                        }
 01300                        return Response.FromValue(value, message.Response);
 1301                    }
 1302                default:
 01303                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1304            }
 01305        }
 1306
 1307        /// <summary> Gets all the management locks for a resource group. </summary>
 1308        /// <param name="resourceGroupName"> The name of the resource group containing the locks to get. </param>
 1309        /// <param name="filter"> The filter to apply on the operation. </param>
 1310        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1311        public Response<ManagementLockListResult> ListAtResourceGroupLevel(string resourceGroupName, string filter = nul
 1312        {
 01313            if (resourceGroupName == null)
 1314            {
 01315                throw new ArgumentNullException(nameof(resourceGroupName));
 1316            }
 1317
 01318            using var message = CreateListAtResourceGroupLevelRequest(resourceGroupName, filter);
 01319            _pipeline.Send(message, cancellationToken);
 01320            switch (message.Response.Status)
 1321            {
 1322                case 200:
 1323                    {
 01324                        ManagementLockListResult value = default;
 01325                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 01326                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1327                        {
 01328                            value = null;
 1329                        }
 1330                        else
 1331                        {
 01332                            value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement);
 1333                        }
 01334                        return Response.FromValue(value, message.Response);
 1335                    }
 1336                default:
 01337                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1338            }
 01339        }
 1340
 1341        internal Core.HttpMessage CreateListAtResourceLevelRequest(string resourceGroupName, string resourceProviderName
 1342        {
 01343            var message = _pipeline.CreateMessage();
 01344            var request = message.Request;
 01345            request.Method = RequestMethod.Get;
 01346            var uri = new RawRequestUriBuilder();
 01347            uri.Reset(endpoint);
 01348            uri.AppendPath("/subscriptions/", false);
 01349            uri.AppendPath(subscriptionId, true);
 01350            uri.AppendPath("/resourcegroups/", false);
 01351            uri.AppendPath(resourceGroupName, true);
 01352            uri.AppendPath("/providers/", false);
 01353            uri.AppendPath(resourceProviderNamespace, true);
 01354            uri.AppendPath("/", false);
 01355            uri.AppendPath(parentResourcePath, false);
 01356            uri.AppendPath("/", false);
 01357            uri.AppendPath(resourceType, false);
 01358            uri.AppendPath("/", false);
 01359            uri.AppendPath(resourceName, true);
 01360            uri.AppendPath("/providers/Microsoft.Authorization/locks", false);
 01361            if (filter != null)
 1362            {
 01363                uri.AppendQuery("$filter", filter, true);
 1364            }
 01365            uri.AppendQuery("api-version", "2016-09-01", true);
 01366            request.Uri = uri;
 01367            return message;
 1368        }
 1369
 1370        /// <summary> Gets all the management locks for a resource or any level below resource. </summary>
 1371        /// <param name="resourceGroupName"> The name of the resource group containing the locked resource. The name is 
 1372        /// <param name="resourceProviderNamespace"> The namespace of the resource provider. </param>
 1373        /// <param name="parentResourcePath"> The parent resource identity. </param>
 1374        /// <param name="resourceType"> The resource type of the locked resource. </param>
 1375        /// <param name="resourceName"> The name of the locked resource. </param>
 1376        /// <param name="filter"> The filter to apply on the operation. </param>
 1377        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1378        public async Task<Response<ManagementLockListResult>> ListAtResourceLevelAsync(string resourceGroupName, string 
 1379        {
 01380            if (resourceGroupName == null)
 1381            {
 01382                throw new ArgumentNullException(nameof(resourceGroupName));
 1383            }
 01384            if (resourceProviderNamespace == null)
 1385            {
 01386                throw new ArgumentNullException(nameof(resourceProviderNamespace));
 1387            }
 01388            if (parentResourcePath == null)
 1389            {
 01390                throw new ArgumentNullException(nameof(parentResourcePath));
 1391            }
 01392            if (resourceType == null)
 1393            {
 01394                throw new ArgumentNullException(nameof(resourceType));
 1395            }
 01396            if (resourceName == null)
 1397            {
 01398                throw new ArgumentNullException(nameof(resourceName));
 1399            }
 1400
 01401            using var message = CreateListAtResourceLevelRequest(resourceGroupName, resourceProviderNamespace, parentRes
 01402            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01403            switch (message.Response.Status)
 1404            {
 1405                case 200:
 1406                    {
 01407                        ManagementLockListResult value = default;
 01408                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 01409                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1410                        {
 01411                            value = null;
 1412                        }
 1413                        else
 1414                        {
 01415                            value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement);
 1416                        }
 01417                        return Response.FromValue(value, message.Response);
 1418                    }
 1419                default:
 01420                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1421            }
 01422        }
 1423
 1424        /// <summary> Gets all the management locks for a resource or any level below resource. </summary>
 1425        /// <param name="resourceGroupName"> The name of the resource group containing the locked resource. The name is 
 1426        /// <param name="resourceProviderNamespace"> The namespace of the resource provider. </param>
 1427        /// <param name="parentResourcePath"> The parent resource identity. </param>
 1428        /// <param name="resourceType"> The resource type of the locked resource. </param>
 1429        /// <param name="resourceName"> The name of the locked resource. </param>
 1430        /// <param name="filter"> The filter to apply on the operation. </param>
 1431        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1432        public Response<ManagementLockListResult> ListAtResourceLevel(string resourceGroupName, string resourceProviderN
 1433        {
 01434            if (resourceGroupName == null)
 1435            {
 01436                throw new ArgumentNullException(nameof(resourceGroupName));
 1437            }
 01438            if (resourceProviderNamespace == null)
 1439            {
 01440                throw new ArgumentNullException(nameof(resourceProviderNamespace));
 1441            }
 01442            if (parentResourcePath == null)
 1443            {
 01444                throw new ArgumentNullException(nameof(parentResourcePath));
 1445            }
 01446            if (resourceType == null)
 1447            {
 01448                throw new ArgumentNullException(nameof(resourceType));
 1449            }
 01450            if (resourceName == null)
 1451            {
 01452                throw new ArgumentNullException(nameof(resourceName));
 1453            }
 1454
 01455            using var message = CreateListAtResourceLevelRequest(resourceGroupName, resourceProviderNamespace, parentRes
 01456            _pipeline.Send(message, cancellationToken);
 01457            switch (message.Response.Status)
 1458            {
 1459                case 200:
 1460                    {
 01461                        ManagementLockListResult value = default;
 01462                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 01463                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1464                        {
 01465                            value = null;
 1466                        }
 1467                        else
 1468                        {
 01469                            value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement);
 1470                        }
 01471                        return Response.FromValue(value, message.Response);
 1472                    }
 1473                default:
 01474                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1475            }
 01476        }
 1477
 1478        internal Core.HttpMessage CreateListAtSubscriptionLevelRequest(string filter)
 1479        {
 01480            var message = _pipeline.CreateMessage();
 01481            var request = message.Request;
 01482            request.Method = RequestMethod.Get;
 01483            var uri = new RawRequestUriBuilder();
 01484            uri.Reset(endpoint);
 01485            uri.AppendPath("/subscriptions/", false);
 01486            uri.AppendPath(subscriptionId, true);
 01487            uri.AppendPath("/providers/Microsoft.Authorization/locks", false);
 01488            if (filter != null)
 1489            {
 01490                uri.AppendQuery("$filter", filter, true);
 1491            }
 01492            uri.AppendQuery("api-version", "2016-09-01", true);
 01493            request.Uri = uri;
 01494            return message;
 1495        }
 1496
 1497        /// <summary> Gets all the management locks for a subscription. </summary>
 1498        /// <param name="filter"> The filter to apply on the operation. </param>
 1499        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1500        public async Task<Response<ManagementLockListResult>> ListAtSubscriptionLevelAsync(string filter = null, Cancell
 1501        {
 01502            using var message = CreateListAtSubscriptionLevelRequest(filter);
 01503            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01504            switch (message.Response.Status)
 1505            {
 1506                case 200:
 1507                    {
 01508                        ManagementLockListResult value = default;
 01509                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 01510                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1511                        {
 01512                            value = null;
 1513                        }
 1514                        else
 1515                        {
 01516                            value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement);
 1517                        }
 01518                        return Response.FromValue(value, message.Response);
 1519                    }
 1520                default:
 01521                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1522            }
 01523        }
 1524
 1525        /// <summary> Gets all the management locks for a subscription. </summary>
 1526        /// <param name="filter"> The filter to apply on the operation. </param>
 1527        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1528        public Response<ManagementLockListResult> ListAtSubscriptionLevel(string filter = null, CancellationToken cancel
 1529        {
 01530            using var message = CreateListAtSubscriptionLevelRequest(filter);
 01531            _pipeline.Send(message, cancellationToken);
 01532            switch (message.Response.Status)
 1533            {
 1534                case 200:
 1535                    {
 01536                        ManagementLockListResult value = default;
 01537                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 01538                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1539                        {
 01540                            value = null;
 1541                        }
 1542                        else
 1543                        {
 01544                            value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement);
 1545                        }
 01546                        return Response.FromValue(value, message.Response);
 1547                    }
 1548                default:
 01549                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1550            }
 01551        }
 1552
 1553        internal Core.HttpMessage CreateListByScopeRequest(string scope, string filter)
 1554        {
 01555            var message = _pipeline.CreateMessage();
 01556            var request = message.Request;
 01557            request.Method = RequestMethod.Get;
 01558            var uri = new RawRequestUriBuilder();
 01559            uri.Reset(endpoint);
 01560            uri.AppendPath("/", false);
 01561            uri.AppendPath(scope, true);
 01562            uri.AppendPath("/providers/Microsoft.Authorization/locks", false);
 01563            if (filter != null)
 1564            {
 01565                uri.AppendQuery("$filter", filter, true);
 1566            }
 01567            uri.AppendQuery("api-version", "2016-09-01", true);
 01568            request.Uri = uri;
 01569            return message;
 1570        }
 1571
 1572        /// <summary> Gets all the management locks for a scope. </summary>
 1573        /// <param name="scope"> The scope for the lock. When providing a scope for the assignment, use &apos;/subscript
 1574        /// <param name="filter"> The filter to apply on the operation. </param>
 1575        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1576        public async Task<Response<ManagementLockListResult>> ListByScopeAsync(string scope, string filter = null, Cance
 1577        {
 01578            if (scope == null)
 1579            {
 01580                throw new ArgumentNullException(nameof(scope));
 1581            }
 1582
 01583            using var message = CreateListByScopeRequest(scope, filter);
 01584            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01585            switch (message.Response.Status)
 1586            {
 1587                case 200:
 1588                    {
 01589                        ManagementLockListResult value = default;
 01590                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 01591                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1592                        {
 01593                            value = null;
 1594                        }
 1595                        else
 1596                        {
 01597                            value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement);
 1598                        }
 01599                        return Response.FromValue(value, message.Response);
 1600                    }
 1601                default:
 01602                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1603            }
 01604        }
 1605
 1606        /// <summary> Gets all the management locks for a scope. </summary>
 1607        /// <param name="scope"> The scope for the lock. When providing a scope for the assignment, use &apos;/subscript
 1608        /// <param name="filter"> The filter to apply on the operation. </param>
 1609        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1610        public Response<ManagementLockListResult> ListByScope(string scope, string filter = null, CancellationToken canc
 1611        {
 01612            if (scope == null)
 1613            {
 01614                throw new ArgumentNullException(nameof(scope));
 1615            }
 1616
 01617            using var message = CreateListByScopeRequest(scope, filter);
 01618            _pipeline.Send(message, cancellationToken);
 01619            switch (message.Response.Status)
 1620            {
 1621                case 200:
 1622                    {
 01623                        ManagementLockListResult value = default;
 01624                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 01625                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1626                        {
 01627                            value = null;
 1628                        }
 1629                        else
 1630                        {
 01631                            value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement);
 1632                        }
 01633                        return Response.FromValue(value, message.Response);
 1634                    }
 1635                default:
 01636                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1637            }
 01638        }
 1639
 1640        internal Core.HttpMessage CreateListAtResourceGroupLevelNextPageRequest(string nextLink, string resourceGroupNam
 1641        {
 01642            var message = _pipeline.CreateMessage();
 01643            var request = message.Request;
 01644            request.Method = RequestMethod.Get;
 01645            var uri = new RawRequestUriBuilder();
 01646            uri.Reset(endpoint);
 01647            uri.AppendRawNextLink(nextLink, false);
 01648            request.Uri = uri;
 01649            return message;
 1650        }
 1651
 1652        /// <summary> Gets all the management locks for a resource group. </summary>
 1653        /// <param name="nextLink"> The URL to the next page of results. </param>
 1654        /// <param name="resourceGroupName"> The name of the resource group containing the locks to get. </param>
 1655        /// <param name="filter"> The filter to apply on the operation. </param>
 1656        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1657        public async Task<Response<ManagementLockListResult>> ListAtResourceGroupLevelNextPageAsync(string nextLink, str
 1658        {
 01659            if (nextLink == null)
 1660            {
 01661                throw new ArgumentNullException(nameof(nextLink));
 1662            }
 01663            if (resourceGroupName == null)
 1664            {
 01665                throw new ArgumentNullException(nameof(resourceGroupName));
 1666            }
 1667
 01668            using var message = CreateListAtResourceGroupLevelNextPageRequest(nextLink, resourceGroupName, filter);
 01669            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01670            switch (message.Response.Status)
 1671            {
 1672                case 200:
 1673                    {
 01674                        ManagementLockListResult value = default;
 01675                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 01676                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1677                        {
 01678                            value = null;
 1679                        }
 1680                        else
 1681                        {
 01682                            value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement);
 1683                        }
 01684                        return Response.FromValue(value, message.Response);
 1685                    }
 1686                default:
 01687                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1688            }
 01689        }
 1690
 1691        /// <summary> Gets all the management locks for a resource group. </summary>
 1692        /// <param name="nextLink"> The URL to the next page of results. </param>
 1693        /// <param name="resourceGroupName"> The name of the resource group containing the locks to get. </param>
 1694        /// <param name="filter"> The filter to apply on the operation. </param>
 1695        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1696        public Response<ManagementLockListResult> ListAtResourceGroupLevelNextPage(string nextLink, string resourceGroup
 1697        {
 01698            if (nextLink == null)
 1699            {
 01700                throw new ArgumentNullException(nameof(nextLink));
 1701            }
 01702            if (resourceGroupName == null)
 1703            {
 01704                throw new ArgumentNullException(nameof(resourceGroupName));
 1705            }
 1706
 01707            using var message = CreateListAtResourceGroupLevelNextPageRequest(nextLink, resourceGroupName, filter);
 01708            _pipeline.Send(message, cancellationToken);
 01709            switch (message.Response.Status)
 1710            {
 1711                case 200:
 1712                    {
 01713                        ManagementLockListResult value = default;
 01714                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 01715                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1716                        {
 01717                            value = null;
 1718                        }
 1719                        else
 1720                        {
 01721                            value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement);
 1722                        }
 01723                        return Response.FromValue(value, message.Response);
 1724                    }
 1725                default:
 01726                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1727            }
 01728        }
 1729
 1730        internal Core.HttpMessage CreateListAtResourceLevelNextPageRequest(string nextLink, string resourceGroupName, st
 1731        {
 01732            var message = _pipeline.CreateMessage();
 01733            var request = message.Request;
 01734            request.Method = RequestMethod.Get;
 01735            var uri = new RawRequestUriBuilder();
 01736            uri.Reset(endpoint);
 01737            uri.AppendRawNextLink(nextLink, false);
 01738            request.Uri = uri;
 01739            return message;
 1740        }
 1741
 1742        /// <summary> Gets all the management locks for a resource or any level below resource. </summary>
 1743        /// <param name="nextLink"> The URL to the next page of results. </param>
 1744        /// <param name="resourceGroupName"> The name of the resource group containing the locked resource. The name is 
 1745        /// <param name="resourceProviderNamespace"> The namespace of the resource provider. </param>
 1746        /// <param name="parentResourcePath"> The parent resource identity. </param>
 1747        /// <param name="resourceType"> The resource type of the locked resource. </param>
 1748        /// <param name="resourceName"> The name of the locked resource. </param>
 1749        /// <param name="filter"> The filter to apply on the operation. </param>
 1750        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1751        public async Task<Response<ManagementLockListResult>> ListAtResourceLevelNextPageAsync(string nextLink, string r
 1752        {
 01753            if (nextLink == null)
 1754            {
 01755                throw new ArgumentNullException(nameof(nextLink));
 1756            }
 01757            if (resourceGroupName == null)
 1758            {
 01759                throw new ArgumentNullException(nameof(resourceGroupName));
 1760            }
 01761            if (resourceProviderNamespace == null)
 1762            {
 01763                throw new ArgumentNullException(nameof(resourceProviderNamespace));
 1764            }
 01765            if (parentResourcePath == null)
 1766            {
 01767                throw new ArgumentNullException(nameof(parentResourcePath));
 1768            }
 01769            if (resourceType == null)
 1770            {
 01771                throw new ArgumentNullException(nameof(resourceType));
 1772            }
 01773            if (resourceName == null)
 1774            {
 01775                throw new ArgumentNullException(nameof(resourceName));
 1776            }
 1777
 01778            using var message = CreateListAtResourceLevelNextPageRequest(nextLink, resourceGroupName, resourceProviderNa
 01779            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01780            switch (message.Response.Status)
 1781            {
 1782                case 200:
 1783                    {
 01784                        ManagementLockListResult value = default;
 01785                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 01786                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1787                        {
 01788                            value = null;
 1789                        }
 1790                        else
 1791                        {
 01792                            value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement);
 1793                        }
 01794                        return Response.FromValue(value, message.Response);
 1795                    }
 1796                default:
 01797                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1798            }
 01799        }
 1800
 1801        /// <summary> Gets all the management locks for a resource or any level below resource. </summary>
 1802        /// <param name="nextLink"> The URL to the next page of results. </param>
 1803        /// <param name="resourceGroupName"> The name of the resource group containing the locked resource. The name is 
 1804        /// <param name="resourceProviderNamespace"> The namespace of the resource provider. </param>
 1805        /// <param name="parentResourcePath"> The parent resource identity. </param>
 1806        /// <param name="resourceType"> The resource type of the locked resource. </param>
 1807        /// <param name="resourceName"> The name of the locked resource. </param>
 1808        /// <param name="filter"> The filter to apply on the operation. </param>
 1809        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1810        public Response<ManagementLockListResult> ListAtResourceLevelNextPage(string nextLink, string resourceGroupName,
 1811        {
 01812            if (nextLink == null)
 1813            {
 01814                throw new ArgumentNullException(nameof(nextLink));
 1815            }
 01816            if (resourceGroupName == null)
 1817            {
 01818                throw new ArgumentNullException(nameof(resourceGroupName));
 1819            }
 01820            if (resourceProviderNamespace == null)
 1821            {
 01822                throw new ArgumentNullException(nameof(resourceProviderNamespace));
 1823            }
 01824            if (parentResourcePath == null)
 1825            {
 01826                throw new ArgumentNullException(nameof(parentResourcePath));
 1827            }
 01828            if (resourceType == null)
 1829            {
 01830                throw new ArgumentNullException(nameof(resourceType));
 1831            }
 01832            if (resourceName == null)
 1833            {
 01834                throw new ArgumentNullException(nameof(resourceName));
 1835            }
 1836
 01837            using var message = CreateListAtResourceLevelNextPageRequest(nextLink, resourceGroupName, resourceProviderNa
 01838            _pipeline.Send(message, cancellationToken);
 01839            switch (message.Response.Status)
 1840            {
 1841                case 200:
 1842                    {
 01843                        ManagementLockListResult value = default;
 01844                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 01845                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1846                        {
 01847                            value = null;
 1848                        }
 1849                        else
 1850                        {
 01851                            value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement);
 1852                        }
 01853                        return Response.FromValue(value, message.Response);
 1854                    }
 1855                default:
 01856                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1857            }
 01858        }
 1859
 1860        internal Core.HttpMessage CreateListAtSubscriptionLevelNextPageRequest(string nextLink, string filter)
 1861        {
 01862            var message = _pipeline.CreateMessage();
 01863            var request = message.Request;
 01864            request.Method = RequestMethod.Get;
 01865            var uri = new RawRequestUriBuilder();
 01866            uri.Reset(endpoint);
 01867            uri.AppendRawNextLink(nextLink, false);
 01868            request.Uri = uri;
 01869            return message;
 1870        }
 1871
 1872        /// <summary> Gets all the management locks for a subscription. </summary>
 1873        /// <param name="nextLink"> The URL to the next page of results. </param>
 1874        /// <param name="filter"> The filter to apply on the operation. </param>
 1875        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1876        public async Task<Response<ManagementLockListResult>> ListAtSubscriptionLevelNextPageAsync(string nextLink, stri
 1877        {
 01878            if (nextLink == null)
 1879            {
 01880                throw new ArgumentNullException(nameof(nextLink));
 1881            }
 1882
 01883            using var message = CreateListAtSubscriptionLevelNextPageRequest(nextLink, filter);
 01884            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01885            switch (message.Response.Status)
 1886            {
 1887                case 200:
 1888                    {
 01889                        ManagementLockListResult value = default;
 01890                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 01891                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1892                        {
 01893                            value = null;
 1894                        }
 1895                        else
 1896                        {
 01897                            value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement);
 1898                        }
 01899                        return Response.FromValue(value, message.Response);
 1900                    }
 1901                default:
 01902                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1903            }
 01904        }
 1905
 1906        /// <summary> Gets all the management locks for a subscription. </summary>
 1907        /// <param name="nextLink"> The URL to the next page of results. </param>
 1908        /// <param name="filter"> The filter to apply on the operation. </param>
 1909        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1910        public Response<ManagementLockListResult> ListAtSubscriptionLevelNextPage(string nextLink, string filter = null,
 1911        {
 01912            if (nextLink == null)
 1913            {
 01914                throw new ArgumentNullException(nameof(nextLink));
 1915            }
 1916
 01917            using var message = CreateListAtSubscriptionLevelNextPageRequest(nextLink, filter);
 01918            _pipeline.Send(message, cancellationToken);
 01919            switch (message.Response.Status)
 1920            {
 1921                case 200:
 1922                    {
 01923                        ManagementLockListResult value = default;
 01924                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 01925                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1926                        {
 01927                            value = null;
 1928                        }
 1929                        else
 1930                        {
 01931                            value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement);
 1932                        }
 01933                        return Response.FromValue(value, message.Response);
 1934                    }
 1935                default:
 01936                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1937            }
 01938        }
 1939
 1940        internal Core.HttpMessage CreateListByScopeNextPageRequest(string nextLink, string scope, string filter)
 1941        {
 01942            var message = _pipeline.CreateMessage();
 01943            var request = message.Request;
 01944            request.Method = RequestMethod.Get;
 01945            var uri = new RawRequestUriBuilder();
 01946            uri.Reset(endpoint);
 01947            uri.AppendRawNextLink(nextLink, false);
 01948            request.Uri = uri;
 01949            return message;
 1950        }
 1951
 1952        /// <summary> Gets all the management locks for a scope. </summary>
 1953        /// <param name="nextLink"> The URL to the next page of results. </param>
 1954        /// <param name="scope"> The scope for the lock. When providing a scope for the assignment, use &apos;/subscript
 1955        /// <param name="filter"> The filter to apply on the operation. </param>
 1956        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1957        public async Task<Response<ManagementLockListResult>> ListByScopeNextPageAsync(string nextLink, string scope, st
 1958        {
 01959            if (nextLink == null)
 1960            {
 01961                throw new ArgumentNullException(nameof(nextLink));
 1962            }
 01963            if (scope == null)
 1964            {
 01965                throw new ArgumentNullException(nameof(scope));
 1966            }
 1967
 01968            using var message = CreateListByScopeNextPageRequest(nextLink, scope, filter);
 01969            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01970            switch (message.Response.Status)
 1971            {
 1972                case 200:
 1973                    {
 01974                        ManagementLockListResult value = default;
 01975                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 01976                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1977                        {
 01978                            value = null;
 1979                        }
 1980                        else
 1981                        {
 01982                            value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement);
 1983                        }
 01984                        return Response.FromValue(value, message.Response);
 1985                    }
 1986                default:
 01987                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1988            }
 01989        }
 1990
 1991        /// <summary> Gets all the management locks for a scope. </summary>
 1992        /// <param name="nextLink"> The URL to the next page of results. </param>
 1993        /// <param name="scope"> The scope for the lock. When providing a scope for the assignment, use &apos;/subscript
 1994        /// <param name="filter"> The filter to apply on the operation. </param>
 1995        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1996        public Response<ManagementLockListResult> ListByScopeNextPage(string nextLink, string scope, string filter = nul
 1997        {
 01998            if (nextLink == null)
 1999            {
 02000                throw new ArgumentNullException(nameof(nextLink));
 2001            }
 02002            if (scope == null)
 2003            {
 02004                throw new ArgumentNullException(nameof(scope));
 2005            }
 2006
 02007            using var message = CreateListByScopeNextPageRequest(nextLink, scope, filter);
 02008            _pipeline.Send(message, cancellationToken);
 02009            switch (message.Response.Status)
 2010            {
 2011                case 200:
 2012                    {
 02013                        ManagementLockListResult value = default;
 02014                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 02015                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 2016                        {
 02017                            value = null;
 2018                        }
 2019                        else
 2020                        {
 02021                            value = ManagementLockListResult.DeserializeManagementLockListResult(document.RootElement);
 2022                        }
 02023                        return Response.FromValue(value, message.Response);
 2024                    }
 2025                default:
 02026                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 2027            }
 02028        }
 2029    }
 2030}

Methods/Properties

.ctor(...)
CreateCreateOrUpdateAtResourceGroupLevelRequest(...)
CreateOrUpdateAtResourceGroupLevelAsync()
CreateOrUpdateAtResourceGroupLevel(...)
CreateDeleteAtResourceGroupLevelRequest(...)
DeleteAtResourceGroupLevelAsync()
DeleteAtResourceGroupLevel(...)
CreateGetAtResourceGroupLevelRequest(...)
GetAtResourceGroupLevelAsync()
GetAtResourceGroupLevel(...)
CreateCreateOrUpdateByScopeRequest(...)
CreateOrUpdateByScopeAsync()
CreateOrUpdateByScope(...)
CreateDeleteByScopeRequest(...)
DeleteByScopeAsync()
DeleteByScope(...)
CreateGetByScopeRequest(...)
GetByScopeAsync()
GetByScope(...)
CreateCreateOrUpdateAtResourceLevelRequest(...)
CreateOrUpdateAtResourceLevelAsync()
CreateOrUpdateAtResourceLevel(...)
CreateDeleteAtResourceLevelRequest(...)
DeleteAtResourceLevelAsync()
DeleteAtResourceLevel(...)
CreateGetAtResourceLevelRequest(...)
GetAtResourceLevelAsync()
GetAtResourceLevel(...)
CreateCreateOrUpdateAtSubscriptionLevelRequest(...)
CreateOrUpdateAtSubscriptionLevelAsync()
CreateOrUpdateAtSubscriptionLevel(...)
CreateDeleteAtSubscriptionLevelRequest(...)
DeleteAtSubscriptionLevelAsync()
DeleteAtSubscriptionLevel(...)
CreateGetAtSubscriptionLevelRequest(...)
GetAtSubscriptionLevelAsync()
GetAtSubscriptionLevel(...)
CreateListAtResourceGroupLevelRequest(...)
ListAtResourceGroupLevelAsync()
ListAtResourceGroupLevel(...)
CreateListAtResourceLevelRequest(...)
ListAtResourceLevelAsync()
ListAtResourceLevel(...)
CreateListAtSubscriptionLevelRequest(...)
ListAtSubscriptionLevelAsync()
ListAtSubscriptionLevel(...)
CreateListByScopeRequest(...)
ListByScopeAsync()
ListByScope(...)
CreateListAtResourceGroupLevelNextPageRequest(...)
ListAtResourceGroupLevelNextPageAsync()
ListAtResourceGroupLevelNextPage(...)
CreateListAtResourceLevelNextPageRequest(...)
ListAtResourceLevelNextPageAsync()
ListAtResourceLevelNextPage(...)
CreateListAtSubscriptionLevelNextPageRequest(...)
ListAtSubscriptionLevelNextPageAsync()
ListAtSubscriptionLevelNextPage(...)
CreateListByScopeNextPageRequest(...)
ListByScopeNextPageAsync()
ListByScopeNextPage(...)