text:
namespace Microsoft.Azure.Management.KubernetesConfiguration
{
    using Microsoft.Rest;
    using Microsoft.Rest.Azure;
    using Models;
    using Newtonsoft.Json;
    using System.Collections;
    using System.Collections.Generic;
    using System.Linq;
    using System.Net;
    using System.Net.Http;
    using System.Threading;
    using System.Threading.Tasks;

    /// <summary>
    /// FluxConfigurationsOperations operations.
    /// </summary>
    internal partial class FluxConfigurationsOperations : IServiceOperations<SourceControlConfigurationClient>, IFluxConfigurationsOperations
    {
        /// <summary>
        /// Initializes a new instance of the FluxConfigurationsOperations class.
        /// </summary>
        /// <param name='client'>
        /// Reference to the service client.
        /// </param>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when a required parameter is null
        /// </exception>
        internal FluxConfigurationsOperations(SourceControlConfigurationClient client)
        {
            if (client == null)
            {
                throw new System.ArgumentNullException("client");
            }
            Client = client;
        }

        /// <summary>
        /// Gets a reference to the SourceControlConfigurationClient
        /// </summary>
        public SourceControlConfigurationClient Client { get; private set; }

        /// <summary>
        /// Gets details of the Flux Configuration.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group. The name is case insensitive.
        /// </param>
        /// <param name='clusterRp'>
        /// The Kubernetes cluster RP - i.e. Microsoft.ContainerService,
        /// Microsoft.Kubernetes, Microsoft.HybridContainerService.
        /// </param>
        /// <param name='clusterResourceName'>
        /// The Kubernetes cluster resource name - i.e. managedClusters,
        /// connectedClusters, provisionedClusters.
        /// </param>
        /// <param name='clusterName'>
        /// The name of the kubernetes cluster.
        /// </param>
        /// <param name='fluxConfigurationName'>
        /// Name of the Flux Configuration.
        /// </param>
        /// <param name='customHeaders'>
        /// Headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="ErrorResponseException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <return>
        /// A response object containing the response body and response headers.
        /// </return>
        public async Task<AzureOperationResponse<FluxConfiguration>> GetWithHttpMessagesAsync(string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, string fluxConfigurationName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (Client.SubscriptionId == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
            }
            if (resourceGroupName == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
            }
            if (clusterRp == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "clusterRp");
            }
            if (clusterResourceName == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "clusterResourceName");
            }
            if (clusterName == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "clusterName");
            }
            if (fluxConfigurationName == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "fluxConfigurationName");
            }
            if (Client.ApiVersion == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
            }
            // Tracing
            bool _shouldTrace = ServiceClientTracing.IsEnabled;
            string _invocationId = null;
            if (_shouldTrace)
            {
                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
                tracingParameters.Add("resourceGroupName", resourceGroupName);
                tracingParameters.Add("clusterRp", clusterRp);
                tracingParameters.Add("clusterResourceName", clusterResourceName);
                tracingParameters.Add("clusterName", clusterName);
                tracingParameters.Add("fluxConfigurationName", fluxConfigurationName);
                tracingParameters.Add("cancellationToken", cancellationToken);
                ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
            }
            // Construct URL
            var _baseUrl = Client.BaseUri.AbsoluteUri;
            var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}").ToString();
            _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
            _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
            _url = _url.Replace("{clusterRp}", System.Uri.EscapeDataString(clusterRp));
            _url = _url.Replace("{clusterResourceName}", System.Uri.EscapeDataString(clusterResourceName));
            _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName));
            _url = _url.Replace("{fluxConfigurationName}", System.Uri.EscapeDataString(fluxConfigurationName));
            List<string> _queryParameters = new List<string>();
            if (Client.ApiVersion != null)
            {
                _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
            }
            if (_queryParameters.Count > 0)
            {
                _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
            }
            // Create HTTP transport objects
            var _httpRequest = new HttpRequestMessage();
            HttpResponseMessage _httpResponse = null;
            _httpRequest.Method = new HttpMethod("GET");
            _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;
            // 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 != 200)
            {
                var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
                try
                {
                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                    ErrorResponse _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, Client.DeserializationSettings);
                    if (_errorBody != null)
                    {
                        ex.Body = _errorBody;
                    }
                }
                catch (JsonException)
                {
                    // Ignore the exception
                }
                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
                if (_shouldTrace)
                {
                    ServiceClientTracing.Error(_invocationId, ex);
                }
                _httpRequest.Dispose();
                if (_httpResponse != null)
                {
                    _httpResponse.Dispose();
                }
                throw ex;
            }
            // Create Result
            var _result = new AzureOperationResponse<FluxConfiguration>();
            _result.Request = _httpRequest;
            _result.Response = _httpResponse;
            if (_httpResponse.Headers.Contains("x-ms-request-id"))
            {
                _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
            }
            // Deserialize Response
            if ((int)_statusCode == 200)
            {
                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                try
                {
                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<FluxConfiguration>(_responseContent, Client.DeserializationSettings);
                }
                catch (JsonException ex)
                {
                    _httpRequest.Dispose();
                    if (_httpResponse != null)
                    {
                        _httpResponse.Dispose();
                    }
                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
                }
            }
            if (_shouldTrace)
            {
                ServiceClientTracing.Exit(_invocationId, _result);
            }
            return _result;
        }

        /// <summary>
        /// Create a new Kubernetes Flux Configuration.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group. The name is case insensitive.
        /// </param>
        /// <param name='clusterRp'>
        /// The Kubernetes cluster RP - i.e. Microsoft.ContainerService,
        /// Microsoft.Kubernetes, Microsoft.HybridContainerService.
        /// </param>
        /// <param name='clusterResourceName'>
        /// The Kubernetes cluster resource name - i.e. managedClusters,
        /// connectedClusters, provisionedClusters.
        /// </param>
        /// <param name='clusterName'>
        /// The name of the kubernetes cluster.
        /// </param>
        /// <param name='fluxConfigurationName'>
        /// Name of the Flux Configuration.
        /// </param>
        /// <param name='fluxConfiguration'>
        /// Properties necessary to Create a FluxConfiguration.
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        public async Task<AzureOperationResponse<FluxConfiguration>> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, string fluxConfigurationName, FluxConfiguration fluxConfiguration, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            // Send Request
            AzureOperationResponse<FluxConfiguration> _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName, fluxConfiguration, customHeaders, cancellationToken).ConfigureAwait(false);
            return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
        }

        /// <summary>
        /// Update an existing Kubernetes Flux Configuration.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group. The name is case insensitive.
        /// </param>
        /// <param name='clusterRp'>
        /// The Kubernetes cluster RP - i.e. Microsoft.ContainerService,
        /// Microsoft.Kubernetes, Microsoft.HybridContainerService.
        /// </param>
        /// <param name='clusterResourceName'>
        /// The Kubernetes cluster resource name - i.e. managedClusters,
        /// connectedClusters, provisionedClusters.
        /// </param>
        /// <param name='clusterName'>
        /// The name of the kubernetes cluster.
        /// </param>
        /// <param name='fluxConfigurationName'>
        /// Name of the Flux Configuration.
        /// </param>
        /// <param name='fluxConfigurationPatch'>
        /// Properties to Patch in an existing Flux Configuration.
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        public async Task<AzureOperationResponse<FluxConfiguration>> UpdateWithHttpMessagesAsync(string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, string fluxConfigurationName, FluxConfigurationPatch fluxConfigurationPatch, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            // Send Request
            AzureOperationResponse<FluxConfiguration> _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName, fluxConfigurationPatch, customHeaders, cancellationToken).ConfigureAwait(false);
            return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
        }

        /// <summary>
        /// This will delete the YAML file used to set up the Flux Configuration, thus
        /// stopping future sync from the source repo.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group. The name is case insensitive.
        /// </param>
        /// <param name='clusterRp'>
        /// The Kubernetes cluster RP - i.e. Microsoft.ContainerService,
        /// Microsoft.Kubernetes, Microsoft.HybridContainerService.
        /// </param>
        /// <param name='clusterResourceName'>
        /// The Kubernetes cluster resource name - i.e. managedClusters,
        /// connectedClusters, provisionedClusters.
        /// </param>
        /// <param name='clusterName'>
        /// The name of the kubernetes cluster.
        /// </param>
        /// <param name='fluxConfigurationName'>
        /// Name of the Flux Configuration.
        /// </param>
        /// <param name='forceDelete'>
        /// Delete the extension resource in Azure - not the normal asynchronous
        /// delete.
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        public async Task<AzureOperationResponse> DeleteWithHttpMessagesAsync(string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, string fluxConfigurationName, bool? forceDelete = default(bool?), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            // Send request
            AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName, forceDelete, customHeaders, cancellationToken).ConfigureAwait(false);
            return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
        }

        /// <summary>
        /// List all Flux Configurations.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group. The name is case insensitive.
        /// </param>
        /// <param name='clusterRp'>
        /// The Kubernetes cluster RP - i.e. Microsoft.ContainerService,
        /// Microsoft.Kubernetes, Microsoft.HybridContainerService.
        /// </param>
        /// <param name='clusterResourceName'>
        /// The Kubernetes cluster resource name - i.e. managedClusters,
        /// connectedClusters, provisionedClusters.
        /// </param>
        /// <param name='clusterName'>
        /// The name of the kubernetes cluster.
        /// </param>
        /// <param name='customHeaders'>
        /// Headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="ErrorResponseException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <return>
        /// A response object containing the response body and response headers.
        /// </return>
        public async Task<AzureOperationResponse<IPage<FluxConfiguration>>> ListWithHttpMessagesAsync(string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (Client.SubscriptionId == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
            }
            if (resourceGroupName == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
            }
            if (clusterRp == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "clusterRp");
            }
            if (clusterResourceName == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "clusterResourceName");
            }
            if (clusterName == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "clusterName");
            }
            if (Client.ApiVersion == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
            }
            // Tracing
            bool _shouldTrace = ServiceClientTracing.IsEnabled;
            string _invocationId = null;
            if (_shouldTrace)
            {
                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
                tracingParameters.Add("resourceGroupName", resourceGroupName);
                tracingParameters.Add("clusterRp", clusterRp);
                tracingParameters.Add("clusterResourceName", clusterResourceName);
                tracingParameters.Add("clusterName", clusterName);
                tracingParameters.Add("cancellationToken", cancellationToken);
                ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
            }
            // Construct URL
            var _baseUrl = Client.BaseUri.AbsoluteUri;
            var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations").ToString();
            _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
            _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
            _url = _url.Replace("{clusterRp}", System.Uri.EscapeDataString(clusterRp));
            _url = _url.Replace("{clusterResourceName}", System.Uri.EscapeDataString(clusterResourceName));
            _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName));
            List<string> _queryParameters = new List<string>();
            if (Client.ApiVersion != null)
            {
                _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
            }
            if (_queryParameters.Count > 0)
            {
                _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
            }
            // Create HTTP transport objects
            var _httpRequest = new HttpRequestMessage();
            HttpResponseMessage _httpResponse = null;
            _httpRequest.Method = new HttpMethod("GET");
            _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;
            // 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 != 200)
            {
                var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
                try
                {
                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                    ErrorResponse _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, Client.DeserializationSettings);
                    if (_errorBody != null)
                    {
                        ex.Body = _errorBody;
                    }
                }
                catch (JsonException)
                {
                    // Ignore the exception
                }
                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
                if (_shouldTrace)
                {
                    ServiceClientTracing.Error(_invocationId, ex);
                }
                _httpRequest.Dispose();
                if (_httpResponse != null)
                {
                    _httpResponse.Dispose();
                }
                throw ex;
            }
            // Create Result
            var _result = new AzureOperationResponse<IPage<FluxConfiguration>>();
            _result.Request = _httpRequest;
            _result.Response = _httpResponse;
            if (_httpResponse.Headers.Contains("x-ms-request-id"))
            {
                _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
            }
            // Deserialize Response
            if ((int)_statusCode == 200)
            {
                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                try
                {
                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Page<FluxConfiguration>>(_responseContent, Client.DeserializationSettings);
                }
                catch (JsonException ex)
                {
                    _httpRequest.Dispose();
                    if (_httpResponse != null)
                    {
                        _httpResponse.Dispose();
                    }
                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
                }
            }
            if (_shouldTrace)
            {
                ServiceClientTracing.Exit(_invocationId, _result);
            }
            return _result;
        }

        /// <summary>
        /// Create a new Kubernetes Flux Configuration.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group. The name is case insensitive.
        /// </param>
        /// <param name='clusterRp'>
        /// The Kubernetes cluster RP - i.e. Microsoft.ContainerService,
        /// Microsoft.Kubernetes, Microsoft.HybridContainerService.
        /// </param>
        /// <param name='clusterResourceName'>
        /// The Kubernetes cluster resource name - i.e. managedClusters,
        /// connectedClusters, provisionedClusters.
        /// </param>
        /// <param name='clusterName'>
        /// The name of the kubernetes cluster.
        /// </param>
        /// <param name='fluxConfigurationName'>
        /// Name of the Flux Configuration.
        /// </param>
        /// <param name='fluxConfiguration'>
        /// Properties necessary to Create a FluxConfiguration.
        /// </param>
        /// <param name='customHeaders'>
        /// Headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="ErrorResponseException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <return>
        /// A response object containing the response body and response headers.
        /// </return>
        public async Task<AzureOperationResponse<FluxConfiguration>> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, string fluxConfigurationName, FluxConfiguration fluxConfiguration, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (Client.SubscriptionId == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
            }
            if (resourceGroupName == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
            }
            if (clusterRp == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "clusterRp");
            }
            if (clusterResourceName == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "clusterResourceName");
            }
            if (clusterName == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "clusterName");
            }
            if (fluxConfigurationName == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "fluxConfigurationName");
            }
            if (Client.ApiVersion == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
            }
            if (fluxConfiguration == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "fluxConfiguration");
            }
            // Tracing
            bool _shouldTrace = ServiceClientTracing.IsEnabled;
            string _invocationId = null;
            if (_shouldTrace)
            {
                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
                tracingParameters.Add("resourceGroupName", resourceGroupName);
                tracingParameters.Add("clusterRp", clusterRp);
                tracingParameters.Add("clusterResourceName", clusterResourceName);
                tracingParameters.Add("clusterName", clusterName);
                tracingParameters.Add("fluxConfigurationName", fluxConfigurationName);
                tracingParameters.Add("fluxConfiguration", fluxConfiguration);
                tracingParameters.Add("cancellationToken", cancellationToken);
                ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters);
            }
            // Construct URL
            var _baseUrl = Client.BaseUri.AbsoluteUri;
            var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}").ToString();
            _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
            _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
            _url = _url.Replace("{clusterRp}", System.Uri.EscapeDataString(clusterRp));
            _url = _url.Replace("{clusterResourceName}", System.Uri.EscapeDataString(clusterResourceName));
            _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName));
            _url = _url.Replace("{fluxConfigurationName}", System.Uri.EscapeDataString(fluxConfigurationName));
            List<string> _queryParameters = new List<string>();
            if (Client.ApiVersion != null)
            {
                _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
            }
            if (_queryParameters.Count > 0)
            {
                _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
            }
            // Create HTTP transport objects
            var _httpRequest = new HttpRequestMessage();
            HttpResponseMessage _httpResponse = null;
            _httpRequest.Method = new HttpMethod("PUT");
            _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(fluxConfiguration != null)
            {
                _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(fluxConfiguration, Client.SerializationSettings);
                _httpRequest.Content = new 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 != 200 && (int)_statusCode != 201)
            {
                var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
                try
                {
                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                    ErrorResponse _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, Client.DeserializationSettings);
                    if (_errorBody != null)
                    {
                        ex.Body = _errorBody;
                    }
                }
                catch (JsonException)
                {
                    // Ignore the exception
                }
                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
                if (_shouldTrace)
                {
                    ServiceClientTracing.Error(_invocationId, ex);
                }
                _httpRequest.Dispose();
                if (_httpResponse != null)
                {
                    _httpResponse.Dispose();
                }
                throw ex;
            }
            // Create Result
            var _result = new AzureOperationResponse<FluxConfiguration>();
            _result.Request = _httpRequest;
            _result.Response = _httpResponse;
            if (_httpResponse.Headers.Contains("x-ms-request-id"))
            {
                _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
            }
            // Deserialize Response
            if ((int)_statusCode == 200)
            {
                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                try
                {
                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<FluxConfiguration>(_responseContent, Client.DeserializationSettings);
                }
                catch (JsonException ex)
                {
                    _httpRequest.Dispose();
                    if (_httpResponse != null)
                    {
                        _httpResponse.Dispose();
                    }
                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
                }
            }
            // Deserialize Response
            if ((int)_statusCode == 201)
            {
                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                try
                {
                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<FluxConfiguration>(_responseContent, Client.DeserializationSettings);
                }
                catch (JsonException ex)
                {
                    _httpRequest.Dispose();
                    if (_httpResponse != null)
                    {
                        _httpResponse.Dispose();
                    }
                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
                }
            }
            if (_shouldTrace)
            {
                ServiceClientTracing.Exit(_invocationId, _result);
            }
            return _result;
        }

        /// <summary>
        /// Update an existing Kubernetes Flux Configuration.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group. The name is case insensitive.
        /// </param>
        /// <param name='clusterRp'>
        /// The Kubernetes cluster RP - i.e. Microsoft.ContainerService,
        /// Microsoft.Kubernetes, Microsoft.HybridContainerService.
        /// </param>
        /// <param name='clusterResourceName'>
        /// The Kubernetes cluster resource name - i.e. managedClusters,
        /// connectedClusters, provisionedClusters.
        /// </param>
        /// <param name='clusterName'>
        /// The name of the kubernetes cluster.
        /// </param>
        /// <param name='fluxConfigurationName'>
        /// Name of the Flux Configuration.
        /// </param>
        /// <param name='fluxConfigurationPatch'>
        /// Properties to Patch in an existing Flux Configuration.
        /// </param>
        /// <param name='customHeaders'>
        /// Headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="ErrorResponseException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <return>
        /// A response object containing the response body and response headers.
        /// </return>
        public async Task<AzureOperationResponse<FluxConfiguration>> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, string fluxConfigurationName, FluxConfigurationPatch fluxConfigurationPatch, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (Client.SubscriptionId == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
            }
            if (resourceGroupName == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
            }
            if (clusterRp == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "clusterRp");
            }
            if (clusterResourceName == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "clusterResourceName");
            }
            if (clusterName == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "clusterName");
            }
            if (fluxConfigurationName == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "fluxConfigurationName");
            }
            if (Client.ApiVersion == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
            }
            if (fluxConfigurationPatch == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "fluxConfigurationPatch");
            }
            // Tracing
            bool _shouldTrace = ServiceClientTracing.IsEnabled;
            string _invocationId = null;
            if (_shouldTrace)
            {
                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
                tracingParameters.Add("resourceGroupName", resourceGroupName);
                tracingParameters.Add("clusterRp", clusterRp);
                tracingParameters.Add("clusterResourceName", clusterResourceName);
                tracingParameters.Add("clusterName", clusterName);
                tracingParameters.Add("fluxConfigurationName", fluxConfigurationName);
                tracingParameters.Add("fluxConfigurationPatch", fluxConfigurationPatch);
                tracingParameters.Add("cancellationToken", cancellationToken);
                ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters);
            }
            // Construct URL
            var _baseUrl = Client.BaseUri.AbsoluteUri;
            var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}").ToString();
            _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
            _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
            _url = _url.Replace("{clusterRp}", System.Uri.EscapeDataString(clusterRp));
            _url = _url.Replace("{clusterResourceName}", System.Uri.EscapeDataString(clusterResourceName));
            _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName));
            _url = _url.Replace("{fluxConfigurationName}", System.Uri.EscapeDataString(fluxConfigurationName));
            List<string> _queryParameters = new List<string>();
            if (Client.ApiVersion != null)
            {
                _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
            }
            if (_queryParameters.Count > 0)
            {
                _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
            }
            // Create HTTP transport objects
            var _httpRequest = new HttpRequestMessage();
            HttpResponseMessage _httpResponse = null;
            _httpRequest.Method = new HttpMethod("PATCH");
            _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(fluxConfigurationPatch != null)
            {
                _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(fluxConfigurationPatch, Client.SerializationSettings);
                _httpRequest.Content = new 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
                try
                {
                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                    ErrorResponse _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, Client.DeserializationSettings);
                    if (_errorBody != null)
                    {
                        ex.Body = _errorBody;
                    }
                }
                catch (JsonException)
                {
                    // Ignore the exception
                }
                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
                if (_shouldTrace)
                {
                    ServiceClientTracing.Error(_invocationId, ex);
                }
                _httpRequest.Dispose();
                if (_httpResponse != null)
                {
                    _httpResponse.Dispose();
                }
                throw ex;
            }
            // Create Result
            var _result = new AzureOperationResponse<FluxConfiguration>();
            _result.Request = _httpRequest;
            _result.Response = _httpResponse;
            if (_httpResponse.Headers.Contains("x-ms-request-id"))
            {
                _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
            }
            // Deserialize Response
            if ((int)_statusCode == 202)
            {
                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                try
                {
                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<FluxConfiguration>(_responseContent, Client.DeserializationSettings);
                }
                catch (JsonException ex)
                {
                    _httpRequest.Dispose();
                    if (_httpResponse != null)
                    {
                        _httpResponse.Dispose();
                    }
                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
                }
            }
            if (_shouldTrace)
            {
                ServiceClientTracing.Exit(_invocationId, _result);
            }
            return _result;
        }

        /// <summary>
        /// This will delete the YAML file used to set up the Flux Configuration, thus
        /// stopping future sync from the source repo.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group. The name is case insensitive.
        /// </param>
        /// <param name='clusterRp'>
        /// The Kubernetes cluster RP - i.e. Microsoft.ContainerService,
        /// Microsoft.Kubernetes, Microsoft.HybridContainerService.
        /// </param>
        /// <param name='clusterResourceName'>
        /// The Kubernetes cluster resource name - i.e. managedClusters,
        /// connectedClusters, provisionedClusters.
        /// </param>
        /// <param name='clusterName'>
        /// The name of the kubernetes cluster.
        /// </param>
        /// <param name='fluxConfigurationName'>
        /// Name of the Flux Configuration.
        /// </param>
        /// <param name='forceDelete'>
        /// Delete the extension resource in Azure - not the normal asynchronous
        /// delete.
        /// </param>
        /// <param name='customHeaders'>
        /// Headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="ErrorResponseException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <return>
        /// A response object containing the response body and response headers.
        /// </return>
        public async Task<AzureOperationResponse> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, string fluxConfigurationName, bool? forceDelete = default(bool?), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (Client.SubscriptionId == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
            }
            if (resourceGroupName == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
            }
            if (clusterRp == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "clusterRp");
            }
            if (clusterResourceName == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "clusterResourceName");
            }
            if (clusterName == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "clusterName");
            }
            if (fluxConfigurationName == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "fluxConfigurationName");
            }
            if (Client.ApiVersion == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
            }
            // Tracing
            bool _shouldTrace = ServiceClientTracing.IsEnabled;
            string _invocationId = null;
            if (_shouldTrace)
            {
                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
                tracingParameters.Add("resourceGroupName", resourceGroupName);
                tracingParameters.Add("clusterRp", clusterRp);
                tracingParameters.Add("clusterResourceName", clusterResourceName);
                tracingParameters.Add("clusterName", clusterName);
                tracingParameters.Add("fluxConfigurationName", fluxConfigurationName);
                tracingParameters.Add("forceDelete", forceDelete);
                tracingParameters.Add("cancellationToken", cancellationToken);
                ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters);
            }
            // Construct URL
            var _baseUrl = Client.BaseUri.AbsoluteUri;
            var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}").ToString();
            _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
            _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
            _url = _url.Replace("{clusterRp}", System.Uri.EscapeDataString(clusterRp));
            _url = _url.Replace("{clusterResourceName}", System.Uri.EscapeDataString(clusterResourceName));
            _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName));
            _url = _url.Replace("{fluxConfigurationName}", System.Uri.EscapeDataString(fluxConfigurationName));
            List<string> _queryParameters = new List<string>();
            if (Client.ApiVersion != null)
            {
                _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
            }
            if (forceDelete != null)
            {
                _queryParameters.Add(string.Format("forceDelete={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(forceDelete, Client.SerializationSettings).Trim('"'))));
            }
            if (_queryParameters.Count > 0)
            {
                _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
            }
            // Create HTTP transport objects
            var _httpRequest = new HttpRequestMessage();
            HttpResponseMessage _httpResponse = null;
            _httpRequest.Method = new HttpMethod("DELETE");
            _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;
            // 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 != 200 && (int)_statusCode != 202 && (int)_statusCode != 204)
            {
                var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
                try
                {
                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                    ErrorResponse _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, Client.DeserializationSettings);
                    if (_errorBody != null)
                    {
                        ex.Body = _errorBody;
                    }
                }
                catch (JsonException)
                {
                    // Ignore the exception
                }
                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
                if (_shouldTrace)
                {
                    ServiceClientTracing.Error(_invocationId, ex);
                }
                _httpRequest.Dispose();
                if (_httpResponse != null)
                {
                    _httpResponse.Dispose();
                }
                throw ex;
            }
            // Create Result
            var _result = new AzureOperationResponse();
            _result.Request = _httpRequest;
            _result.Response = _httpResponse;
            if (_httpResponse.Headers.Contains("x-ms-request-id"))
            {
                _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
            }
            if (_shouldTrace)
            {
                ServiceClientTracing.Exit(_invocationId, _result);
            }
            return _result;
        }

        /// <summary>
        /// List all Flux Configurations.
        /// </summary>
        /// <param name='nextPageLink'>
        /// The NextLink from the previous successful call to List operation.
        /// </param>
        /// <param name='customHeaders'>
        /// Headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="ErrorResponseException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <return>
        /// A response object containing the response body and response headers.
        /// </return>
        public async Task<AzureOperationResponse<IPage<FluxConfiguration>>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (nextPageLink == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink");
            }
            // Tracing
            bool _shouldTrace = ServiceClientTracing.IsEnabled;
            string _invocationId = null;
            if (_shouldTrace)
            {
                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
                tracingParameters.Add("nextPageLink", nextPageLink);
                tracingParameters.Add("cancellationToken", cancellationToken);
                ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters);
            }
            // Construct URL
            string _url = "{nextLink}";
            _url = _url.Replace("{nextLink}", nextPageLink);
            List<string> _queryParameters = new List<string>();
            if (_queryParameters.Count > 0)
            {
                _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
            }
            // Create HTTP transport objects
            var _httpRequest = new HttpRequestMessage();
            HttpResponseMessage _httpResponse = null;
            _httpRequest.Method = new HttpMethod("GET");
            _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;
            // 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 != 200)
            {
                var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
                try
                {
                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                    ErrorResponse _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<ErrorResponse>(_responseContent, Client.DeserializationSettings);
                    if (_errorBody != null)
                    {
                        ex.Body = _errorBody;
                    }
                }
                catch (JsonException)
                {
                    // Ignore the exception
                }
                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
                if (_shouldTrace)
                {
                    ServiceClientTracing.Error(_invocationId, ex);
                }
                _httpRequest.Dispose();
                if (_httpResponse != null)
                {
                    _httpResponse.Dispose();
                }
                throw ex;
            }
            // Create Result
            var _result = new AzureOperationResponse<IPage<FluxConfiguration>>();
            _result.Request = _httpRequest;
            _result.Response = _httpResponse;
            if (_httpResponse.Headers.Contains("x-ms-request-id"))
            {
                _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
            }
            // Deserialize Response
            if ((int)_statusCode == 200)
            {
                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                try
                {
                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Page<FluxConfiguration>>(_responseContent, Client.DeserializationSettings);
                }
                catch (JsonException ex)
                {
                    _httpRequest.Dispose();
                    if (_httpResponse != null)
                    {
                        _httpResponse.Dispose();
                    }
                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
                }
            }
            if (_shouldTrace)
            {
                ServiceClientTracing.Exit(_invocationId, _result);
            }
            return _result;
        }

    }
}


