< Summary

Class:Microsoft.Azure.Search.SkillsetsOperations
Assembly:Microsoft.Azure.Search.Service
File(s):C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Customizations\Skillsets\SkillsetsOperations.Customization.cs
C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Generated\SkillsetsOperations.cs
Covered lines:255
Uncovered lines:270
Coverable lines:525
Total lines:1163
Line coverage:48.5% (255 of 525)
Covered branches:149
Total branches:330
Branch coverage:45.1% (149 of 330)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
CreateOrUpdateWithHttpMessagesAsync(...)-0%0%
ExistsWithHttpMessagesAsync(...)-100%100%
.ctor(...)-80%50%
get_Client()-100%100%
CreateOrUpdateWithHttpMessagesAsync()-55.65%55.13%
DeleteWithHttpMessagesAsync()-54.95%51.67%
GetWithHttpMessagesAsync()-70%62.9%
ListWithHttpMessagesAsync()-0%0%
CreateWithHttpMessagesAsync()-56.19%53.03%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Customizations\Skillsets\SkillsetsOperations.Customization.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License. See License.txt in the project root for
 3// license information.
 4
 5namespace Microsoft.Azure.Search
 6{
 7    using System.Collections.Generic;
 8    using System.Threading;
 9    using System.Threading.Tasks;
 10    using Microsoft.Rest.Azure;
 11    using Models;
 12
 13    internal partial class SkillsetsOperations
 14    {
 15        /// <inheritdoc />
 16        public Task<AzureOperationResponse<Skillset>> CreateOrUpdateWithHttpMessagesAsync(Skillset skillset, SearchReque
 17        {
 018            return CreateOrUpdateWithHttpMessagesAsync(skillset?.Name, skillset, searchRequestOptions, customHeaders, ca
 19        }
 20
 21        /// <inheritdoc />
 22        public Task<AzureOperationResponse<bool>> ExistsWithHttpMessagesAsync(
 23            string skillsetName,
 24            SearchRequestOptions searchRequestOptions = default(SearchRequestOptions),
 25            Dictionary<string, List<string>> customHeaders = null,
 26            CancellationToken cancellationToken = default(CancellationToken))
 27        {
 428            return ExistsHelper.ExistsFromGetResponse(() =>
 829                this.GetWithHttpMessagesAsync(skillsetName, searchRequestOptions, customHeaders, cancellationToken));
 30        }
 31    }
 32}

C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Generated\SkillsetsOperations.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.Search
 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    /// SkillsetsOperations operations.
 27    /// </summary>
 28    internal partial class SkillsetsOperations : IServiceOperations<SearchServiceClient>, ISkillsetsOperations
 29    {
 30        /// <summary>
 31        /// Initializes a new instance of the SkillsetsOperations 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>
 82439        internal SkillsetsOperations(SearchServiceClient client)
 40        {
 82441            if (client == null)
 42            {
 043                throw new System.ArgumentNullException("client");
 44            }
 82445            Client = client;
 82446        }
 47
 48        /// <summary>
 49        /// Gets a reference to the SearchServiceClient
 50        /// </summary>
 348451        public SearchServiceClient Client { get; private set; }
 52
 53        /// <summary>
 54        /// Creates a new skillset in a search service or updates the skillset if it
 55        /// already exists.
 56        /// <see href="https://docs.microsoft.com/rest/api/searchservice/update-skillset" />
 57        /// </summary>
 58        /// <param name='skillsetName'>
 59        /// The name of the skillset to create or update.
 60        /// </param>
 61        /// <param name='skillset'>
 62        /// The skillset containing one or more skills to create or update in a search
 63        /// service.
 64        /// </param>
 65        /// <param name='searchRequestOptions'>
 66        /// Additional parameters for the operation
 67        /// </param>
 68        /// <param name='customHeaders'>
 69        /// Headers that will be added to request.
 70        /// </param>
 71        /// <param name='cancellationToken'>
 72        /// The cancellation token.
 73        /// </param>
 74        /// <exception cref="CloudException">
 75        /// Thrown when the operation returned an invalid status code
 76        /// </exception>
 77        /// <exception cref="SerializationException">
 78        /// Thrown when unable to deserialize the response
 79        /// </exception>
 80        /// <exception cref="ValidationException">
 81        /// Thrown when a required parameter is null
 82        /// </exception>
 83        /// <exception cref="System.ArgumentNullException">
 84        /// Thrown when a required parameter is null
 85        /// </exception>
 86        /// <return>
 87        /// A response object containing the response body and response headers.
 88        /// </return>
 89        public async Task<AzureOperationResponse<Skillset>> CreateOrUpdateWithHttpMessagesAsync(string skillsetName, Ski
 90        {
 891            if (Client.SearchServiceName == null)
 92            {
 093                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SearchServiceName");
 94            }
 895            if (Client.SearchDnsSuffix == null)
 96            {
 097                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SearchDnsSuffix");
 98            }
 899            if (skillsetName == null)
 100            {
 0101                throw new ValidationException(ValidationRules.CannotBeNull, "skillsetName");
 102            }
 8103            if (skillset == null)
 104            {
 0105                throw new ValidationException(ValidationRules.CannotBeNull, "skillset");
 106            }
 8107            if (skillset != null)
 108            {
 8109                skillset.Validate();
 110            }
 8111            if (Client.ApiVersion == null)
 112            {
 0113                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
 114            }
 8115            string prefer = "return=representation";
 8116            System.Guid? clientRequestId = default(System.Guid?);
 8117            if (searchRequestOptions != null)
 118            {
 0119                clientRequestId = searchRequestOptions.ClientRequestId;
 120            }
 121            // Tracing
 8122            bool _shouldTrace = ServiceClientTracing.IsEnabled;
 8123            string _invocationId = null;
 8124            if (_shouldTrace)
 125            {
 0126                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
 0127                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
 0128                tracingParameters.Add("skillsetName", skillsetName);
 0129                tracingParameters.Add("skillset", skillset);
 0130                tracingParameters.Add("prefer", prefer);
 0131                tracingParameters.Add("clientRequestId", clientRequestId);
 0132                tracingParameters.Add("cancellationToken", cancellationToken);
 0133                ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters);
 134            }
 135            // Construct URL
 8136            var _baseUrl = Client.BaseUri;
 8137            var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "skillsets('{skillsetName}')";
 8138            _url = _url.Replace("{searchServiceName}", Client.SearchServiceName);
 8139            _url = _url.Replace("{searchDnsSuffix}", Client.SearchDnsSuffix);
 8140            _url = _url.Replace("{skillsetName}", System.Uri.EscapeDataString(skillsetName));
 8141            List<string> _queryParameters = new List<string>();
 8142            if (Client.ApiVersion != null)
 143            {
 8144                _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
 145            }
 8146            if (_queryParameters.Count > 0)
 147            {
 8148                _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
 149            }
 150            // Create HTTP transport objects
 8151            var _httpRequest = new HttpRequestMessage();
 8152            HttpResponseMessage _httpResponse = null;
 8153            _httpRequest.Method = new HttpMethod("PUT");
 8154            _httpRequest.RequestUri = new System.Uri(_url);
 155            // Set Headers
 8156            if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
 157            {
 8158                _httpRequest.Headers.TryAddWithoutValidation("client-request-id", System.Guid.NewGuid().ToString());
 159            }
 8160            if (prefer != null)
 161            {
 8162                if (_httpRequest.Headers.Contains("Prefer"))
 163                {
 0164                    _httpRequest.Headers.Remove("Prefer");
 165                }
 8166                _httpRequest.Headers.TryAddWithoutValidation("Prefer", prefer);
 167            }
 8168            if (Client.AcceptLanguage != null)
 169            {
 8170                if (_httpRequest.Headers.Contains("accept-language"))
 171                {
 0172                    _httpRequest.Headers.Remove("accept-language");
 173                }
 8174                _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
 175            }
 8176            if (clientRequestId != null)
 177            {
 0178                if (_httpRequest.Headers.Contains("client-request-id"))
 179                {
 0180                    _httpRequest.Headers.Remove("client-request-id");
 181                }
 0182                _httpRequest.Headers.TryAddWithoutValidation("client-request-id", Rest.Serialization.SafeJsonConvert.Ser
 183            }
 184
 185
 8186            if (customHeaders != null)
 187            {
 0188                foreach(var _header in customHeaders)
 189                {
 0190                    if (_httpRequest.Headers.Contains(_header.Key))
 191                    {
 0192                        _httpRequest.Headers.Remove(_header.Key);
 193                    }
 0194                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
 195                }
 196            }
 197
 198            // Serialize Request
 8199            string _requestContent = null;
 8200            if(skillset != null)
 201            {
 8202                _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(skillset, Client.SerializationSetti
 8203                _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
 8204                _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("applicatio
 205            }
 206            // Set Credentials
 8207            if (Client.Credentials != null)
 208            {
 8209                cancellationToken.ThrowIfCancellationRequested();
 8210                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 211            }
 212            // Send Request
 8213            if (_shouldTrace)
 214            {
 0215                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
 216            }
 8217            cancellationToken.ThrowIfCancellationRequested();
 8218            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 8219            if (_shouldTrace)
 220            {
 0221                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
 222            }
 8223            HttpStatusCode _statusCode = _httpResponse.StatusCode;
 8224            cancellationToken.ThrowIfCancellationRequested();
 8225            string _responseContent = null;
 8226            if ((int)_statusCode != 200 && (int)_statusCode != 201)
 227            {
 0228                var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode
 229                try
 230                {
 0231                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 0232                    CloudError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<CloudError>(_responseC
 0233                    if (_errorBody != null)
 234                    {
 0235                        ex = new CloudException(_errorBody.Message);
 0236                        ex.Body = _errorBody;
 237                    }
 0238                }
 0239                catch (JsonException)
 240                {
 241                    // Ignore the exception
 0242                }
 0243                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
 0244                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
 0245                if (_httpResponse.Headers.Contains("request-id"))
 246                {
 0247                    ex.RequestId = _httpResponse.Headers.GetValues("request-id").FirstOrDefault();
 248                }
 0249                if (_shouldTrace)
 250                {
 0251                    ServiceClientTracing.Error(_invocationId, ex);
 252                }
 0253                _httpRequest.Dispose();
 0254                if (_httpResponse != null)
 255                {
 0256                    _httpResponse.Dispose();
 257                }
 0258                throw ex;
 259            }
 260            // Create Result
 8261            var _result = new AzureOperationResponse<Skillset>();
 8262            _result.Request = _httpRequest;
 8263            _result.Response = _httpResponse;
 8264            if (_httpResponse.Headers.Contains("request-id"))
 265            {
 8266                _result.RequestId = _httpResponse.Headers.GetValues("request-id").FirstOrDefault();
 267            }
 268            // Deserialize Response
 8269            if ((int)_statusCode == 200)
 270            {
 2271                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 272                try
 273                {
 2274                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Skillset>(_responseContent, Clie
 2275                }
 0276                catch (JsonException ex)
 277                {
 0278                    _httpRequest.Dispose();
 0279                    if (_httpResponse != null)
 280                    {
 0281                        _httpResponse.Dispose();
 282                    }
 0283                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
 284                }
 285            }
 286            // Deserialize Response
 8287            if ((int)_statusCode == 201)
 288            {
 6289                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 290                try
 291                {
 6292                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Skillset>(_responseContent, Clie
 6293                }
 0294                catch (JsonException ex)
 295                {
 0296                    _httpRequest.Dispose();
 0297                    if (_httpResponse != null)
 298                    {
 0299                        _httpResponse.Dispose();
 300                    }
 0301                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
 302                }
 303            }
 8304            if (_shouldTrace)
 305            {
 0306                ServiceClientTracing.Exit(_invocationId, _result);
 307            }
 8308            return _result;
 8309        }
 310
 311        /// <summary>
 312        /// Deletes a skillset in a search service.
 313        /// <see href="https://docs.microsoft.com/rest/api/searchservice/delete-skillset" />
 314        /// </summary>
 315        /// <param name='skillsetName'>
 316        /// The name of the skillset to delete.
 317        /// </param>
 318        /// <param name='searchRequestOptions'>
 319        /// Additional parameters for the operation
 320        /// </param>
 321        /// <param name='customHeaders'>
 322        /// Headers that will be added to request.
 323        /// </param>
 324        /// <param name='cancellationToken'>
 325        /// The cancellation token.
 326        /// </param>
 327        /// <exception cref="CloudException">
 328        /// Thrown when the operation returned an invalid status code
 329        /// </exception>
 330        /// <exception cref="ValidationException">
 331        /// Thrown when a required parameter is null
 332        /// </exception>
 333        /// <exception cref="System.ArgumentNullException">
 334        /// Thrown when a required parameter is null
 335        /// </exception>
 336        /// <return>
 337        /// A response object containing the response body and response headers.
 338        /// </return>
 339        public async Task<AzureOperationResponse> DeleteWithHttpMessagesAsync(string skillsetName, SearchRequestOptions 
 340        {
 76341            if (Client.SearchServiceName == null)
 342            {
 0343                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SearchServiceName");
 344            }
 76345            if (Client.SearchDnsSuffix == null)
 346            {
 0347                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SearchDnsSuffix");
 348            }
 76349            if (skillsetName == null)
 350            {
 0351                throw new ValidationException(ValidationRules.CannotBeNull, "skillsetName");
 352            }
 76353            if (Client.ApiVersion == null)
 354            {
 0355                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
 356            }
 76357            System.Guid? clientRequestId = default(System.Guid?);
 76358            if (searchRequestOptions != null)
 359            {
 0360                clientRequestId = searchRequestOptions.ClientRequestId;
 361            }
 362            // Tracing
 76363            bool _shouldTrace = ServiceClientTracing.IsEnabled;
 76364            string _invocationId = null;
 76365            if (_shouldTrace)
 366            {
 0367                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
 0368                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
 0369                tracingParameters.Add("skillsetName", skillsetName);
 0370                tracingParameters.Add("clientRequestId", clientRequestId);
 0371                tracingParameters.Add("cancellationToken", cancellationToken);
 0372                ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters);
 373            }
 374            // Construct URL
 76375            var _baseUrl = Client.BaseUri;
 76376            var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "skillsets('{skillsetName}')";
 76377            _url = _url.Replace("{searchServiceName}", Client.SearchServiceName);
 76378            _url = _url.Replace("{searchDnsSuffix}", Client.SearchDnsSuffix);
 76379            _url = _url.Replace("{skillsetName}", System.Uri.EscapeDataString(skillsetName));
 76380            List<string> _queryParameters = new List<string>();
 76381            if (Client.ApiVersion != null)
 382            {
 76383                _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
 384            }
 76385            if (_queryParameters.Count > 0)
 386            {
 76387                _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
 388            }
 389            // Create HTTP transport objects
 76390            var _httpRequest = new HttpRequestMessage();
 76391            HttpResponseMessage _httpResponse = null;
 76392            _httpRequest.Method = new HttpMethod("DELETE");
 76393            _httpRequest.RequestUri = new System.Uri(_url);
 394            // Set Headers
 76395            if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
 396            {
 76397                _httpRequest.Headers.TryAddWithoutValidation("client-request-id", System.Guid.NewGuid().ToString());
 398            }
 76399            if (Client.AcceptLanguage != null)
 400            {
 76401                if (_httpRequest.Headers.Contains("accept-language"))
 402                {
 0403                    _httpRequest.Headers.Remove("accept-language");
 404                }
 76405                _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
 406            }
 76407            if (clientRequestId != null)
 408            {
 0409                if (_httpRequest.Headers.Contains("client-request-id"))
 410                {
 0411                    _httpRequest.Headers.Remove("client-request-id");
 412                }
 0413                _httpRequest.Headers.TryAddWithoutValidation("client-request-id", Rest.Serialization.SafeJsonConvert.Ser
 414            }
 415
 416
 76417            if (customHeaders != null)
 418            {
 0419                foreach(var _header in customHeaders)
 420                {
 0421                    if (_httpRequest.Headers.Contains(_header.Key))
 422                    {
 0423                        _httpRequest.Headers.Remove(_header.Key);
 424                    }
 0425                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
 426                }
 427            }
 428
 429            // Serialize Request
 76430            string _requestContent = null;
 431            // Set Credentials
 76432            if (Client.Credentials != null)
 433            {
 76434                cancellationToken.ThrowIfCancellationRequested();
 76435                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 436            }
 437            // Send Request
 76438            if (_shouldTrace)
 439            {
 0440                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
 441            }
 76442            cancellationToken.ThrowIfCancellationRequested();
 76443            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 76444            if (_shouldTrace)
 445            {
 0446                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
 447            }
 76448            HttpStatusCode _statusCode = _httpResponse.StatusCode;
 76449            cancellationToken.ThrowIfCancellationRequested();
 76450            string _responseContent = null;
 76451            if ((int)_statusCode != 204 && (int)_statusCode != 404)
 452            {
 0453                var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode
 454                try
 455                {
 0456                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 0457                    CloudError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<CloudError>(_responseC
 0458                    if (_errorBody != null)
 459                    {
 0460                        ex = new CloudException(_errorBody.Message);
 0461                        ex.Body = _errorBody;
 462                    }
 0463                }
 0464                catch (JsonException)
 465                {
 466                    // Ignore the exception
 0467                }
 0468                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
 0469                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
 0470                if (_httpResponse.Headers.Contains("request-id"))
 471                {
 0472                    ex.RequestId = _httpResponse.Headers.GetValues("request-id").FirstOrDefault();
 473                }
 0474                if (_shouldTrace)
 475                {
 0476                    ServiceClientTracing.Error(_invocationId, ex);
 477                }
 0478                _httpRequest.Dispose();
 0479                if (_httpResponse != null)
 480                {
 0481                    _httpResponse.Dispose();
 482                }
 0483                throw ex;
 484            }
 485            // Create Result
 76486            var _result = new AzureOperationResponse();
 76487            _result.Request = _httpRequest;
 76488            _result.Response = _httpResponse;
 76489            if (_httpResponse.Headers.Contains("request-id"))
 490            {
 76491                _result.RequestId = _httpResponse.Headers.GetValues("request-id").FirstOrDefault();
 492            }
 76493            if (_shouldTrace)
 494            {
 0495                ServiceClientTracing.Exit(_invocationId, _result);
 496            }
 76497            return _result;
 76498        }
 499
 500        /// <summary>
 501        /// Retrieves a skillset in a search service.
 502        /// <see href="https://docs.microsoft.com/rest/api/searchservice/get-skillset" />
 503        /// </summary>
 504        /// <param name='skillsetName'>
 505        /// The name of the skillset to retrieve.
 506        /// </param>
 507        /// <param name='searchRequestOptions'>
 508        /// Additional parameters for the operation
 509        /// </param>
 510        /// <param name='customHeaders'>
 511        /// Headers that will be added to request.
 512        /// </param>
 513        /// <param name='cancellationToken'>
 514        /// The cancellation token.
 515        /// </param>
 516        /// <exception cref="CloudException">
 517        /// Thrown when the operation returned an invalid status code
 518        /// </exception>
 519        /// <exception cref="SerializationException">
 520        /// Thrown when unable to deserialize the response
 521        /// </exception>
 522        /// <exception cref="ValidationException">
 523        /// Thrown when a required parameter is null
 524        /// </exception>
 525        /// <exception cref="System.ArgumentNullException">
 526        /// Thrown when a required parameter is null
 527        /// </exception>
 528        /// <return>
 529        /// A response object containing the response body and response headers.
 530        /// </return>
 531        public async Task<AzureOperationResponse<Skillset>> GetWithHttpMessagesAsync(string skillsetName, SearchRequestO
 532        {
 10533            if (Client.SearchServiceName == null)
 534            {
 0535                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SearchServiceName");
 536            }
 10537            if (Client.SearchDnsSuffix == null)
 538            {
 0539                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SearchDnsSuffix");
 540            }
 10541            if (skillsetName == null)
 542            {
 0543                throw new ValidationException(ValidationRules.CannotBeNull, "skillsetName");
 544            }
 10545            if (Client.ApiVersion == null)
 546            {
 0547                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
 548            }
 10549            System.Guid? clientRequestId = default(System.Guid?);
 10550            if (searchRequestOptions != null)
 551            {
 0552                clientRequestId = searchRequestOptions.ClientRequestId;
 553            }
 554            // Tracing
 10555            bool _shouldTrace = ServiceClientTracing.IsEnabled;
 10556            string _invocationId = null;
 10557            if (_shouldTrace)
 558            {
 0559                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
 0560                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
 0561                tracingParameters.Add("skillsetName", skillsetName);
 0562                tracingParameters.Add("clientRequestId", clientRequestId);
 0563                tracingParameters.Add("cancellationToken", cancellationToken);
 0564                ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
 565            }
 566            // Construct URL
 10567            var _baseUrl = Client.BaseUri;
 10568            var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "skillsets('{skillsetName}')";
 10569            _url = _url.Replace("{searchServiceName}", Client.SearchServiceName);
 10570            _url = _url.Replace("{searchDnsSuffix}", Client.SearchDnsSuffix);
 10571            _url = _url.Replace("{skillsetName}", System.Uri.EscapeDataString(skillsetName));
 10572            List<string> _queryParameters = new List<string>();
 10573            if (Client.ApiVersion != null)
 574            {
 10575                _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
 576            }
 10577            if (_queryParameters.Count > 0)
 578            {
 10579                _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
 580            }
 581            // Create HTTP transport objects
 10582            var _httpRequest = new HttpRequestMessage();
 10583            HttpResponseMessage _httpResponse = null;
 10584            _httpRequest.Method = new HttpMethod("GET");
 10585            _httpRequest.RequestUri = new System.Uri(_url);
 586            // Set Headers
 10587            if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
 588            {
 10589                _httpRequest.Headers.TryAddWithoutValidation("client-request-id", System.Guid.NewGuid().ToString());
 590            }
 10591            if (Client.AcceptLanguage != null)
 592            {
 10593                if (_httpRequest.Headers.Contains("accept-language"))
 594                {
 0595                    _httpRequest.Headers.Remove("accept-language");
 596                }
 10597                _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
 598            }
 10599            if (clientRequestId != null)
 600            {
 0601                if (_httpRequest.Headers.Contains("client-request-id"))
 602                {
 0603                    _httpRequest.Headers.Remove("client-request-id");
 604                }
 0605                _httpRequest.Headers.TryAddWithoutValidation("client-request-id", Rest.Serialization.SafeJsonConvert.Ser
 606            }
 607
 608
 10609            if (customHeaders != null)
 610            {
 0611                foreach(var _header in customHeaders)
 612                {
 0613                    if (_httpRequest.Headers.Contains(_header.Key))
 614                    {
 0615                        _httpRequest.Headers.Remove(_header.Key);
 616                    }
 0617                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
 618                }
 619            }
 620
 621            // Serialize Request
 10622            string _requestContent = null;
 623            // Set Credentials
 10624            if (Client.Credentials != null)
 625            {
 10626                cancellationToken.ThrowIfCancellationRequested();
 10627                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 628            }
 629            // Send Request
 10630            if (_shouldTrace)
 631            {
 0632                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
 633            }
 10634            cancellationToken.ThrowIfCancellationRequested();
 10635            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 10636            if (_shouldTrace)
 637            {
 0638                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
 639            }
 10640            HttpStatusCode _statusCode = _httpResponse.StatusCode;
 10641            cancellationToken.ThrowIfCancellationRequested();
 10642            string _responseContent = null;
 10643            if ((int)_statusCode != 200)
 644            {
 4645                var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode
 646                try
 647                {
 4648                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 4649                    CloudError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<CloudError>(_responseC
 4650                    if (_errorBody != null)
 651                    {
 4652                        ex = new CloudException(_errorBody.Message);
 4653                        ex.Body = _errorBody;
 654                    }
 4655                }
 0656                catch (JsonException)
 657                {
 658                    // Ignore the exception
 0659                }
 4660                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
 4661                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
 4662                if (_httpResponse.Headers.Contains("request-id"))
 663                {
 4664                    ex.RequestId = _httpResponse.Headers.GetValues("request-id").FirstOrDefault();
 665                }
 4666                if (_shouldTrace)
 667                {
 0668                    ServiceClientTracing.Error(_invocationId, ex);
 669                }
 4670                _httpRequest.Dispose();
 4671                if (_httpResponse != null)
 672                {
 4673                    _httpResponse.Dispose();
 674                }
 4675                throw ex;
 676            }
 677            // Create Result
 6678            var _result = new AzureOperationResponse<Skillset>();
 6679            _result.Request = _httpRequest;
 6680            _result.Response = _httpResponse;
 6681            if (_httpResponse.Headers.Contains("request-id"))
 682            {
 6683                _result.RequestId = _httpResponse.Headers.GetValues("request-id").FirstOrDefault();
 684            }
 685            // Deserialize Response
 6686            if ((int)_statusCode == 200)
 687            {
 6688                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 689                try
 690                {
 6691                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Skillset>(_responseContent, Clie
 6692                }
 0693                catch (JsonException ex)
 694                {
 0695                    _httpRequest.Dispose();
 0696                    if (_httpResponse != null)
 697                    {
 0698                        _httpResponse.Dispose();
 699                    }
 0700                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
 701                }
 702            }
 6703            if (_shouldTrace)
 704            {
 0705                ServiceClientTracing.Exit(_invocationId, _result);
 706            }
 6707            return _result;
 6708        }
 709
 710        /// <summary>
 711        /// List all skillsets in a search service.
 712        /// <see href="https://docs.microsoft.com/rest/api/searchservice/list-skillset" />
 713        /// </summary>
 714        /// <param name='searchRequestOptions'>
 715        /// Additional parameters for the operation
 716        /// </param>
 717        /// <param name='customHeaders'>
 718        /// Headers that will be added to request.
 719        /// </param>
 720        /// <param name='cancellationToken'>
 721        /// The cancellation token.
 722        /// </param>
 723        /// <exception cref="CloudException">
 724        /// Thrown when the operation returned an invalid status code
 725        /// </exception>
 726        /// <exception cref="SerializationException">
 727        /// Thrown when unable to deserialize the response
 728        /// </exception>
 729        /// <exception cref="ValidationException">
 730        /// Thrown when a required parameter is null
 731        /// </exception>
 732        /// <exception cref="System.ArgumentNullException">
 733        /// Thrown when a required parameter is null
 734        /// </exception>
 735        /// <return>
 736        /// A response object containing the response body and response headers.
 737        /// </return>
 738        public async Task<AzureOperationResponse<SkillsetListResult>> ListWithHttpMessagesAsync(SearchRequestOptions sea
 739        {
 0740            if (Client.SearchServiceName == null)
 741            {
 0742                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SearchServiceName");
 743            }
 0744            if (Client.SearchDnsSuffix == null)
 745            {
 0746                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SearchDnsSuffix");
 747            }
 0748            if (Client.ApiVersion == null)
 749            {
 0750                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
 751            }
 0752            System.Guid? clientRequestId = default(System.Guid?);
 0753            if (searchRequestOptions != null)
 754            {
 0755                clientRequestId = searchRequestOptions.ClientRequestId;
 756            }
 757            // Tracing
 0758            bool _shouldTrace = ServiceClientTracing.IsEnabled;
 0759            string _invocationId = null;
 0760            if (_shouldTrace)
 761            {
 0762                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
 0763                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
 0764                tracingParameters.Add("clientRequestId", clientRequestId);
 0765                tracingParameters.Add("cancellationToken", cancellationToken);
 0766                ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
 767            }
 768            // Construct URL
 0769            var _baseUrl = Client.BaseUri;
 0770            var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "skillsets";
 0771            _url = _url.Replace("{searchServiceName}", Client.SearchServiceName);
 0772            _url = _url.Replace("{searchDnsSuffix}", Client.SearchDnsSuffix);
 0773            List<string> _queryParameters = new List<string>();
 0774            if (Client.ApiVersion != null)
 775            {
 0776                _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
 777            }
 0778            if (_queryParameters.Count > 0)
 779            {
 0780                _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
 781            }
 782            // Create HTTP transport objects
 0783            var _httpRequest = new HttpRequestMessage();
 0784            HttpResponseMessage _httpResponse = null;
 0785            _httpRequest.Method = new HttpMethod("GET");
 0786            _httpRequest.RequestUri = new System.Uri(_url);
 787            // Set Headers
 0788            if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
 789            {
 0790                _httpRequest.Headers.TryAddWithoutValidation("client-request-id", System.Guid.NewGuid().ToString());
 791            }
 0792            if (Client.AcceptLanguage != null)
 793            {
 0794                if (_httpRequest.Headers.Contains("accept-language"))
 795                {
 0796                    _httpRequest.Headers.Remove("accept-language");
 797                }
 0798                _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
 799            }
 0800            if (clientRequestId != null)
 801            {
 0802                if (_httpRequest.Headers.Contains("client-request-id"))
 803                {
 0804                    _httpRequest.Headers.Remove("client-request-id");
 805                }
 0806                _httpRequest.Headers.TryAddWithoutValidation("client-request-id", Rest.Serialization.SafeJsonConvert.Ser
 807            }
 808
 809
 0810            if (customHeaders != null)
 811            {
 0812                foreach(var _header in customHeaders)
 813                {
 0814                    if (_httpRequest.Headers.Contains(_header.Key))
 815                    {
 0816                        _httpRequest.Headers.Remove(_header.Key);
 817                    }
 0818                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
 819                }
 820            }
 821
 822            // Serialize Request
 0823            string _requestContent = null;
 824            // Set Credentials
 0825            if (Client.Credentials != null)
 826            {
 0827                cancellationToken.ThrowIfCancellationRequested();
 0828                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 829            }
 830            // Send Request
 0831            if (_shouldTrace)
 832            {
 0833                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
 834            }
 0835            cancellationToken.ThrowIfCancellationRequested();
 0836            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 0837            if (_shouldTrace)
 838            {
 0839                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
 840            }
 0841            HttpStatusCode _statusCode = _httpResponse.StatusCode;
 0842            cancellationToken.ThrowIfCancellationRequested();
 0843            string _responseContent = null;
 0844            if ((int)_statusCode != 200)
 845            {
 0846                var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode
 847                try
 848                {
 0849                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 0850                    CloudError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<CloudError>(_responseC
 0851                    if (_errorBody != null)
 852                    {
 0853                        ex = new CloudException(_errorBody.Message);
 0854                        ex.Body = _errorBody;
 855                    }
 0856                }
 0857                catch (JsonException)
 858                {
 859                    // Ignore the exception
 0860                }
 0861                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
 0862                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
 0863                if (_httpResponse.Headers.Contains("request-id"))
 864                {
 0865                    ex.RequestId = _httpResponse.Headers.GetValues("request-id").FirstOrDefault();
 866                }
 0867                if (_shouldTrace)
 868                {
 0869                    ServiceClientTracing.Error(_invocationId, ex);
 870                }
 0871                _httpRequest.Dispose();
 0872                if (_httpResponse != null)
 873                {
 0874                    _httpResponse.Dispose();
 875                }
 0876                throw ex;
 877            }
 878            // Create Result
 0879            var _result = new AzureOperationResponse<SkillsetListResult>();
 0880            _result.Request = _httpRequest;
 0881            _result.Response = _httpResponse;
 0882            if (_httpResponse.Headers.Contains("request-id"))
 883            {
 0884                _result.RequestId = _httpResponse.Headers.GetValues("request-id").FirstOrDefault();
 885            }
 886            // Deserialize Response
 0887            if ((int)_statusCode == 200)
 888            {
 0889                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 890                try
 891                {
 0892                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<SkillsetListResult>(_responseCon
 0893                }
 0894                catch (JsonException ex)
 895                {
 0896                    _httpRequest.Dispose();
 0897                    if (_httpResponse != null)
 898                    {
 0899                        _httpResponse.Dispose();
 900                    }
 0901                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
 902                }
 903            }
 0904            if (_shouldTrace)
 905            {
 0906                ServiceClientTracing.Exit(_invocationId, _result);
 907            }
 0908            return _result;
 0909        }
 910
 911        /// <summary>
 912        /// Creates a new skillset in a search service.
 913        /// <see href="https://docs.microsoft.com/rest/api/searchservice/create-skillset" />
 914        /// </summary>
 915        /// <param name='skillset'>
 916        /// The skillset containing one or more skills to create in a search service.
 917        /// </param>
 918        /// <param name='searchRequestOptions'>
 919        /// Additional parameters for the operation
 920        /// </param>
 921        /// <param name='customHeaders'>
 922        /// Headers that will be added to request.
 923        /// </param>
 924        /// <param name='cancellationToken'>
 925        /// The cancellation token.
 926        /// </param>
 927        /// <exception cref="CloudException">
 928        /// Thrown when the operation returned an invalid status code
 929        /// </exception>
 930        /// <exception cref="SerializationException">
 931        /// Thrown when unable to deserialize the response
 932        /// </exception>
 933        /// <exception cref="ValidationException">
 934        /// Thrown when a required parameter is null
 935        /// </exception>
 936        /// <exception cref="System.ArgumentNullException">
 937        /// Thrown when a required parameter is null
 938        /// </exception>
 939        /// <return>
 940        /// A response object containing the response body and response headers.
 941        /// </return>
 942        public async Task<AzureOperationResponse<Skillset>> CreateWithHttpMessagesAsync(Skillset skillset, SearchRequest
 943        {
 72944            if (Client.SearchServiceName == null)
 945            {
 0946                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SearchServiceName");
 947            }
 72948            if (Client.SearchDnsSuffix == null)
 949            {
 0950                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SearchDnsSuffix");
 951            }
 72952            if (skillset == null)
 953            {
 0954                throw new ValidationException(ValidationRules.CannotBeNull, "skillset");
 955            }
 72956            if (skillset != null)
 957            {
 72958                skillset.Validate();
 959            }
 72960            if (Client.ApiVersion == null)
 961            {
 0962                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
 963            }
 72964            System.Guid? clientRequestId = default(System.Guid?);
 72965            if (searchRequestOptions != null)
 966            {
 0967                clientRequestId = searchRequestOptions.ClientRequestId;
 968            }
 969            // Tracing
 72970            bool _shouldTrace = ServiceClientTracing.IsEnabled;
 72971            string _invocationId = null;
 72972            if (_shouldTrace)
 973            {
 0974                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
 0975                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
 0976                tracingParameters.Add("skillset", skillset);
 0977                tracingParameters.Add("clientRequestId", clientRequestId);
 0978                tracingParameters.Add("cancellationToken", cancellationToken);
 0979                ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters);
 980            }
 981            // Construct URL
 72982            var _baseUrl = Client.BaseUri;
 72983            var _url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "skillsets";
 72984            _url = _url.Replace("{searchServiceName}", Client.SearchServiceName);
 72985            _url = _url.Replace("{searchDnsSuffix}", Client.SearchDnsSuffix);
 72986            List<string> _queryParameters = new List<string>();
 72987            if (Client.ApiVersion != null)
 988            {
 72989                _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
 990            }
 72991            if (_queryParameters.Count > 0)
 992            {
 72993                _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
 994            }
 995            // Create HTTP transport objects
 72996            var _httpRequest = new HttpRequestMessage();
 72997            HttpResponseMessage _httpResponse = null;
 72998            _httpRequest.Method = new HttpMethod("POST");
 72999            _httpRequest.RequestUri = new System.Uri(_url);
 1000            // Set Headers
 721001            if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
 1002            {
 721003                _httpRequest.Headers.TryAddWithoutValidation("client-request-id", System.Guid.NewGuid().ToString());
 1004            }
 721005            if (Client.AcceptLanguage != null)
 1006            {
 721007                if (_httpRequest.Headers.Contains("accept-language"))
 1008                {
 01009                    _httpRequest.Headers.Remove("accept-language");
 1010                }
 721011                _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
 1012            }
 721013            if (clientRequestId != null)
 1014            {
 01015                if (_httpRequest.Headers.Contains("client-request-id"))
 1016                {
 01017                    _httpRequest.Headers.Remove("client-request-id");
 1018                }
 01019                _httpRequest.Headers.TryAddWithoutValidation("client-request-id", Rest.Serialization.SafeJsonConvert.Ser
 1020            }
 1021
 1022
 721023            if (customHeaders != null)
 1024            {
 01025                foreach(var _header in customHeaders)
 1026                {
 01027                    if (_httpRequest.Headers.Contains(_header.Key))
 1028                    {
 01029                        _httpRequest.Headers.Remove(_header.Key);
 1030                    }
 01031                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
 1032                }
 1033            }
 1034
 1035            // Serialize Request
 721036            string _requestContent = null;
 721037            if(skillset != null)
 1038            {
 721039                _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(skillset, Client.SerializationSetti
 721040                _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
 721041                _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("applicatio
 1042            }
 1043            // Set Credentials
 721044            if (Client.Credentials != null)
 1045            {
 721046                cancellationToken.ThrowIfCancellationRequested();
 721047                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 1048            }
 1049            // Send Request
 721050            if (_shouldTrace)
 1051            {
 01052                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
 1053            }
 721054            cancellationToken.ThrowIfCancellationRequested();
 721055            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
 721056            if (_shouldTrace)
 1057            {
 01058                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
 1059            }
 721060            HttpStatusCode _statusCode = _httpResponse.StatusCode;
 721061            cancellationToken.ThrowIfCancellationRequested();
 721062            string _responseContent = null;
 721063            if ((int)_statusCode != 201)
 1064            {
 01065                var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode
 1066                try
 1067                {
 01068                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 01069                    CloudError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<CloudError>(_responseC
 01070                    if (_errorBody != null)
 1071                    {
 01072                        ex = new CloudException(_errorBody.Message);
 01073                        ex.Body = _errorBody;
 1074                    }
 01075                }
 01076                catch (JsonException)
 1077                {
 1078                    // Ignore the exception
 01079                }
 01080                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
 01081                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
 01082                if (_httpResponse.Headers.Contains("request-id"))
 1083                {
 01084                    ex.RequestId = _httpResponse.Headers.GetValues("request-id").FirstOrDefault();
 1085                }
 01086                if (_shouldTrace)
 1087                {
 01088                    ServiceClientTracing.Error(_invocationId, ex);
 1089                }
 01090                _httpRequest.Dispose();
 01091                if (_httpResponse != null)
 1092                {
 01093                    _httpResponse.Dispose();
 1094                }
 01095                throw ex;
 1096            }
 1097            // Create Result
 721098            var _result = new AzureOperationResponse<Skillset>();
 721099            _result.Request = _httpRequest;
 721100            _result.Response = _httpResponse;
 721101            if (_httpResponse.Headers.Contains("request-id"))
 1102            {
 721103                _result.RequestId = _httpResponse.Headers.GetValues("request-id").FirstOrDefault();
 1104            }
 1105            // Deserialize Response
 721106            if ((int)_statusCode == 201)
 1107            {
 721108                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
 1109                try
 1110                {
 721111                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Skillset>(_responseContent, Clie
 721112                }
 01113                catch (JsonException ex)
 1114                {
 01115                    _httpRequest.Dispose();
 01116                    if (_httpResponse != null)
 1117                    {
 01118                        _httpResponse.Dispose();
 1119                    }
 01120                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
 1121                }
 1122            }
 721123            if (_shouldTrace)
 1124            {
 01125                ServiceClientTracing.Exit(_invocationId, _result);
 1126            }
 721127            return _result;
 721128        }
 1129
 1130    }
 1131}