< Summary

Class:Microsoft.Azure.ContainerRegistry.RepositoryOperations
Assembly:Microsoft.Azure.ContainerRegistry
File(s):C:\Git\azure-sdk-for-net\sdk\containerregistry\Microsoft.Azure.ContainerRegistry\src\Generated\RepositoryOperations.cs
Covered lines:186
Uncovered lines:153
Coverable lines:339
Total lines:761
Line coverage:54.8% (186 of 339)
Covered branches:94
Total branches:196
Branch coverage:47.9% (94 of 196)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-80%50%
get_Client()-100%100%
GetListWithHttpMessagesAsync()-52.75%50%
GetAttributesWithHttpMessagesAsync()-53.66%45.83%
DeleteWithHttpMessagesAsync()-54.88%47.92%
UpdateAttributesWithHttpMessagesAsync()-56.41%47.83%

File(s)

C:\Git\azure-sdk-for-net\sdk\containerregistry\Microsoft.Azure.ContainerRegistry\src\Generated\RepositoryOperations.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.ContainerRegistry
 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    /// RepositoryOperations operations.
 27    /// </summary>
 28    internal partial class RepositoryOperations : IServiceOperations<AzureContainerRegistryClient>, IRepositoryOperation
 29    {
 30        /// <summary>
 31        /// Initializes a new instance of the RepositoryOperations 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>
 6039        internal RepositoryOperations(AzureContainerRegistryClient client)
 40        {
 6041            if (client == null)
 42            {
 043                throw new System.ArgumentNullException("client");
 44            }
 6045            Client = client;
 6046        }
 47
 48        /// <summary>
 49        /// Gets a reference to the AzureContainerRegistryClient
 50        /// </summary>
 24451        public AzureContainerRegistryClient Client { get; private set; }
 52
 53        /// <summary>
 54        /// List repositories
 55        /// </summary>
 56        /// <param name='last'>
 57        /// Query parameter for the last item in previous query. Result set will
 58        /// include values lexically after last.
 59        /// </param>
 60        /// <param name='n'>
 61        /// query parameter for max number of items
 62        /// </param>
 63        /// <param name='customHeaders'>
 64        /// Headers that will be added to request.
 65        /// </param>
 66        /// <param name='cancellationToken'>
 67        /// The cancellation token.
 68        /// </param>
 69        /// <exception cref="AcrErrorsException">
 70        /// Thrown when the operation returned an invalid status code
 71        /// </exception>
 72        /// <exception cref="SerializationException">
 73        /// Thrown when unable to deserialize the response
 74        /// </exception>
 75        /// <exception cref="ValidationException">
 76        /// Thrown when a required parameter is null
 77        /// </exception>
 78        /// <exception cref="System.ArgumentNullException">
 79        /// Thrown when a required parameter is null
 80        /// </exception>
 81        /// <return>
 82        /// A response object containing the response body and response headers.
 83        /// </return>
 84        public async Task<AzureOperationResponse<Repositories,RepositoryGetListHeaders>> GetListWithHttpMessagesAsync(st
 85        {
 686            if (Client.LoginUri == null)
 87            {
 088                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.LoginUri");
 89            }
 90            // Tracing
 691            bool _shouldTrace = ServiceClientTracing.IsEnabled;
 692            string _invocationId = null;
 693            if (_shouldTrace)
 94            {
 095                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
 096                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
 097                tracingParameters.Add("last", last);
 098                tracingParameters.Add("n", n);
 099                tracingParameters.Add("cancellationToken", cancellationToken);
 0100                ServiceClientTracing.Enter(_invocationId, this, "GetList", tracingParameters);
 101            }
 102            // Construct URL
 6103            var _baseUrl = Client.BaseUri;
 6104            var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "acr/v1/_catalog";
 6105            _url = _url.Replace("{url}", Client.LoginUri);
 6106            List<string> _queryParameters = new List<string>();
 6107            if (last != null)
 108            {
 0109                _queryParameters.Add(string.Format("last={0}", System.Uri.EscapeDataString(last)));
 110            }
 6111            if (n != null)
 112            {
 2113                _queryParameters.Add(string.Format("n={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConve
 114            }
 6115            if (_queryParameters.Count > 0)
 116            {
 2117                _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
 118            }
 119            // Create HTTP transport objects
 6120            var _httpRequest = new HttpRequestMessage();
 6121            HttpResponseMessage _httpResponse = null;
 6122            _httpRequest.Method = new HttpMethod("GET");
 6123            _httpRequest.RequestUri = new System.Uri(_url);
 124            // Set Headers
 6125            if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
 126            {
 6127                _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString())
 128            }
 6129            if (Client.AcceptLanguage != null)
 130            {
 6131                if (_httpRequest.Headers.Contains("accept-language"))
 132                {
 0133                    _httpRequest.Headers.Remove("accept-language");
 134                }
 6135                _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
 136            }
 137
 138
 6139            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
 6152            string _requestContent = null;
 153            // Set Credentials
 6154            if (Client.Credentials != null)
 155            {
 6156                cancellationToken.ThrowIfCancellationRequested();
 6157                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 158            }
 159            // Send Request
 6160            if (_shouldTrace)
 161            {
 0162                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
 163            }
 6164            cancellationToken.ThrowIfCancellationRequested();
 6165            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 6166            if (_shouldTrace)
 167            {
 0168                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
 169            }
 6170            HttpStatusCode _statusCode = _httpResponse.StatusCode;
 6171            cancellationToken.ThrowIfCancellationRequested();
 6172            string _responseContent = null;
 6173            if ((int)_statusCode != 200)
 174            {
 0175                var ex = new AcrErrorsException(string.Format("Operation returned an invalid status code '{0}'", _status
 176                try
 177                {
 0178                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 0179                    AcrErrors _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<AcrErrors>(_responseCon
 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
 6203            var _result = new AzureOperationResponse<Repositories,RepositoryGetListHeaders>();
 6204            _result.Request = _httpRequest;
 6205            _result.Response = _httpResponse;
 6206            if (_httpResponse.Headers.Contains("x-ms-request-id"))
 207            {
 0208                _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
 209            }
 210            // Deserialize Response
 6211            if ((int)_statusCode == 200)
 212            {
 6213                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 214                try
 215                {
 6216                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Repositories>(_responseContent, 
 6217                }
 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            }
 228            try
 229            {
 6230                _result.Headers = _httpResponse.GetHeadersAsJson().ToObject<RepositoryGetListHeaders>(JsonSerializer.Cre
 6231            }
 0232            catch (JsonException ex)
 233            {
 0234                _httpRequest.Dispose();
 0235                if (_httpResponse != null)
 236                {
 0237                    _httpResponse.Dispose();
 238                }
 0239                throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().
 240            }
 6241            if (_shouldTrace)
 242            {
 0243                ServiceClientTracing.Exit(_invocationId, _result);
 244            }
 6245            return _result;
 6246        }
 247
 248        /// <summary>
 249        /// Get repository attributes
 250        /// </summary>
 251        /// <param name='name'>
 252        /// Name of the image (including the namespace)
 253        /// </param>
 254        /// <param name='customHeaders'>
 255        /// Headers that will be added to request.
 256        /// </param>
 257        /// <param name='cancellationToken'>
 258        /// The cancellation token.
 259        /// </param>
 260        /// <exception cref="AcrErrorsException">
 261        /// Thrown when the operation returned an invalid status code
 262        /// </exception>
 263        /// <exception cref="SerializationException">
 264        /// Thrown when unable to deserialize the response
 265        /// </exception>
 266        /// <exception cref="ValidationException">
 267        /// Thrown when a required parameter is null
 268        /// </exception>
 269        /// <exception cref="System.ArgumentNullException">
 270        /// Thrown when a required parameter is null
 271        /// </exception>
 272        /// <return>
 273        /// A response object containing the response body and response headers.
 274        /// </return>
 275        public async Task<AzureOperationResponse<RepositoryAttributes>> GetAttributesWithHttpMessagesAsync(string name, 
 276        {
 4277            if (Client.LoginUri == null)
 278            {
 0279                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.LoginUri");
 280            }
 4281            if (name == null)
 282            {
 0283                throw new ValidationException(ValidationRules.CannotBeNull, "name");
 284            }
 285            // Tracing
 4286            bool _shouldTrace = ServiceClientTracing.IsEnabled;
 4287            string _invocationId = null;
 4288            if (_shouldTrace)
 289            {
 0290                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
 0291                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
 0292                tracingParameters.Add("name", name);
 0293                tracingParameters.Add("cancellationToken", cancellationToken);
 0294                ServiceClientTracing.Enter(_invocationId, this, "GetAttributes", tracingParameters);
 295            }
 296            // Construct URL
 4297            var _baseUrl = Client.BaseUri;
 4298            var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "acr/v1/{name}";
 4299            _url = _url.Replace("{url}", Client.LoginUri);
 4300            _url = _url.Replace("{name}", System.Uri.EscapeDataString(name));
 4301            List<string> _queryParameters = new List<string>();
 4302            if (_queryParameters.Count > 0)
 303            {
 0304                _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
 305            }
 306            // Create HTTP transport objects
 4307            var _httpRequest = new HttpRequestMessage();
 4308            HttpResponseMessage _httpResponse = null;
 4309            _httpRequest.Method = new HttpMethod("GET");
 4310            _httpRequest.RequestUri = new System.Uri(_url);
 311            // Set Headers
 4312            if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
 313            {
 4314                _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString())
 315            }
 4316            if (Client.AcceptLanguage != null)
 317            {
 4318                if (_httpRequest.Headers.Contains("accept-language"))
 319                {
 0320                    _httpRequest.Headers.Remove("accept-language");
 321                }
 4322                _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
 323            }
 324
 325
 4326            if (customHeaders != null)
 327            {
 0328                foreach(var _header in customHeaders)
 329                {
 0330                    if (_httpRequest.Headers.Contains(_header.Key))
 331                    {
 0332                        _httpRequest.Headers.Remove(_header.Key);
 333                    }
 0334                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
 335                }
 336            }
 337
 338            // Serialize Request
 4339            string _requestContent = null;
 340            // Set Credentials
 4341            if (Client.Credentials != null)
 342            {
 4343                cancellationToken.ThrowIfCancellationRequested();
 4344                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 345            }
 346            // Send Request
 4347            if (_shouldTrace)
 348            {
 0349                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
 350            }
 4351            cancellationToken.ThrowIfCancellationRequested();
 4352            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 4353            if (_shouldTrace)
 354            {
 0355                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
 356            }
 4357            HttpStatusCode _statusCode = _httpResponse.StatusCode;
 4358            cancellationToken.ThrowIfCancellationRequested();
 4359            string _responseContent = null;
 4360            if ((int)_statusCode != 200)
 361            {
 0362                var ex = new AcrErrorsException(string.Format("Operation returned an invalid status code '{0}'", _status
 363                try
 364                {
 0365                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 0366                    AcrErrors _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<AcrErrors>(_responseCon
 0367                    if (_errorBody != null)
 368                    {
 0369                        ex.Body = _errorBody;
 370                    }
 0371                }
 0372                catch (JsonException)
 373                {
 374                    // Ignore the exception
 0375                }
 0376                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
 0377                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
 0378                if (_shouldTrace)
 379                {
 0380                    ServiceClientTracing.Error(_invocationId, ex);
 381                }
 0382                _httpRequest.Dispose();
 0383                if (_httpResponse != null)
 384                {
 0385                    _httpResponse.Dispose();
 386                }
 0387                throw ex;
 388            }
 389            // Create Result
 4390            var _result = new AzureOperationResponse<RepositoryAttributes>();
 4391            _result.Request = _httpRequest;
 4392            _result.Response = _httpResponse;
 4393            if (_httpResponse.Headers.Contains("x-ms-request-id"))
 394            {
 0395                _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
 396            }
 397            // Deserialize Response
 4398            if ((int)_statusCode == 200)
 399            {
 4400                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 401                try
 402                {
 4403                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<RepositoryAttributes>(_responseC
 4404                }
 0405                catch (JsonException ex)
 406                {
 0407                    _httpRequest.Dispose();
 0408                    if (_httpResponse != null)
 409                    {
 0410                        _httpResponse.Dispose();
 411                    }
 0412                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
 413                }
 414            }
 4415            if (_shouldTrace)
 416            {
 0417                ServiceClientTracing.Exit(_invocationId, _result);
 418            }
 4419            return _result;
 4420        }
 421
 422        /// <summary>
 423        /// Delete the repository identified by `name`
 424        /// </summary>
 425        /// <param name='name'>
 426        /// Name of the image (including the namespace)
 427        /// </param>
 428        /// <param name='customHeaders'>
 429        /// Headers that will be added to request.
 430        /// </param>
 431        /// <param name='cancellationToken'>
 432        /// The cancellation token.
 433        /// </param>
 434        /// <exception cref="AcrErrorsException">
 435        /// Thrown when the operation returned an invalid status code
 436        /// </exception>
 437        /// <exception cref="SerializationException">
 438        /// Thrown when unable to deserialize the response
 439        /// </exception>
 440        /// <exception cref="ValidationException">
 441        /// Thrown when a required parameter is null
 442        /// </exception>
 443        /// <exception cref="System.ArgumentNullException">
 444        /// Thrown when a required parameter is null
 445        /// </exception>
 446        /// <return>
 447        /// A response object containing the response body and response headers.
 448        /// </return>
 449        public async Task<AzureOperationResponse<DeletedRepository>> DeleteWithHttpMessagesAsync(string name, Dictionary
 450        {
 2451            if (Client.LoginUri == null)
 452            {
 0453                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.LoginUri");
 454            }
 2455            if (name == null)
 456            {
 0457                throw new ValidationException(ValidationRules.CannotBeNull, "name");
 458            }
 459            // Tracing
 2460            bool _shouldTrace = ServiceClientTracing.IsEnabled;
 2461            string _invocationId = null;
 2462            if (_shouldTrace)
 463            {
 0464                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
 0465                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
 0466                tracingParameters.Add("name", name);
 0467                tracingParameters.Add("cancellationToken", cancellationToken);
 0468                ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters);
 469            }
 470            // Construct URL
 2471            var _baseUrl = Client.BaseUri;
 2472            var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "acr/v1/{name}";
 2473            _url = _url.Replace("{url}", Client.LoginUri);
 2474            _url = _url.Replace("{name}", System.Uri.EscapeDataString(name));
 2475            List<string> _queryParameters = new List<string>();
 2476            if (_queryParameters.Count > 0)
 477            {
 0478                _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
 479            }
 480            // Create HTTP transport objects
 2481            var _httpRequest = new HttpRequestMessage();
 2482            HttpResponseMessage _httpResponse = null;
 2483            _httpRequest.Method = new HttpMethod("DELETE");
 2484            _httpRequest.RequestUri = new System.Uri(_url);
 485            // Set Headers
 2486            if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
 487            {
 2488                _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString())
 489            }
 2490            if (Client.AcceptLanguage != null)
 491            {
 2492                if (_httpRequest.Headers.Contains("accept-language"))
 493                {
 0494                    _httpRequest.Headers.Remove("accept-language");
 495                }
 2496                _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
 497            }
 498
 499
 2500            if (customHeaders != null)
 501            {
 0502                foreach(var _header in customHeaders)
 503                {
 0504                    if (_httpRequest.Headers.Contains(_header.Key))
 505                    {
 0506                        _httpRequest.Headers.Remove(_header.Key);
 507                    }
 0508                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
 509                }
 510            }
 511
 512            // Serialize Request
 2513            string _requestContent = null;
 514            // Set Credentials
 2515            if (Client.Credentials != null)
 516            {
 2517                cancellationToken.ThrowIfCancellationRequested();
 2518                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 519            }
 520            // Send Request
 2521            if (_shouldTrace)
 522            {
 0523                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
 524            }
 2525            cancellationToken.ThrowIfCancellationRequested();
 2526            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 2527            if (_shouldTrace)
 528            {
 0529                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
 530            }
 2531            HttpStatusCode _statusCode = _httpResponse.StatusCode;
 2532            cancellationToken.ThrowIfCancellationRequested();
 2533            string _responseContent = null;
 2534            if ((int)_statusCode != 202)
 535            {
 0536                var ex = new AcrErrorsException(string.Format("Operation returned an invalid status code '{0}'", _status
 537                try
 538                {
 0539                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 0540                    AcrErrors _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<AcrErrors>(_responseCon
 0541                    if (_errorBody != null)
 542                    {
 0543                        ex.Body = _errorBody;
 544                    }
 0545                }
 0546                catch (JsonException)
 547                {
 548                    // Ignore the exception
 0549                }
 0550                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
 0551                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
 0552                if (_shouldTrace)
 553                {
 0554                    ServiceClientTracing.Error(_invocationId, ex);
 555                }
 0556                _httpRequest.Dispose();
 0557                if (_httpResponse != null)
 558                {
 0559                    _httpResponse.Dispose();
 560                }
 0561                throw ex;
 562            }
 563            // Create Result
 2564            var _result = new AzureOperationResponse<DeletedRepository>();
 2565            _result.Request = _httpRequest;
 2566            _result.Response = _httpResponse;
 2567            if (_httpResponse.Headers.Contains("x-ms-request-id"))
 568            {
 2569                _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
 570            }
 571            // Deserialize Response
 2572            if ((int)_statusCode == 202)
 573            {
 2574                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 575                try
 576                {
 2577                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<DeletedRepository>(_responseCont
 2578                }
 0579                catch (JsonException ex)
 580                {
 0581                    _httpRequest.Dispose();
 0582                    if (_httpResponse != null)
 583                    {
 0584                        _httpResponse.Dispose();
 585                    }
 0586                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
 587                }
 588            }
 2589            if (_shouldTrace)
 590            {
 0591                ServiceClientTracing.Exit(_invocationId, _result);
 592            }
 2593            return _result;
 2594        }
 595
 596        /// <summary>
 597        /// Update the attribute identified by `name` where `reference` is the name of
 598        /// the repository.
 599        /// </summary>
 600        /// <param name='name'>
 601        /// Name of the image (including the namespace)
 602        /// </param>
 603        /// <param name='value'>
 604        /// Repository attribute value
 605        /// </param>
 606        /// <param name='customHeaders'>
 607        /// Headers that will be added to request.
 608        /// </param>
 609        /// <param name='cancellationToken'>
 610        /// The cancellation token.
 611        /// </param>
 612        /// <exception cref="AcrErrorsException">
 613        /// Thrown when the operation returned an invalid status code
 614        /// </exception>
 615        /// <exception cref="ValidationException">
 616        /// Thrown when a required parameter is null
 617        /// </exception>
 618        /// <exception cref="System.ArgumentNullException">
 619        /// Thrown when a required parameter is null
 620        /// </exception>
 621        /// <return>
 622        /// A response object containing the response body and response headers.
 623        /// </return>
 624        public async Task<AzureOperationResponse> UpdateAttributesWithHttpMessagesAsync(string name, ChangeableAttribute
 625        {
 4626            if (Client.LoginUri == null)
 627            {
 0628                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.LoginUri");
 629            }
 4630            if (name == null)
 631            {
 0632                throw new ValidationException(ValidationRules.CannotBeNull, "name");
 633            }
 634            // Tracing
 4635            bool _shouldTrace = ServiceClientTracing.IsEnabled;
 4636            string _invocationId = null;
 4637            if (_shouldTrace)
 638            {
 0639                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
 0640                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
 0641                tracingParameters.Add("name", name);
 0642                tracingParameters.Add("value", value);
 0643                tracingParameters.Add("cancellationToken", cancellationToken);
 0644                ServiceClientTracing.Enter(_invocationId, this, "UpdateAttributes", tracingParameters);
 645            }
 646            // Construct URL
 4647            var _baseUrl = Client.BaseUri;
 4648            var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "acr/v1/{name}";
 4649            _url = _url.Replace("{url}", Client.LoginUri);
 4650            _url = _url.Replace("{name}", System.Uri.EscapeDataString(name));
 4651            List<string> _queryParameters = new List<string>();
 4652            if (_queryParameters.Count > 0)
 653            {
 0654                _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
 655            }
 656            // Create HTTP transport objects
 4657            var _httpRequest = new HttpRequestMessage();
 4658            HttpResponseMessage _httpResponse = null;
 4659            _httpRequest.Method = new HttpMethod("PATCH");
 4660            _httpRequest.RequestUri = new System.Uri(_url);
 661            // Set Headers
 4662            if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
 663            {
 4664                _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString())
 665            }
 4666            if (Client.AcceptLanguage != null)
 667            {
 4668                if (_httpRequest.Headers.Contains("accept-language"))
 669                {
 0670                    _httpRequest.Headers.Remove("accept-language");
 671                }
 4672                _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
 673            }
 674
 675
 4676            if (customHeaders != null)
 677            {
 0678                foreach(var _header in customHeaders)
 679                {
 0680                    if (_httpRequest.Headers.Contains(_header.Key))
 681                    {
 0682                        _httpRequest.Headers.Remove(_header.Key);
 683                    }
 0684                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
 685                }
 686            }
 687
 688            // Serialize Request
 4689            string _requestContent = null;
 4690            if(value != null)
 691            {
 4692                _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(value, Client.SerializationSettings
 4693                _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
 4694                _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("applicatio
 695            }
 696            // Set Credentials
 4697            if (Client.Credentials != null)
 698            {
 4699                cancellationToken.ThrowIfCancellationRequested();
 4700                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 701            }
 702            // Send Request
 4703            if (_shouldTrace)
 704            {
 0705                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
 706            }
 4707            cancellationToken.ThrowIfCancellationRequested();
 4708            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 4709            if (_shouldTrace)
 710            {
 0711                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
 712            }
 4713            HttpStatusCode _statusCode = _httpResponse.StatusCode;
 4714            cancellationToken.ThrowIfCancellationRequested();
 4715            string _responseContent = null;
 4716            if ((int)_statusCode != 200)
 717            {
 0718                var ex = new AcrErrorsException(string.Format("Operation returned an invalid status code '{0}'", _status
 719                try
 720                {
 0721                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 0722                    AcrErrors _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<AcrErrors>(_responseCon
 0723                    if (_errorBody != null)
 724                    {
 0725                        ex.Body = _errorBody;
 726                    }
 0727                }
 0728                catch (JsonException)
 729                {
 730                    // Ignore the exception
 0731                }
 0732                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
 0733                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
 0734                if (_shouldTrace)
 735                {
 0736                    ServiceClientTracing.Error(_invocationId, ex);
 737                }
 0738                _httpRequest.Dispose();
 0739                if (_httpResponse != null)
 740                {
 0741                    _httpResponse.Dispose();
 742                }
 0743                throw ex;
 744            }
 745            // Create Result
 4746            var _result = new AzureOperationResponse();
 4747            _result.Request = _httpRequest;
 4748            _result.Response = _httpResponse;
 4749            if (_httpResponse.Headers.Contains("x-ms-request-id"))
 750            {
 0751                _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
 752            }
 4753            if (_shouldTrace)
 754            {
 0755                ServiceClientTracing.Exit(_invocationId, _result);
 756            }
 4757            return _result;
 4758        }
 759
 760    }
 761}