< Summary

Class:Microsoft.Azure.Graph.RBAC.DeletedApplicationsOperations
Assembly:Microsoft.Azure.Graph.RBAC
File(s):C:\Git\azure-sdk-for-net\sdk\graphrbac\Microsoft.Azure.Graph.RBAC\src\Generated\DeletedApplicationsOperations.cs
Covered lines:4
Uncovered lines:336
Coverable lines:340
Total lines:760
Line coverage:1.1% (4 of 340)
Covered branches:1
Total branches:206
Branch coverage:0.4% (1 of 206)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-80%50%
get_Client()-0%100%
RestoreWithHttpMessagesAsync()-0%0%
ListWithHttpMessagesAsync()-0%0%
HardDeleteWithHttpMessagesAsync()-0%0%
ListNextWithHttpMessagesAsync()-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\graphrbac\Microsoft.Azure.Graph.RBAC\src\Generated\DeletedApplicationsOperations.cs

#LineLine coverage
 1// <auto-generated>
 2// Copyright (c) Microsoft Corporation. All rights reserved.
 3// Licensed under the MIT License. See License.txt in the project root for
 4// license information.
 5//
 6// Code generated by Microsoft (R) AutoRest Code Generator.
 7// Changes may cause incorrect behavior and will be lost if the code is
 8// regenerated.
 9// </auto-generated>
 10
 11namespace Microsoft.Azure.Graph.RBAC
 12{
 13    using Microsoft.Rest;
 14    using Microsoft.Rest.Azure;
 15    using Models;
 16    using Newtonsoft.Json;
 17    using System.Collections;
 18    using System.Collections.Generic;
 19    using System.Linq;
 20    using System.Net;
 21    using System.Net.Http;
 22    using System.Threading;
 23    using System.Threading.Tasks;
 24
 25    /// <summary>
 26    /// DeletedApplicationsOperations operations.
 27    /// </summary>
 28    internal partial class DeletedApplicationsOperations : IServiceOperations<GraphRbacManagementClient>, IDeletedApplic
 29    {
 30        /// <summary>
 31        /// Initializes a new instance of the DeletedApplicationsOperations class.
 32        /// </summary>
 33        /// <param name='client'>
 34        /// Reference to the service client.
 35        /// </param>
 36        /// <exception cref="System.ArgumentNullException">
 37        /// Thrown when a required parameter is null
 38        /// </exception>
 4639        internal DeletedApplicationsOperations(GraphRbacManagementClient client)
 40        {
 4641            if (client == null)
 42            {
 043                throw new System.ArgumentNullException("client");
 44            }
 4645            Client = client;
 4646        }
 47
 48        /// <summary>
 49        /// Gets a reference to the GraphRbacManagementClient
 50        /// </summary>
 051        public GraphRbacManagementClient Client { get; private set; }
 52
 53        /// <summary>
 54        /// Restores the deleted application in the directory.
 55        /// </summary>
 56        /// <param name='objectId'>
 57        /// Application object ID.
 58        /// </param>
 59        /// <param name='customHeaders'>
 60        /// Headers that will be added to request.
 61        /// </param>
 62        /// <param name='cancellationToken'>
 63        /// The cancellation token.
 64        /// </param>
 65        /// <exception cref="GraphErrorException">
 66        /// Thrown when the operation returned an invalid status code
 67        /// </exception>
 68        /// <exception cref="SerializationException">
 69        /// Thrown when unable to deserialize the response
 70        /// </exception>
 71        /// <exception cref="ValidationException">
 72        /// Thrown when a required parameter is null
 73        /// </exception>
 74        /// <exception cref="System.ArgumentNullException">
 75        /// Thrown when a required parameter is null
 76        /// </exception>
 77        /// <return>
 78        /// A response object containing the response body and response headers.
 79        /// </return>
 80        public async Task<AzureOperationResponse<Application>> RestoreWithHttpMessagesAsync(string objectId, Dictionary<
 81        {
 082            if (objectId == null)
 83            {
 084                throw new ValidationException(ValidationRules.CannotBeNull, "objectId");
 85            }
 086            if (Client.ApiVersion == null)
 87            {
 088                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
 89            }
 090            if (Client.TenantID == null)
 91            {
 092                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.TenantID");
 93            }
 94            // Tracing
 095            bool _shouldTrace = ServiceClientTracing.IsEnabled;
 096            string _invocationId = null;
 097            if (_shouldTrace)
 98            {
 099                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
 0100                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
 0101                tracingParameters.Add("objectId", objectId);
 0102                tracingParameters.Add("cancellationToken", cancellationToken);
 0103                ServiceClientTracing.Enter(_invocationId, this, "Restore", tracingParameters);
 104            }
 105            // Construct URL
 0106            var _baseUrl = Client.BaseUri.AbsoluteUri;
 0107            var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{tenantID}/delete
 0108            _url = _url.Replace("{objectId}", System.Uri.EscapeDataString(objectId));
 0109            _url = _url.Replace("{tenantID}", System.Uri.EscapeDataString(Client.TenantID));
 0110            List<string> _queryParameters = new List<string>();
 0111            if (Client.ApiVersion != null)
 112            {
 0113                _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
 114            }
 0115            if (_queryParameters.Count > 0)
 116            {
 0117                _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
 118            }
 119            // Create HTTP transport objects
 0120            var _httpRequest = new HttpRequestMessage();
 0121            HttpResponseMessage _httpResponse = null;
 0122            _httpRequest.Method = new HttpMethod("POST");
 0123            _httpRequest.RequestUri = new System.Uri(_url);
 124            // Set Headers
 0125            if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
 126            {
 0127                _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString())
 128            }
 0129            if (Client.AcceptLanguage != null)
 130            {
 0131                if (_httpRequest.Headers.Contains("accept-language"))
 132                {
 0133                    _httpRequest.Headers.Remove("accept-language");
 134                }
 0135                _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
 136            }
 137
 138
 0139            if (customHeaders != null)
 140            {
 0141                foreach(var _header in customHeaders)
 142                {
 0143                    if (_httpRequest.Headers.Contains(_header.Key))
 144                    {
 0145                        _httpRequest.Headers.Remove(_header.Key);
 146                    }
 0147                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
 148                }
 149            }
 150
 151            // Serialize Request
 0152            string _requestContent = null;
 153            // Set Credentials
 0154            if (Client.Credentials != null)
 155            {
 0156                cancellationToken.ThrowIfCancellationRequested();
 0157                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 158            }
 159            // Send Request
 0160            if (_shouldTrace)
 161            {
 0162                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
 163            }
 0164            cancellationToken.ThrowIfCancellationRequested();
 0165            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 0166            if (_shouldTrace)
 167            {
 0168                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
 169            }
 0170            HttpStatusCode _statusCode = _httpResponse.StatusCode;
 0171            cancellationToken.ThrowIfCancellationRequested();
 0172            string _responseContent = null;
 0173            if ((int)_statusCode != 200)
 174            {
 0175                var ex = new GraphErrorException(string.Format("Operation returned an invalid status code '{0}'", _statu
 176                try
 177                {
 0178                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 0179                    GraphError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<GraphError>(_responseC
 0180                    if (_errorBody != null)
 181                    {
 0182                        ex.Body = _errorBody;
 183                    }
 0184                }
 0185                catch (JsonException)
 186                {
 187                    // Ignore the exception
 0188                }
 0189                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
 0190                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
 0191                if (_shouldTrace)
 192                {
 0193                    ServiceClientTracing.Error(_invocationId, ex);
 194                }
 0195                _httpRequest.Dispose();
 0196                if (_httpResponse != null)
 197                {
 0198                    _httpResponse.Dispose();
 199                }
 0200                throw ex;
 201            }
 202            // Create Result
 0203            var _result = new AzureOperationResponse<Application>();
 0204            _result.Request = _httpRequest;
 0205            _result.Response = _httpResponse;
 0206            if (_httpResponse.Headers.Contains("x-ms-request-id"))
 207            {
 0208                _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
 209            }
 210            // Deserialize Response
 0211            if ((int)_statusCode == 200)
 212            {
 0213                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 214                try
 215                {
 0216                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Application>(_responseContent, C
 0217                }
 0218                catch (JsonException ex)
 219                {
 0220                    _httpRequest.Dispose();
 0221                    if (_httpResponse != null)
 222                    {
 0223                        _httpResponse.Dispose();
 224                    }
 0225                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
 226                }
 227            }
 0228            if (_shouldTrace)
 229            {
 0230                ServiceClientTracing.Exit(_invocationId, _result);
 231            }
 0232            return _result;
 0233        }
 234
 235        /// <summary>
 236        /// Gets a list of deleted applications in the directory.
 237        /// </summary>
 238        /// <param name='filter'>
 239        /// The filter to apply to the operation.
 240        /// </param>
 241        /// <param name='customHeaders'>
 242        /// Headers that will be added to request.
 243        /// </param>
 244        /// <param name='cancellationToken'>
 245        /// The cancellation token.
 246        /// </param>
 247        /// <exception cref="GraphErrorException">
 248        /// Thrown when the operation returned an invalid status code
 249        /// </exception>
 250        /// <exception cref="SerializationException">
 251        /// Thrown when unable to deserialize the response
 252        /// </exception>
 253        /// <exception cref="ValidationException">
 254        /// Thrown when a required parameter is null
 255        /// </exception>
 256        /// <exception cref="System.ArgumentNullException">
 257        /// Thrown when a required parameter is null
 258        /// </exception>
 259        /// <return>
 260        /// A response object containing the response body and response headers.
 261        /// </return>
 262        public async Task<AzureOperationResponse<IPage<Application>>> ListWithHttpMessagesAsync(string filter = default(
 263        {
 0264            if (Client.ApiVersion == null)
 265            {
 0266                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
 267            }
 0268            if (Client.TenantID == null)
 269            {
 0270                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.TenantID");
 271            }
 272            // Tracing
 0273            bool _shouldTrace = ServiceClientTracing.IsEnabled;
 0274            string _invocationId = null;
 0275            if (_shouldTrace)
 276            {
 0277                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
 0278                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
 0279                tracingParameters.Add("filter", filter);
 0280                tracingParameters.Add("cancellationToken", cancellationToken);
 0281                ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
 282            }
 283            // Construct URL
 0284            var _baseUrl = Client.BaseUri.AbsoluteUri;
 0285            var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{tenantID}/delete
 0286            _url = _url.Replace("{tenantID}", System.Uri.EscapeDataString(Client.TenantID));
 0287            List<string> _queryParameters = new List<string>();
 0288            if (filter != null)
 289            {
 0290                _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter)));
 291            }
 0292            if (Client.ApiVersion != null)
 293            {
 0294                _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
 295            }
 0296            if (_queryParameters.Count > 0)
 297            {
 0298                _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
 299            }
 300            // Create HTTP transport objects
 0301            var _httpRequest = new HttpRequestMessage();
 0302            HttpResponseMessage _httpResponse = null;
 0303            _httpRequest.Method = new HttpMethod("GET");
 0304            _httpRequest.RequestUri = new System.Uri(_url);
 305            // Set Headers
 0306            if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
 307            {
 0308                _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString())
 309            }
 0310            if (Client.AcceptLanguage != null)
 311            {
 0312                if (_httpRequest.Headers.Contains("accept-language"))
 313                {
 0314                    _httpRequest.Headers.Remove("accept-language");
 315                }
 0316                _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
 317            }
 318
 319
 0320            if (customHeaders != null)
 321            {
 0322                foreach(var _header in customHeaders)
 323                {
 0324                    if (_httpRequest.Headers.Contains(_header.Key))
 325                    {
 0326                        _httpRequest.Headers.Remove(_header.Key);
 327                    }
 0328                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
 329                }
 330            }
 331
 332            // Serialize Request
 0333            string _requestContent = null;
 334            // Set Credentials
 0335            if (Client.Credentials != null)
 336            {
 0337                cancellationToken.ThrowIfCancellationRequested();
 0338                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 339            }
 340            // Send Request
 0341            if (_shouldTrace)
 342            {
 0343                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
 344            }
 0345            cancellationToken.ThrowIfCancellationRequested();
 0346            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 0347            if (_shouldTrace)
 348            {
 0349                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
 350            }
 0351            HttpStatusCode _statusCode = _httpResponse.StatusCode;
 0352            cancellationToken.ThrowIfCancellationRequested();
 0353            string _responseContent = null;
 0354            if ((int)_statusCode != 200)
 355            {
 0356                var ex = new GraphErrorException(string.Format("Operation returned an invalid status code '{0}'", _statu
 357                try
 358                {
 0359                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 0360                    GraphError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<GraphError>(_responseC
 0361                    if (_errorBody != null)
 362                    {
 0363                        ex.Body = _errorBody;
 364                    }
 0365                }
 0366                catch (JsonException)
 367                {
 368                    // Ignore the exception
 0369                }
 0370                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
 0371                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
 0372                if (_shouldTrace)
 373                {
 0374                    ServiceClientTracing.Error(_invocationId, ex);
 375                }
 0376                _httpRequest.Dispose();
 0377                if (_httpResponse != null)
 378                {
 0379                    _httpResponse.Dispose();
 380                }
 0381                throw ex;
 382            }
 383            // Create Result
 0384            var _result = new AzureOperationResponse<IPage<Application>>();
 0385            _result.Request = _httpRequest;
 0386            _result.Response = _httpResponse;
 0387            if (_httpResponse.Headers.Contains("x-ms-request-id"))
 388            {
 0389                _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
 390            }
 391            // Deserialize Response
 0392            if ((int)_statusCode == 200)
 393            {
 0394                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 395                try
 396                {
 0397                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Page<Application>>(_responseCont
 0398                }
 0399                catch (JsonException ex)
 400                {
 0401                    _httpRequest.Dispose();
 0402                    if (_httpResponse != null)
 403                    {
 0404                        _httpResponse.Dispose();
 405                    }
 0406                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
 407                }
 408            }
 0409            if (_shouldTrace)
 410            {
 0411                ServiceClientTracing.Exit(_invocationId, _result);
 412            }
 0413            return _result;
 0414        }
 415
 416        /// <summary>
 417        /// Hard-delete an application.
 418        /// </summary>
 419        /// <param name='applicationObjectId'>
 420        /// Application object ID.
 421        /// </param>
 422        /// <param name='customHeaders'>
 423        /// Headers that will be added to request.
 424        /// </param>
 425        /// <param name='cancellationToken'>
 426        /// The cancellation token.
 427        /// </param>
 428        /// <exception cref="GraphErrorException">
 429        /// Thrown when the operation returned an invalid status code
 430        /// </exception>
 431        /// <exception cref="ValidationException">
 432        /// Thrown when a required parameter is null
 433        /// </exception>
 434        /// <exception cref="System.ArgumentNullException">
 435        /// Thrown when a required parameter is null
 436        /// </exception>
 437        /// <return>
 438        /// A response object containing the response body and response headers.
 439        /// </return>
 440        public async Task<AzureOperationResponse> HardDeleteWithHttpMessagesAsync(string applicationObjectId, Dictionary
 441        {
 0442            if (applicationObjectId == null)
 443            {
 0444                throw new ValidationException(ValidationRules.CannotBeNull, "applicationObjectId");
 445            }
 0446            if (Client.ApiVersion == null)
 447            {
 0448                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
 449            }
 0450            if (Client.TenantID == null)
 451            {
 0452                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.TenantID");
 453            }
 454            // Tracing
 0455            bool _shouldTrace = ServiceClientTracing.IsEnabled;
 0456            string _invocationId = null;
 0457            if (_shouldTrace)
 458            {
 0459                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
 0460                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
 0461                tracingParameters.Add("applicationObjectId", applicationObjectId);
 0462                tracingParameters.Add("cancellationToken", cancellationToken);
 0463                ServiceClientTracing.Enter(_invocationId, this, "HardDelete", tracingParameters);
 464            }
 465            // Construct URL
 0466            var _baseUrl = Client.BaseUri.AbsoluteUri;
 0467            var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{tenantID}/delete
 0468            _url = _url.Replace("{applicationObjectId}", System.Uri.EscapeDataString(applicationObjectId));
 0469            _url = _url.Replace("{tenantID}", System.Uri.EscapeDataString(Client.TenantID));
 0470            List<string> _queryParameters = new List<string>();
 0471            if (Client.ApiVersion != null)
 472            {
 0473                _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
 474            }
 0475            if (_queryParameters.Count > 0)
 476            {
 0477                _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
 478            }
 479            // Create HTTP transport objects
 0480            var _httpRequest = new HttpRequestMessage();
 0481            HttpResponseMessage _httpResponse = null;
 0482            _httpRequest.Method = new HttpMethod("DELETE");
 0483            _httpRequest.RequestUri = new System.Uri(_url);
 484            // Set Headers
 0485            if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
 486            {
 0487                _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString())
 488            }
 0489            if (Client.AcceptLanguage != null)
 490            {
 0491                if (_httpRequest.Headers.Contains("accept-language"))
 492                {
 0493                    _httpRequest.Headers.Remove("accept-language");
 494                }
 0495                _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
 496            }
 497
 498
 0499            if (customHeaders != null)
 500            {
 0501                foreach(var _header in customHeaders)
 502                {
 0503                    if (_httpRequest.Headers.Contains(_header.Key))
 504                    {
 0505                        _httpRequest.Headers.Remove(_header.Key);
 506                    }
 0507                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
 508                }
 509            }
 510
 511            // Serialize Request
 0512            string _requestContent = null;
 513            // Set Credentials
 0514            if (Client.Credentials != null)
 515            {
 0516                cancellationToken.ThrowIfCancellationRequested();
 0517                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 518            }
 519            // Send Request
 0520            if (_shouldTrace)
 521            {
 0522                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
 523            }
 0524            cancellationToken.ThrowIfCancellationRequested();
 0525            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 0526            if (_shouldTrace)
 527            {
 0528                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
 529            }
 0530            HttpStatusCode _statusCode = _httpResponse.StatusCode;
 0531            cancellationToken.ThrowIfCancellationRequested();
 0532            string _responseContent = null;
 0533            if ((int)_statusCode != 204)
 534            {
 0535                var ex = new GraphErrorException(string.Format("Operation returned an invalid status code '{0}'", _statu
 536                try
 537                {
 0538                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 0539                    GraphError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<GraphError>(_responseC
 0540                    if (_errorBody != null)
 541                    {
 0542                        ex.Body = _errorBody;
 543                    }
 0544                }
 0545                catch (JsonException)
 546                {
 547                    // Ignore the exception
 0548                }
 0549                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
 0550                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
 0551                if (_shouldTrace)
 552                {
 0553                    ServiceClientTracing.Error(_invocationId, ex);
 554                }
 0555                _httpRequest.Dispose();
 0556                if (_httpResponse != null)
 557                {
 0558                    _httpResponse.Dispose();
 559                }
 0560                throw ex;
 561            }
 562            // Create Result
 0563            var _result = new AzureOperationResponse();
 0564            _result.Request = _httpRequest;
 0565            _result.Response = _httpResponse;
 0566            if (_httpResponse.Headers.Contains("x-ms-request-id"))
 567            {
 0568                _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
 569            }
 0570            if (_shouldTrace)
 571            {
 0572                ServiceClientTracing.Exit(_invocationId, _result);
 573            }
 0574            return _result;
 0575        }
 576
 577        /// <summary>
 578        /// Gets a list of deleted applications in the directory.
 579        /// </summary>
 580        /// <param name='nextLink'>
 581        /// Next link for the list operation.
 582        /// </param>
 583        /// <param name='customHeaders'>
 584        /// Headers that will be added to request.
 585        /// </param>
 586        /// <param name='cancellationToken'>
 587        /// The cancellation token.
 588        /// </param>
 589        /// <exception cref="GraphErrorException">
 590        /// Thrown when the operation returned an invalid status code
 591        /// </exception>
 592        /// <exception cref="SerializationException">
 593        /// Thrown when unable to deserialize the response
 594        /// </exception>
 595        /// <exception cref="ValidationException">
 596        /// Thrown when a required parameter is null
 597        /// </exception>
 598        /// <exception cref="System.ArgumentNullException">
 599        /// Thrown when a required parameter is null
 600        /// </exception>
 601        /// <return>
 602        /// A response object containing the response body and response headers.
 603        /// </return>
 604        public async Task<AzureOperationResponse<IPage<Application>>> ListNextWithHttpMessagesAsync(string nextLink, Dic
 605        {
 0606            if (nextLink == null)
 607            {
 0608                throw new ValidationException(ValidationRules.CannotBeNull, "nextLink");
 609            }
 0610            if (Client.ApiVersion == null)
 611            {
 0612                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
 613            }
 0614            if (Client.TenantID == null)
 615            {
 0616                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.TenantID");
 617            }
 618            // Tracing
 0619            bool _shouldTrace = ServiceClientTracing.IsEnabled;
 0620            string _invocationId = null;
 0621            if (_shouldTrace)
 622            {
 0623                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
 0624                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
 0625                tracingParameters.Add("nextLink", nextLink);
 0626                tracingParameters.Add("cancellationToken", cancellationToken);
 0627                ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters);
 628            }
 629            // Construct URL
 0630            var _baseUrl = Client.BaseUri.AbsoluteUri;
 0631            var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{tenantID}/{nextL
 0632            _url = _url.Replace("{nextLink}", nextLink);
 0633            _url = _url.Replace("{tenantID}", System.Uri.EscapeDataString(Client.TenantID));
 0634            List<string> _queryParameters = new List<string>();
 0635            if (Client.ApiVersion != null)
 636            {
 0637                _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
 638            }
 0639            if (_queryParameters.Count > 0)
 640            {
 0641                _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
 642            }
 643            // Create HTTP transport objects
 0644            var _httpRequest = new HttpRequestMessage();
 0645            HttpResponseMessage _httpResponse = null;
 0646            _httpRequest.Method = new HttpMethod("GET");
 0647            _httpRequest.RequestUri = new System.Uri(_url);
 648            // Set Headers
 0649            if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
 650            {
 0651                _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString())
 652            }
 0653            if (Client.AcceptLanguage != null)
 654            {
 0655                if (_httpRequest.Headers.Contains("accept-language"))
 656                {
 0657                    _httpRequest.Headers.Remove("accept-language");
 658                }
 0659                _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
 660            }
 661
 662
 0663            if (customHeaders != null)
 664            {
 0665                foreach(var _header in customHeaders)
 666                {
 0667                    if (_httpRequest.Headers.Contains(_header.Key))
 668                    {
 0669                        _httpRequest.Headers.Remove(_header.Key);
 670                    }
 0671                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
 672                }
 673            }
 674
 675            // Serialize Request
 0676            string _requestContent = null;
 677            // Set Credentials
 0678            if (Client.Credentials != null)
 679            {
 0680                cancellationToken.ThrowIfCancellationRequested();
 0681                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 682            }
 683            // Send Request
 0684            if (_shouldTrace)
 685            {
 0686                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
 687            }
 0688            cancellationToken.ThrowIfCancellationRequested();
 0689            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 0690            if (_shouldTrace)
 691            {
 0692                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
 693            }
 0694            HttpStatusCode _statusCode = _httpResponse.StatusCode;
 0695            cancellationToken.ThrowIfCancellationRequested();
 0696            string _responseContent = null;
 0697            if ((int)_statusCode != 200)
 698            {
 0699                var ex = new GraphErrorException(string.Format("Operation returned an invalid status code '{0}'", _statu
 700                try
 701                {
 0702                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 0703                    GraphError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<GraphError>(_responseC
 0704                    if (_errorBody != null)
 705                    {
 0706                        ex.Body = _errorBody;
 707                    }
 0708                }
 0709                catch (JsonException)
 710                {
 711                    // Ignore the exception
 0712                }
 0713                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
 0714                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
 0715                if (_shouldTrace)
 716                {
 0717                    ServiceClientTracing.Error(_invocationId, ex);
 718                }
 0719                _httpRequest.Dispose();
 0720                if (_httpResponse != null)
 721                {
 0722                    _httpResponse.Dispose();
 723                }
 0724                throw ex;
 725            }
 726            // Create Result
 0727            var _result = new AzureOperationResponse<IPage<Application>>();
 0728            _result.Request = _httpRequest;
 0729            _result.Response = _httpResponse;
 0730            if (_httpResponse.Headers.Contains("x-ms-request-id"))
 731            {
 0732                _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
 733            }
 734            // Deserialize Response
 0735            if ((int)_statusCode == 200)
 736            {
 0737                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 738                try
 739                {
 0740                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Page<Application>>(_responseCont
 0741                }
 0742                catch (JsonException ex)
 743                {
 0744                    _httpRequest.Dispose();
 0745                    if (_httpResponse != null)
 746                    {
 0747                        _httpResponse.Dispose();
 748                    }
 0749                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
 750                }
 751            }
 0752            if (_shouldTrace)
 753            {
 0754                ServiceClientTracing.Exit(_invocationId, _result);
 755            }
 0756            return _result;
 0757        }
 758
 759    }
 760}