/// <summary> /// x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required /// message header for all requests. Long running put request, service /// returns a 200 to the initial request, with an entity that contains /// ProvisioningState=’Creating’. Poll the endpoint indicated in the /// Azure-AsyncOperation header for operation status /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='product'> /// Product to put /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async System.Threading.Tasks.Task<ProductInner> PutAsyncRetrySucceededAsync(this ILROsCustomHeaderOperations operations, ProductInner product = default(ProductInner), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { using (var _result = await operations.PutAsyncRetrySucceededWithHttpMessagesAsync(product, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } }
/// <summary> /// Long running put request, service returns a 400 to the initial request /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='product'> /// Product to put /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async System.Threading.Tasks.Task<ProductInner> BeginPutNonRetry400Async(this ILROSADsOperations operations, ProductInner product = default(ProductInner), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { using (var _result = await operations.BeginPutNonRetry400WithHttpMessagesAsync(product, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } }
/// <summary> /// Long running put request, service returns a Product with /// 'ProvisioningState' = 'Creating' and 201 response code /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='product'> /// Product to put /// </param> public static ProductInner PutNonRetry201Creating400(this ILROSADsOperations operations, ProductInner product = default(ProductInner)) { return System.Threading.Tasks.Task.Factory.StartNew(s => ((ILROSADsOperations)s).PutNonRetry201Creating400Async(product), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
/// <summary> /// Long running put request, service returns a 201 to the initial request /// with no payload /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='product'> /// Product to put /// </param> public static ProductInner BeginPutError201NoProvisioningStatePayload(this ILROSADsOperations operations, ProductInner product = default(ProductInner)) { return System.Threading.Tasks.Task.Factory.StartNew(s => ((ILROSADsOperations)s).BeginPutError201NoProvisioningStatePayloadAsync(product), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
/// <summary> /// Long running post request, service returns a 202 to the initial request /// Poll the endpoint indicated in the Azure-AsyncOperation header for /// operation status /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='product'> /// Product to put /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async System.Threading.Tasks.Task<LROSADsPostAsyncRelativeRetry400HeadersInner> PostAsyncRelativeRetry400Async(this ILROSADsOperations operations, ProductInner product = default(ProductInner), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { using (var _result = await operations.PostAsyncRelativeRetry400WithHttpMessagesAsync(product, null, cancellationToken).ConfigureAwait(false)) { return _result.Headers; } }
/// <summary> /// Long running put request, service returns a 200 to the initial request, /// with an entity that contains ProvisioningState=’Creating’. Poll the /// endpoint indicated in the Azure-AsyncOperation header for operation status /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='product'> /// Product to put /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async System.Threading.Tasks.Task<ProductInner> PutAsyncRelativeRetryInvalidJsonPollingAsync(this ILROSADsOperations operations, ProductInner product = default(ProductInner), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { using (var _result = await operations.PutAsyncRelativeRetryInvalidJsonPollingWithHttpMessagesAsync(product, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } }
/// <summary> /// x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required /// message header for all requests. Long running post request, service returns /// a 202 to the initial request, with 'Location' and 'Retry-After' headers, /// Polls return a 200 with a response body after success /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='product'> /// Product to put /// </param> public static LROsCustomHeaderPost202Retry200HeadersInner BeginPost202Retry200(this ILROsCustomHeaderOperations operations, ProductInner product = default(ProductInner)) { return(operations.BeginPost202Retry200Async(product).GetAwaiter().GetResult()); }
/// <summary> /// x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required /// message header for all requests. Long running put request, service returns /// a 201 to the initial request, with an entity that contains /// ProvisioningState=’Creating’. Polls return this value until the last poll /// returns a ‘200’ with ProvisioningState=’Succeeded’ /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='product'> /// Product to put /// </param> public static ProductInner BeginPut201CreatingSucceeded200(this ILROsCustomHeaderOperations operations, ProductInner product = default(ProductInner)) { return(operations.BeginPut201CreatingSucceeded200Async(product).GetAwaiter().GetResult()); }
/// <summary> /// Long running put request, service returns a 500, then a 200 to the initial /// request, with an entity that contains ProvisioningState=’Creating’. Poll /// the endpoint indicated in the Azure-AsyncOperation header for operation /// status /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='product'> /// Product to put /// </param> public static ProductInner PutAsyncRelativeRetrySucceeded(this ILRORetrysOperations operations, ProductInner product = default(ProductInner)) { return(operations.PutAsyncRelativeRetrySucceededAsync(product).GetAwaiter().GetResult()); }
/// <summary> /// Long running post request, service returns a 500, then a 202 to the initial /// request, with an entity that contains ProvisioningState=’Creating’. Poll /// the endpoint indicated in the Azure-AsyncOperation header for operation /// status /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='product'> /// Product to put /// </param> public static LRORetrysPostAsyncRelativeRetrySucceededHeadersInner BeginPostAsyncRelativeRetrySucceeded(this ILRORetrysOperations operations, ProductInner product = default(ProductInner)) { return(operations.BeginPostAsyncRelativeRetrySucceededAsync(product).GetAwaiter().GetResult()); }
/// <summary> /// Long running post request, service returns a 500, then a 202 to the initial /// request, with 'Location' and 'Retry-After' headers, Polls return a 200 with /// a response body after success /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='product'> /// Product to put /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <LRORetrysPost202Retry200HeadersInner> BeginPost202Retry200Async(this ILRORetrysOperations operations, ProductInner product = default(ProductInner), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BeginPost202Retry200WithHttpMessagesAsync(product, null, cancellationToken).ConfigureAwait(false)) { return(_result.Headers); } }
/// <summary> /// Long running put request, service returns a 500, then a 201 to the initial /// request, with an entity that contains ProvisioningState=’Creating’. Polls /// return this value until the last poll returns a ‘200’ with /// ProvisioningState=’Succeeded’ /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='product'> /// Product to put /// </param> public static ProductInner Put201CreatingSucceeded200(this ILRORetrysOperations operations, ProductInner product = default(ProductInner)) { return(operations.Put201CreatingSucceeded200Async(product).GetAwaiter().GetResult()); }
/// <summary> /// Long running put request, service returns a 500, then a 201 to the initial /// request, with an entity that contains ProvisioningState=’Creating’. /// Polls return this value until the last poll returns a ‘200’ with /// ProvisioningState=’Succeeded’ /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='product'> /// Product to put /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async System.Threading.Tasks.Task <ProductInner> Put201CreatingSucceeded200Async(this ILRORetrysOperations operations, ProductInner product = default(ProductInner), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { using (var _result = await operations.Put201CreatingSucceeded200WithHttpMessagesAsync(product, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Long running post request, service returns a 500, then a 202 to the /// initial request, with an entity that contains /// ProvisioningState=’Creating’. Poll the endpoint indicated in the /// Azure-AsyncOperation header for operation status /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='product'> /// Product to put /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async System.Threading.Tasks.Task <LRORetrysPostAsyncRelativeRetrySucceededHeadersInner> PostAsyncRelativeRetrySucceededAsync(this ILRORetrysOperations operations, ProductInner product = default(ProductInner), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { using (var _result = await operations.PostAsyncRelativeRetrySucceededWithHttpMessagesAsync(product, null, cancellationToken).ConfigureAwait(false)) { return(_result.Headers); } }
/// <summary> /// Long running post request, service returns a 500, then a 202 to the /// initial request, with 'Location' and 'Retry-After' headers, Polls return /// a 200 with a response body after success /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='product'> /// Product to put /// </param> public static LRORetrysPost202Retry200HeadersInner BeginPost202Retry200(this ILRORetrysOperations operations, ProductInner product = default(ProductInner)) { return(System.Threading.Tasks.Task.Factory.StartNew(s => ((ILRORetrysOperations)s).BeginPost202Retry200Async(product), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
/// <summary> /// x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required /// message header for all requests. Long running post request, service /// returns a 202 to the initial request, with an entity that contains /// ProvisioningState=’Creating’. Poll the endpoint indicated in the /// Azure-AsyncOperation header for operation status /// </summary> /// <param name='product'> /// Product to put /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public async System.Threading.Tasks.Task <Microsoft.Rest.Azure.AzureOperationHeaderResponse <LROsCustomHeaderPostAsyncRetrySucceededHeadersInner> > PostAsyncRetrySucceededWithHttpMessagesAsync(ProductInner product = default(ProductInner), System.Collections.Generic.Dictionary <string, System.Collections.Generic.List <string> > customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { // Send request Microsoft.Rest.Azure.AzureOperationHeaderResponse <LROsCustomHeaderPostAsyncRetrySucceededHeadersInner> _response = await BeginPostAsyncRetrySucceededWithHttpMessagesAsync( product, customHeaders, cancellationToken); return(await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken)); }
/// <summary> /// x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required /// message header for all requests. Long running post request, service returns /// a 202 to the initial request, with an entity that contains /// ProvisioningState=’Creating’. Poll the endpoint indicated in the /// Azure-AsyncOperation header for operation status /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='product'> /// Product to put /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <LROsCustomHeaderPostAsyncRetrySucceededHeadersInner> PostAsyncRetrySucceededAsync(this ILROsCustomHeaderOperations operations, ProductInner product = default(ProductInner), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.PostAsyncRetrySucceededWithHttpMessagesAsync(product, null, cancellationToken).ConfigureAwait(false)) { return(_result.Headers); } }
/// <summary> /// Long running put request, service returns a 500, then a 200 to the initial /// request, with an entity that contains ProvisioningState=’Creating’. Poll /// the endpoint indicated in the Azure-AsyncOperation header for operation /// status /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='product'> /// Product to put /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <ProductInner> PutAsyncRelativeRetrySucceededAsync(this ILRORetrysOperations operations, ProductInner product = default(ProductInner), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.PutAsyncRelativeRetrySucceededWithHttpMessagesAsync(product, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required /// message header for all requests. Long running put request, service returns /// a 201 to the initial request, with an entity that contains /// ProvisioningState=’Creating’. Polls return this value until the last poll /// returns a ‘200’ with ProvisioningState=’Succeeded’ /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='product'> /// Product to put /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <ProductInner> BeginPut201CreatingSucceeded200Async(this ILROsCustomHeaderOperations operations, ProductInner product = default(ProductInner), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BeginPut201CreatingSucceeded200WithHttpMessagesAsync(product, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required /// message header for all requests. Long running post request, service /// returns a 202 to the initial request, with 'Location' and 'Retry-After' /// headers, Polls return a 200 with a response body after success /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='product'> /// Product to put /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async System.Threading.Tasks.Task <LROsCustomHeaderPost202Retry200HeadersInner> Post202Retry200Async(this ILROsCustomHeaderOperations operations, ProductInner product = default(ProductInner), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { using (var _result = await operations.Post202Retry200WithHttpMessagesAsync(product, null, cancellationToken).ConfigureAwait(false)) { return(_result.Headers); } }
/// <summary> /// Long running post request, service returns a 202 to the initial request, /// without a location header. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='product'> /// Product to put /// </param> public static LROSADsPost202NoLocationHeadersInner Post202NoLocation(this ILROSADsOperations operations, ProductInner product = default(ProductInner)) { return System.Threading.Tasks.Task.Factory.StartNew(s => ((ILROSADsOperations)s).Post202NoLocationAsync(product), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
/// <summary> /// x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required /// message header for all requests. Long running put request, service /// returns a 200 to the initial request, with an entity that contains /// ProvisioningState=’Creating’. Poll the endpoint indicated in the /// Azure-AsyncOperation header for operation status /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='product'> /// Product to put /// </param> public static ProductInner BeginPutAsyncRetrySucceeded(this ILROsCustomHeaderOperations operations, ProductInner product = default(ProductInner)) { return(System.Threading.Tasks.Task.Factory.StartNew(s => ((ILROsCustomHeaderOperations)s).BeginPutAsyncRetrySucceededAsync(product), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
/// <summary> /// Long running post request, service returns a 202 to the initial request, /// with an entity that contains ProvisioningState=’Creating’. Poll the /// endpoint indicated in the Azure-AsyncOperation header for operation status /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='product'> /// Product to put /// </param> public static LROSADsPostAsyncRelativeRetryInvalidJsonPollingHeadersInner BeginPostAsyncRelativeRetryInvalidJsonPolling(this ILROSADsOperations operations, ProductInner product = default(ProductInner)) { return System.Threading.Tasks.Task.Factory.StartNew(s => ((ILROSADsOperations)s).BeginPostAsyncRelativeRetryInvalidJsonPollingAsync(product), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
/// <summary> /// x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required /// message header for all requests. Long running put request, service /// returns a 200 to the initial request, with an entity that contains /// ProvisioningState=’Creating’. Poll the endpoint indicated in the /// Azure-AsyncOperation header for operation status /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='product'> /// Product to put /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async System.Threading.Tasks.Task <ProductInner> BeginPutAsyncRetrySucceededAsync(this ILROsCustomHeaderOperations operations, ProductInner product = default(ProductInner), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { using (var _result = await operations.BeginPutAsyncRetrySucceededWithHttpMessagesAsync(product, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Long running put request, service returns a 201 to the initial request /// with no payload /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='product'> /// Product to put /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async System.Threading.Tasks.Task<ProductInner> PutError201NoProvisioningStatePayloadAsync(this ILROSADsOperations operations, ProductInner product = default(ProductInner), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { using (var _result = await operations.PutError201NoProvisioningStatePayloadWithHttpMessagesAsync(product, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } }
/// <summary> /// x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required /// message header for all requests. Long running post request, service returns /// a 202 to the initial request, with an entity that contains /// ProvisioningState=’Creating’. Poll the endpoint indicated in the /// Azure-AsyncOperation header for operation status /// </summary> /// <param name='product'> /// Product to put /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public async Task <AzureOperationHeaderResponse <LROsCustomHeaderPostAsyncRetrySucceededHeadersInner> > PostAsyncRetrySucceededWithHttpMessagesAsync(ProductInner product = default(ProductInner), Dictionary <string, List <string> > customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request AzureOperationHeaderResponse <LROsCustomHeaderPostAsyncRetrySucceededHeadersInner> _response = await BeginPostAsyncRetrySucceededWithHttpMessagesAsync(product, customHeaders, cancellationToken).ConfigureAwait(false); return(await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false)); }
/// <summary> /// x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required /// message header for all requests. Long running post request, service returns /// a 202 to the initial request, with an entity that contains /// ProvisioningState=’Creating’. Poll the endpoint indicated in the /// Azure-AsyncOperation header for operation status /// </summary> /// <param name='product'> /// Product to put /// </param> /// <param name='customHeaders'> /// Headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="CloudException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <return> /// A response object containing the response body and response headers. /// </return> public async Task <AzureOperationHeaderResponse <LROsCustomHeaderPostAsyncRetrySucceededHeadersInner> > BeginPostAsyncRetrySucceededWithHttpMessagesAsync(ProductInner product = default(ProductInner), Dictionary <string, List <string> > customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary <string, object> tracingParameters = new Dictionary <string, object>(); tracingParameters.Add("product", product); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginPostAsyncRetrySucceeded", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "lro/customheader/postasync/retry/succeeded").ToString(); List <string> _queryParameters = new List <string>(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new System.Net.Http.HttpRequestMessage(); System.Net.Http.HttpResponseMessage _httpResponse = null; _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } if (Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); } if (customHeaders != null) { foreach (var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if (product != null) { _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(product, Client.SerializationSettings); _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); } // Set Credentials if (Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 202) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject <CloudError>(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } catch (Newtonsoft.Json.JsonException) { // Ignore the exception } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_httpResponse.Headers.Contains("x-ms-request-id")) { ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new AzureOperationHeaderResponse <LROsCustomHeaderPostAsyncRetrySucceededHeadersInner>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } try { _result.Headers = _httpResponse.GetHeadersAsJson().ToObject <LROsCustomHeaderPostAsyncRetrySucceededHeadersInner>(Newtonsoft.Json.JsonSerializer.Create(Client.DeserializationSettings)); } catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return(_result); }
/// <summary> /// x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required /// message header for all requests. Long running put request, service returns /// a 201 to the initial request, with an entity that contains /// ProvisioningState=’Creating’. Polls return this value until the last poll /// returns a ‘200’ with ProvisioningState=’Succeeded’ /// </summary> /// <param name='product'> /// Product to put /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public async Task <AzureOperationResponse <ProductInner> > Put201CreatingSucceeded200WithHttpMessagesAsync(ProductInner product = default(ProductInner), Dictionary <string, List <string> > customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request AzureOperationResponse <ProductInner> _response = await BeginPut201CreatingSucceeded200WithHttpMessagesAsync(product, customHeaders, cancellationToken).ConfigureAwait(false); return(await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false)); }
/// <summary> /// x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required /// message header for all requests. Long running post request, service /// returns a 202 to the initial request, with 'Location' and 'Retry-After' /// headers, Polls return a 200 with a response body after success /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='product'> /// Product to put /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async System.Threading.Tasks.Task<LROsCustomHeaderPost202Retry200HeadersInner> BeginPost202Retry200Async(this ILROsCustomHeaderOperations operations, ProductInner product = default(ProductInner), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { using (var _result = await operations.BeginPost202Retry200WithHttpMessagesAsync(product, null, cancellationToken).ConfigureAwait(false)) { return _result.Headers; } }
/// <summary> /// x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required /// message header for all requests. Long running post request, service returns /// a 202 to the initial request, with an entity that contains /// ProvisioningState=’Creating’. Poll the endpoint indicated in the /// Azure-AsyncOperation header for operation status /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='product'> /// Product to put /// </param> public static LROsCustomHeaderPostAsyncRetrySucceededHeadersInner PostAsyncRetrySucceeded(this ILROsCustomHeaderOperations operations, ProductInner product = default(ProductInner)) { return(operations.PostAsyncRetrySucceededAsync(product).GetAwaiter().GetResult()); }
/// <summary> /// x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required /// message header for all requests. Long running put request, service /// returns a 200 to the initial request, with an entity that contains /// ProvisioningState=’Creating’. Poll the endpoint indicated in the /// Azure-AsyncOperation header for operation status /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='product'> /// Product to put /// </param> public static ProductInner BeginPutAsyncRetrySucceeded(this ILROsCustomHeaderOperations operations, ProductInner product = default(ProductInner)) { return System.Threading.Tasks.Task.Factory.StartNew(s => ((ILROsCustomHeaderOperations)s).BeginPutAsyncRetrySucceededAsync(product), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
/// <summary> /// x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required /// message header for all requests. Long running put request, service /// returns a 201 to the initial request, with an entity that contains /// ProvisioningState=’Creating’. Polls return this value until the last /// poll returns a ‘200’ with ProvisioningState=’Succeeded’ /// </summary> /// <param name='product'> /// Product to put /// </param> /// <param name='customHeaders'> /// The headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public async System.Threading.Tasks.Task <Microsoft.Rest.Azure.AzureOperationResponse <ProductInner> > Put201CreatingSucceeded200WithHttpMessagesAsync(ProductInner product = default(ProductInner), System.Collections.Generic.Dictionary <string, System.Collections.Generic.List <string> > customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { // Send Request Microsoft.Rest.Azure.AzureOperationResponse <ProductInner> _response = await BeginPut201CreatingSucceeded200WithHttpMessagesAsync( product, customHeaders, cancellationToken); return(await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken)); }