text:
<?php

require_once dirname(__FILE__) . '/../../../src/PronounceableWord/DependencyInjectionContainer.php';

class PronounceableWord_Tests_DependencyInjectionContainerTest extends PHPUnit_Framework_TestCase {
    public function testClassNames() {
        $container = new PronounceableWord_DependencyInjectionContainer();

        foreach ($container->classNames as $classType => $className) {
            $expectedClassName = 'PronounceableWord_' . $classType;
            $this->assertSame($expectedClassName, $className);
        }
    }

    public function testClassNamesAndInstances() {
        $container = new PronounceableWord_DependencyInjectionContainer();

        foreach ($container->classNames as $classType => $className) {
            $getMethodName = 'get' . $classType;
            $instance = $container->{$getMethodName}();

            $this->assertInstanceOf($className, $instance);
        }
    }

    public function testConfigurations() {
        $container = new PronounceableWord_DependencyInjectionContainer();

        foreach ($container->configurations as $className => $configurationInstance) {
            $configurationClassName = 'PronounceableWord_Configuration_' . $className;

            $this->assertInstanceOf($configurationClassName, $configurationInstance);
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php

class Database_Query_Builder_Update extends Fuel\Core\Database_Query_Builder_Update
{
	public function __construct($table = NULL)
	{
		if ($table)
		{
			// Set the inital table name
			$this->_table = $table;
		}

		if (\DBUtil::field_exists($table, array('updated_at')))
		{
			$this->set(array('updated_at' => date('Y-m-d H;i;s')));
		}

		// Start the query with no SQL
		return parent::__construct('', \DB::UPDATE);
	}
}


text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2014.05.01 at 09:05:39 PM CEST
//

package org.opencds.vmr.v1_0.schema;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;

/**
 * The parent class containing the data required by a specific CDS use case.  For example, this class can be used to specify that the evaluation of a patient for the need for a mammogram requires the following data: (i) gender; (ii) age; (iii) past mastectomy history; and (iv) past mammogram history.
 *
 * Can include a detailed input specification for the focal patient as well as for related evaluated persons.  Note that it is assumed that the superset of data required for related evaluated persons are the same for each of the related evaluated persons (e.g., relatives).  If input specifications are not provided regarding patients or other evaluated persons, then this signifies that no further constraints are being placed on required data other than what is expressed through the input data model and its existing template(s).
 *
 *
Java class for CDSInputSpecification complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="CDSInputSpecification">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="requiredCdsResourceType" type="{org.opencds.vmr.v1_0.schema.datatypes}CD" maxOccurs="unbounded" minOccurs="0"/>
 *         <element name="requiredCdsContextAttribute" type="{org.opencds.vmr.v1_0.schema.datatypes}CS" maxOccurs="unbounded" minOccurs="0"/>
 *         <element name="requiredInputVmrTemplate" type="{org.opencds.vmr.v1_0.schema.datatypes}II" maxOccurs="unbounded" minOccurs="0"/>
 *         <element name="patientInputSpecification" type="{org.opencds.vmr.v1_0.schema.cdsinput.specification}PatientInputSpecification" minOccurs="0"/>
 *         <element name="relatedEvaluatedPersonInputSpecification" type="{org.opencds.vmr.v1_0.schema.cdsinput.specification}RelatedEvaluatedPersonInputSpecification" minOccurs="0"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CDSInputSpecification", namespace = "org.opencds.vmr.v1_0.schema.cdsinput.specification", propOrder = {
    "requiredCdsResourceType",
    "requiredCdsContextAttribute",
    "requiredInputVmrTemplate",
    "patientInputSpecification",
    "relatedEvaluatedPersonInputSpecification"
})
public class CDSInputSpecification {

    protected List<CD> requiredCdsResourceType;
    protected List<CS> requiredCdsContextAttribute;
    protected List<II> requiredInputVmrTemplate;
    protected PatientInputSpecification patientInputSpecification;
    protected RelatedEvaluatedPersonInputSpecification relatedEvaluatedPersonInputSpecification;

    /**
     * Gets the value of the requiredCdsResourceType property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the requiredCdsResourceType property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getRequiredCdsResourceType().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link CD }
     *
     *
     */
    public List<CD> getRequiredCdsResourceType() {
        if (requiredCdsResourceType == null) {
            requiredCdsResourceType = new ArrayList<CD>();
        }
        return this.requiredCdsResourceType;
    }

    /**
     * Gets the value of the requiredCdsContextAttribute property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the requiredCdsContextAttribute property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getRequiredCdsContextAttribute().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link CS }
     *
     *
     */
    public List<CS> getRequiredCdsContextAttribute() {
        if (requiredCdsContextAttribute == null) {
            requiredCdsContextAttribute = new ArrayList<CS>();
        }
        return this.requiredCdsContextAttribute;
    }

    /**
     * Gets the value of the requiredInputVmrTemplate property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the requiredInputVmrTemplate property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getRequiredInputVmrTemplate().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link II }
     *
     *
     */
    public List<II> getRequiredInputVmrTemplate() {
        if (requiredInputVmrTemplate == null) {
            requiredInputVmrTemplate = new ArrayList<II>();
        }
        return this.requiredInputVmrTemplate;
    }

    /**
     * Gets the value of the patientInputSpecification property.
     *
     * @return
     *     possible object is
     *     {@link PatientInputSpecification }
     *
     */
    public PatientInputSpecification getPatientInputSpecification() {
        return patientInputSpecification;
    }

    /**
     * Sets the value of the patientInputSpecification property.
     *
     * @param value
     *     allowed object is
     *     {@link PatientInputSpecification }
     *
     */
    public void setPatientInputSpecification(PatientInputSpecification value) {
        this.patientInputSpecification = value;
    }

    /**
     * Gets the value of the relatedEvaluatedPersonInputSpecification property.
     *
     * @return
     *     possible object is
     *     {@link RelatedEvaluatedPersonInputSpecification }
     *
     */
    public RelatedEvaluatedPersonInputSpecification getRelatedEvaluatedPersonInputSpecification() {
        return relatedEvaluatedPersonInputSpecification;
    }

    /**
     * Sets the value of the relatedEvaluatedPersonInputSpecification property.
     *
     * @param value
     *     allowed object is
     *     {@link RelatedEvaluatedPersonInputSpecification }
     *
     */
    public void setRelatedEvaluatedPersonInputSpecification(RelatedEvaluatedPersonInputSpecification value) {
        this.relatedEvaluatedPersonInputSpecification = value;
    }

}


text:
local sys = require 'sys'
local ffi = require 'ffi'

local M = {}

local function parseCSV(filename)
    require 'csvigo'
    print(('Loading csv: %s'):format(filename))
    local all = csvigo.load{path=filename, mode='tidy'}
    local ids = all['id']
    local actionss = all['actions']
    local N = #ids
    local labels = {}
    for i = 1,#ids do
        local id = ids[i]
        local actions = actionss[i]
        local label = {}
        for a in string.gmatch(actions, '([^;]+)') do -- split on ';'
            local a = string.gmatch(a, '([^ ]+)') -- split on ' '
            table.insert(label,{c=a(), s=tonumber(a()), e=tonumber(a())})
        end
        labels[id] = label
    end
    return labels
end

local function prepare(opt,labels,split)
    require 'sys'
    require 'string'
    local imagePath = torch.CharTensor()
    local imageClass = torch.LongTensor()
    local dir = opt.data
    assert(paths.dirp(dir), 'directory not found: ' .. dir)
    local imagePaths = {}
    local imageClasses = {}
    local ids = {}
    local FPS = 24
    local GAP = 4
    local testGAP = 25
    local flowframes = 10

    local e = 0
    local count = 0
    -- For each video annotation, prepare test files
    local imageClasses2
    if split=='val_video' then
        imageClasses2 = torch.IntTensor(4000000, opt.nClasses):zero()
    end
    for id,label in pairs(labels) do
        e = e+1
        if e % 100 == 1 then print(e) end
        iddir = dir .. '/' .. id
        local f = io.popen(('find -L %s -iname "*.jpg" '):format(iddir))
        if not f then
            print('class not found: ' .. id)
            print(('find -L %s -iname "*.jpg" '):format(iddir))
        else
            local lines = {}
            while true do
                local line = f:read('*line')
                if not line then break end
                table.insert(lines,line)
            end
            local N = torch.floor(#lines/2) -- to account for x and y
            if split=='val_video' then
                local target = torch.IntTensor(157,1):zero()
                for _,anno in pairs(label) do
                    target[1+tonumber(string.sub(anno.c,2,-1))] = 1 -- 1-index
                end
                local tmp = torch.linspace(1,N-flowframes-1,testGAP) -- -1 so we don't get bad flow
                for ii = 1,testGAP do
                    local i = torch.floor(tmp[ii])
                    local impath = iddir .. '/' .. id .. '-' .. string.format('%06d',i) .. 'x' .. '.jpg'
                    count = count + 1
                    table.insert(imagePaths,impath)
                    imageClasses2[count]:copy(target)
                    table.insert(ids,id)
                end
            elseif opt.setup == 'softmax' then
                local localimagePaths = {}
                local localimageClasses = {}
                local localids = {}
                if #label>0 then
                    for i = 1,N,GAP do
                        for _,anno in pairs(label) do
                            if (anno.s<(i-1)/FPS) and ((i-1)/FPS<anno.e) then
                                if i+flowframes+1<N then
                                    local impath = iddir .. '/' .. id .. '-' .. string.format('%06d',i) .. 'x' .. '.jpg'
                                    local a = 1+tonumber(string.sub(anno.c,2,-1))
                                    table.insert(localimagePaths,impath)
                                    table.insert(localimageClasses, a) -- 1-index
                                    table.insert(localids,id)
                                end
                            end
                        end
                    end
                end
                local Nex = #localimagePaths
                if Nex>=opt.batchSize then
                    local inds = torch.multinomial(torch.Tensor(1,Nex):fill(1),opt.batchSize)[1]
                    inds = inds:sort()
                    assert(inds:size(1)==opt.batchSize)
                    for aa = 1,opt.batchSize do
                        a = inds[aa]
                        table.insert(imagePaths,localimagePaths[a])
                        table.insert(imageClasses, localimageClasses[a]) -- 1-index
                        table.insert(ids,localids[a])
                    end
                end
            elseif opt.setup == 'sigmoid' then
                -- TODO
                assert(false,'Invalid opt.setup')
            else
                assert(false,'Invalid opt.setup')
            end
            f:close()
        end
    end

    -- Convert the generated list to a tensor for faster loading
    local nImages = #imagePaths
    local maxLength = -1
    for _,p in pairs(imagePaths) do
        maxLength = math.max(maxLength, #p + 1)
    end
    local imagePath = torch.CharTensor(nImages, maxLength):zero()
    for i, path in ipairs(imagePaths) do
       ffi.copy(imagePath[i]:data(), path)
    end
    local maxLength2 = -1
    for _,p in pairs(ids) do
        maxLength2 = math.max(maxLength2, #p + 1)
    end
    local ids_tensor = torch.CharTensor(nImages, maxLength2):zero()
    for i, path in ipairs(ids) do
       ffi.copy(ids_tensor[i]:data(), path)
    end
    local imageClass = torch.LongTensor(imageClasses)
    if split=='val_video' then
        imageClass = imageClasses2[{{1,count},{}}]
    end
    assert(imagePath:size(1)==imageClass:size(1),"Sizes do not match")

    return imagePath, imageClass, ids_tensor
end

local function findClasses(dir)
   return Nil, Nil
end

function M.exec(opt, cacheFile)
   -- find the image path names
   local imagePath = torch.CharTensor()  -- path to each image in dataset
   local imageClass = torch.LongTensor() -- class index of each image (class index in self.classes)

   local filename = opt.trainfile
   local filenametest = opt.testfile
   local labels = parseCSV(filename)
   print('done parsing train csv')
   local labelstest = parseCSV(filenametest)
   print('done parsing test csv')

   print("=> Generating list of images")
   local classList, classToIdx = findClasses(trainDir)

   print(" | finding all validation2 images")
   local val2ImagePath, val2ImageClass, val2ids = prepare(opt,labelstest,'val_video')

   print(" | finding all validation images")
   local valImagePath, valImageClass, valids = prepare(opt,labelstest,'val')

   print(" | finding all training images")
   local trainImagePath, trainImageClass, ids = prepare(opt,labels,'train')

   local info = {
      basedir = opt.data,
      classList = classList,
      train = {
         imagePath = trainImagePath,
         imageClass = trainImageClass,
         ids = ids,
      },
      val = {
         imagePath = valImagePath,
         imageClass = valImageClass,
         ids = valids,
      },
      val2 = {
         imagePath = val2ImagePath,
         imageClass = val2ImageClass,
         ids = val2ids,
      },
   }

   print(" | saving list of images to " .. cacheFile)
   torch.save(cacheFile, info)
   return info
end

return M


text:
package fifteen;

import java.util.Random;

public class Fifteen {
	public static final int DEFAULT_ROWS_COUNT = 4;
	public static final int DEFAULT_COLS_COUNT = 4;

	private int[][] tiles;
	private int zeroTileRowIndex;
	private int zeroTileColIndex;
	private int mixStepsCount;

	public enum Direction {
		UP(-1, 0), RIGHT(0, 1), DOWN(1, 0), LEFT(0, -1);

		public final int rowOffset;
		public final int colOffset;

		private Direction(int rowOffset, int colOffset) {
			this.rowOffset = rowOffset;
			this.colOffset = colOffset;
		}
	}

	public Fifteen(int rowsCount, int colsCount) {
		checkFifteenSize(rowsCount, colsCount);
		initializeTiles(rowsCount, colsCount);
		zeroTileRowIndex = rowsCount - 1;
		zeroTileColIndex = colsCount - 1;
		mixStepsCount = rowsCount * colsCount * 10; // ?
	}

	public Fifteen() {
		this(DEFAULT_ROWS_COUNT, DEFAULT_COLS_COUNT);
	}

	private void initializeTiles(int rowsCount, int colsCount) {
		tiles = new int[rowsCount][colsCount];
		for (int i = 0; i < rowsCount; i++) {
			for (int j = 0; j < colsCount; j++) {
				tiles[i][j] = getWinTileNumber(i, j);
			}
		}
	}

	private void checkIndexes(int rowIndex, int colIndex) {
		boolean isRowIndexValid = rowIndex >= 0 && rowIndex < getRowsCount();
		boolean isColIndexValid = colIndex >= 0 && colIndex < getColsCount();

		if (!isColIndexValid && !isRowIndexValid) {
			// TODO
			//throw new IllegalIndexesException(rowIndex, colIndex);
		}

		if (!isColIndexValid) {
			// TODO
			//throw new IllegalIndexesException(colIndex);
		}

		if (!isRowIndexValid) {
			// TODO
			//throw new IllegalIndexesException(rowIndex);
		}
	}

	private static void checkFifteenSize(int rowsCount, int colsCount) {
		boolean isRowsCountValid = rowsCount > 0;
		boolean isColsCountValid = colsCount > 0;

		if (!isColsCountValid && !isRowsCountValid) {
			// TODO
			//throw new FifteenIllegalSizeExeption(rowsCount, colsCount);
		}

		if (!isRowsCountValid) {
			// TODO
		}

		if (!isColsCountValid) {
			// TODO
		}
	}

	public void mix() {
		mix(mixStepsCount);
	}

	public void mix(int mixStepsCount) {
		for (int i = 0; i < mixStepsCount; i++) {
			Direction randomDirection = getRandomDirection();
			moveTile(randomDirection);
		}
	}

	public boolean isWin() {
		for (int i = 0; i < getRowsCount(); i++) {
			for (int j = 0; j < getColsCount(); j++) {
				if (getTileNumber(i, j) != getWinTileNumber(i, j)) {
					return false;
				}
			}
		}

		return true;
	}

	private Direction getRandomDirection() {
		Direction[] directions = Direction.values();
		int randomIndex = new Random().nextInt(directions.length);
		return directions[randomIndex];
	}

	public boolean isTileCanMove(int rowIndex, int colIndex) {
		checkIndexes(rowIndex, colIndex);
		return ((colIndex == zeroTileColIndex && Math.abs(rowIndex - zeroTileRowIndex) == 1) ||
			(rowIndex == zeroTileRowIndex && Math.abs(colIndex - zeroTileColIndex) == 1)) &&
			isTileExists(rowIndex, colIndex);
	}

	public boolean isTileExists(int rowIndex, int colIndex) {
		return rowIndex >= 0 && rowIndex < getRowsCount() &&
				colIndex >= 0 && colIndex < getColsCount();
	}

	public boolean moveTile(int rowIndex, int colIndex) {
		checkIndexes(rowIndex, colIndex);

		if (isTileCanMove(rowIndex, colIndex)) {
			tiles[zeroTileRowIndex][zeroTileColIndex] = tiles[rowIndex][colIndex];
			tiles[rowIndex][colIndex] = 0;
			zeroTileRowIndex = rowIndex;
			zeroTileColIndex = colIndex;
			return true;
		}

		return false;
	}

	public boolean moveTile(Fifteen.Direction direction) {
		int rowIndex = zeroTileRowIndex + direction.rowOffset;
		int colIndex = zeroTileColIndex + direction.colOffset;

		return moveTile(rowIndex, colIndex);
	}

	public int getWinTileNumber(int rowIndex, int colIndex) {
		checkIndexes(rowIndex, colIndex);
		int colsCount = getColsCount();
		int rowsCount = getRowsCount();

		if (colIndex == colsCount - 1  && rowIndex == rowsCount - 1) {
			return 0;
		}

		return rowIndex * colsCount + colIndex + 1;
	}

	public int getTileNumber(int rowIndex, int colIndex) {
		checkIndexes(rowIndex, colIndex);
		return tiles[rowIndex][colIndex];
	}

	public int getRowsCount() {
		return tiles.length;
	}

	public int getColsCount() {
		return tiles[0].length;
	}

	public int getMixStepsCount() {
		return mixStepsCount;
	}

	public void setMixStepsCount(int mixStepsCount) {
		this.mixStepsCount = mixStepsCount;
	}

	public int getZeroTileRowIndex() {
		return zeroTileRowIndex;
	}

	public int getZeroTileColIndex() {
		return zeroTileColIndex;
	}
}


text:
package com.gaecompat.javax.swing.text;

import java.io.PrintStream;
import java.util.Dictionary;
import java.util.EventListener;

import com.gaecompat.javax.swing.event.DocumentListener;

public class StyledDocument extends AbstractDocument {

	protected StyledDocument(Content data) {
		super(data);
		// TODO Auto-generated constructor stub
	}

	@Override
	public Dictionary<Object, Object> getDocumentProperties() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void setDocumentProperties(Dictionary<Object, Object> x) {
		// TODO Auto-generated method stub

	}

	@Override
	public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int getAsynchronousLoadPriority() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public void setAsynchronousLoadPriority(int p) {
		// TODO Auto-generated method stub

	}

	@Override
	public void setDocumentFilter(DocumentFilter filter) {
		// TODO Auto-generated method stub

	}

	@Override
	public DocumentFilter getDocumentFilter() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void render(Runnable r) {
		// TODO Auto-generated method stub

	}

	@Override
	public int getLength() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public void addDocumentListener(DocumentListener listener) {
		// TODO Auto-generated method stub

	}

	@Override
	public void removeDocumentListener(DocumentListener listener) {
		// TODO Auto-generated method stub

	}

	@Override
	public DocumentListener[] getDocumentListeners() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void addUndoableEditListener(UndoableEditListener listener) {
		// TODO Auto-generated method stub

	}

	@Override
	public void removeUndoableEditListener(UndoableEditListener listener) {
		// TODO Auto-generated method stub

	}

	@Override
	public UndoableEditListener[] getUndoableEditListeners() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Object getProperty(Object key) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void putProperty(Object key, Object value) {
		// TODO Auto-generated method stub

	}

	@Override
	public void remove(int offs, int len) throws BadLocationException {
		// TODO Auto-generated method stub

	}

	@Override
	public void replace(int offset, int length, String text, AttributeSet attrs)
			throws BadLocationException {
		// TODO Auto-generated method stub

	}

	@Override
	public void insertString(int offs, String str, AttributeSet a)
			throws BadLocationException {
		// TODO Auto-generated method stub

	}

	@Override
	public String getText(int offset, int length) throws BadLocationException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void getText(int offset, int length, Segment txt)
			throws BadLocationException {
		// TODO Auto-generated method stub

	}

	@Override
	public Position createPosition(int offs) throws BadLocationException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Position getStartPosition() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Position getEndPosition() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Element[] getRootElements() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Element getDefaultRootElement() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Element getBidiRootElement() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Element getParagraphElement(int pos) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void dump(PrintStream out) {
		// TODO Auto-generated method stub

	}

	@Override
	public void readLock() {
		// TODO Auto-generated method stub

	}

	@Override
	public void readUnlock() {
		// TODO Auto-generated method stub

	}

}


text:
package all

import _ "github.com/influxdata/telegraf/plugins/inputs/hddtemp" // register plugin


text:
<?php

/* Location: ./application/models/Dq_user_model.php */
/* Derived from Harviacode  */
/* Modified by Vivek Raghunathan 2016-03-26 03:09:38 */
/* Email : vivekra@dqserv.com */
/* http://dqserv.com */

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Ticket_serial_model extends CI_Model {

    public $table = 'ticket_serial';
    public $id = 'ticket_serial_id';
    public $order = 'DESC';

    function __construct() {
        parent::__construct();
    }

    // get all
    function get_all() {
        $this->db->order_by($this->id, $this->order);
        return $this->db->get($this->table)->result();
    }

    // get all data array
    function get_all_customer() {
        $this->db->order_by($this->id, $this->order);
        return $this->db->get($this->table)->result_array();
    }

    // get data by id
    function get_by_id($id) {
        $this->db->where($this->id, $id);
        return $this->db->get($this->table)->row();
    }

    // insert data
    function insert($data) {
        $this->db->insert($this->table, $data);
        return $this->db->insert_id();
    }

    // update data
    function update($id, $data) {
        $this->db->where($this->id, $id);
        $this->db->update($this->table, $data);
    }

    // delete data
    function delete($id) {
        $this->db->where($this->id, $id);
        $this->db->delete($this->table);
    }

    // get serial by ticket id
    function get_serial_info_by_ticket_id($ticket_id) {

        $this->db->select('*');

        $this->db->where('ticket_id', $ticket_id);

        $query = $this->db->get($this->table);
        //echo "<br> str ".$this->db->last_query();exit;
        $result = $query->result_array();
        $count = $query->num_rows();

        if ($count > 0) {
            return $result;
        } else {
            return 'failure';
        }

        //$this->db->order_by($this->id, $this->order);
        //return $this->db->get($this->table)->result_array();
    }

}

/* End of file Dq_user_model.php */


text:
{% load i18n %}

    <button class="btn" onClick="admin.file_manager.selector.send('{{ absolute_url }}'); return false;">{% trans "Select" %}</button>
    <button class="btn dropdown-toggle" data-toggle="dropdown">

    </button>

	    	{% for name, verbose in versions %}

		    		{{ verbose }}

	    	{% endfor %}

{% trans "Consider using thumbnails for your images to make your pages load faster." %}


text:
package stexfires.core.consumer;

import stexfires.core.TextRecord;

import java.util.Objects;
import java.util.function.Consumer;

/**
 * A RecordConsumer consumes a {@link stexfires.core.TextRecord}.
 *

 * It must be {@code thread-safe} and {@code non-interfering}.
 *

 * It is expected to operate via side-effects.
 *

 * This is a {@code functional interface} whose functional method is {@link #consume(stexfires.core.TextRecord)}.
 *
 * @author Mathias Kalb
 * @see java.util.function.Consumer
 * @see java.util.stream.Stream#forEach(Consumer)
 * @see java.util.stream.Stream#forEachOrdered(Consumer)
 * @since 0.1
 */
@FunctionalInterface
public interface RecordConsumer<T extends TextRecord> {

    static <T extends TextRecord> RecordConsumer<T> of(Consumer<T> consumer) {
        Objects.requireNonNull(consumer);
        return consumer::accept;
    }

    static <T extends TextRecord> RecordConsumer<T> concat(RecordConsumer<? super T> firstRecordConsumer,
                                                           RecordConsumer<? super T> secondRecordConsumer) {
        Objects.requireNonNull(firstRecordConsumer);
        Objects.requireNonNull(secondRecordConsumer);
        return record -> {
            firstRecordConsumer.consume(record);
            secondRecordConsumer.consume(record);
        };
    }

    static <T extends TextRecord> RecordConsumer<T> concat(RecordConsumer<? super T> firstRecordConsumer,
                                                           RecordConsumer<? super T> secondRecordConsumer,
                                                           RecordConsumer<? super T> thirdRecordConsumer) {
        Objects.requireNonNull(firstRecordConsumer);
        Objects.requireNonNull(secondRecordConsumer);
        Objects.requireNonNull(thirdRecordConsumer);
        return record -> {
            firstRecordConsumer.consume(record);
            secondRecordConsumer.consume(record);
            thirdRecordConsumer.consume(record);
        };
    }

    void consume(T record) throws UncheckedConsumerException;

    default Consumer<T> asConsumer() {
        return this::consume;
    }

    default RecordConsumer<T> andThen(RecordConsumer<? super T> afterRecordConsumer) {
        Objects.requireNonNull(afterRecordConsumer);
        return record -> {
            consume(record);
            afterRecordConsumer.consume(record);
        };
    }

}