private Amazon.CloudFront.Model.UpdateOriginRequestPolicyResponse CallAWSServiceOperation(IAmazonCloudFront client, Amazon.CloudFront.Model.UpdateOriginRequestPolicyRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon CloudFront", "UpdateOriginRequestPolicy");
     try
     {
         #if DESKTOP
         return(client.UpdateOriginRequestPolicy(request));
         #elif CORECLR
         return(client.UpdateOriginRequestPolicyAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.CloudFront.Model.UpdateOriginRequestPolicyRequest();

            if (cmdletContext.Id != null)
            {
                request.Id = cmdletContext.Id;
            }
            if (cmdletContext.IfMatch != null)
            {
                request.IfMatch = cmdletContext.IfMatch;
            }

            // populate OriginRequestPolicyConfig
            var requestOriginRequestPolicyConfigIsNull = true;

            request.OriginRequestPolicyConfig = new Amazon.CloudFront.Model.OriginRequestPolicyConfig();
            System.String requestOriginRequestPolicyConfig_originRequestPolicyConfig_Comment = null;
            if (cmdletContext.OriginRequestPolicyConfig_Comment != null)
            {
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_Comment = cmdletContext.OriginRequestPolicyConfig_Comment;
            }
            if (requestOriginRequestPolicyConfig_originRequestPolicyConfig_Comment != null)
            {
                request.OriginRequestPolicyConfig.Comment = requestOriginRequestPolicyConfig_originRequestPolicyConfig_Comment;
                requestOriginRequestPolicyConfigIsNull    = false;
            }
            System.String requestOriginRequestPolicyConfig_originRequestPolicyConfig_Name = null;
            if (cmdletContext.OriginRequestPolicyConfig_Name != null)
            {
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_Name = cmdletContext.OriginRequestPolicyConfig_Name;
            }
            if (requestOriginRequestPolicyConfig_originRequestPolicyConfig_Name != null)
            {
                request.OriginRequestPolicyConfig.Name = requestOriginRequestPolicyConfig_originRequestPolicyConfig_Name;
                requestOriginRequestPolicyConfigIsNull = false;
            }
            Amazon.CloudFront.Model.OriginRequestPolicyCookiesConfig requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig = null;

            // populate CookiesConfig
            var requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfigIsNull = true;

            requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig = new Amazon.CloudFront.Model.OriginRequestPolicyCookiesConfig();
            Amazon.CloudFront.OriginRequestPolicyCookieBehavior requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig_cookiesConfig_CookieBehavior = null;
            if (cmdletContext.CookiesConfig_CookieBehavior != null)
            {
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig_cookiesConfig_CookieBehavior = cmdletContext.CookiesConfig_CookieBehavior;
            }
            if (requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig_cookiesConfig_CookieBehavior != null)
            {
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig.CookieBehavior = requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig_cookiesConfig_CookieBehavior;
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfigIsNull          = false;
            }
            Amazon.CloudFront.Model.CookieNames requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig_originRequestPolicyConfig_CookiesConfig_Cookies = null;

            // populate Cookies
            var requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig_originRequestPolicyConfig_CookiesConfig_CookiesIsNull = true;

            requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig_originRequestPolicyConfig_CookiesConfig_Cookies = new Amazon.CloudFront.Model.CookieNames();
            List <System.String> requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig_originRequestPolicyConfig_CookiesConfig_Cookies_cookies_Item = null;

            if (cmdletContext.Cookies_Item != null)
            {
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig_originRequestPolicyConfig_CookiesConfig_Cookies_cookies_Item = cmdletContext.Cookies_Item;
            }
            if (requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig_originRequestPolicyConfig_CookiesConfig_Cookies_cookies_Item != null)
            {
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig_originRequestPolicyConfig_CookiesConfig_Cookies.Items = requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig_originRequestPolicyConfig_CookiesConfig_Cookies_cookies_Item;
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig_originRequestPolicyConfig_CookiesConfig_CookiesIsNull = false;
            }
            System.Int32?requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig_originRequestPolicyConfig_CookiesConfig_Cookies_cookies_Quantity = null;
            if (cmdletContext.Cookies_Quantity != null)
            {
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig_originRequestPolicyConfig_CookiesConfig_Cookies_cookies_Quantity = cmdletContext.Cookies_Quantity.Value;
            }
            if (requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig_originRequestPolicyConfig_CookiesConfig_Cookies_cookies_Quantity != null)
            {
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig_originRequestPolicyConfig_CookiesConfig_Cookies.Quantity = requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig_originRequestPolicyConfig_CookiesConfig_Cookies_cookies_Quantity.Value;
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig_originRequestPolicyConfig_CookiesConfig_CookiesIsNull    = false;
            }
            // determine if requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig_originRequestPolicyConfig_CookiesConfig_Cookies should be set to null
            if (requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig_originRequestPolicyConfig_CookiesConfig_CookiesIsNull)
            {
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig_originRequestPolicyConfig_CookiesConfig_Cookies = null;
            }
            if (requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig_originRequestPolicyConfig_CookiesConfig_Cookies != null)
            {
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig.Cookies = requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig_originRequestPolicyConfig_CookiesConfig_Cookies;
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfigIsNull   = false;
            }
            // determine if requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig should be set to null
            if (requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfigIsNull)
            {
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig = null;
            }
            if (requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig != null)
            {
                request.OriginRequestPolicyConfig.CookiesConfig = requestOriginRequestPolicyConfig_originRequestPolicyConfig_CookiesConfig;
                requestOriginRequestPolicyConfigIsNull          = false;
            }
            Amazon.CloudFront.Model.OriginRequestPolicyHeadersConfig requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig = null;

            // populate HeadersConfig
            var requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfigIsNull = true;

            requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig = new Amazon.CloudFront.Model.OriginRequestPolicyHeadersConfig();
            Amazon.CloudFront.OriginRequestPolicyHeaderBehavior requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig_headersConfig_HeaderBehavior = null;
            if (cmdletContext.HeadersConfig_HeaderBehavior != null)
            {
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig_headersConfig_HeaderBehavior = cmdletContext.HeadersConfig_HeaderBehavior;
            }
            if (requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig_headersConfig_HeaderBehavior != null)
            {
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig.HeaderBehavior = requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig_headersConfig_HeaderBehavior;
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfigIsNull          = false;
            }
            Amazon.CloudFront.Model.Headers requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig_originRequestPolicyConfig_HeadersConfig_Headers = null;

            // populate Headers
            var requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig_originRequestPolicyConfig_HeadersConfig_HeadersIsNull = true;

            requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig_originRequestPolicyConfig_HeadersConfig_Headers = new Amazon.CloudFront.Model.Headers();
            List <System.String> requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig_originRequestPolicyConfig_HeadersConfig_Headers_headers_Item = null;

            if (cmdletContext.Headers_Item != null)
            {
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig_originRequestPolicyConfig_HeadersConfig_Headers_headers_Item = cmdletContext.Headers_Item;
            }
            if (requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig_originRequestPolicyConfig_HeadersConfig_Headers_headers_Item != null)
            {
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig_originRequestPolicyConfig_HeadersConfig_Headers.Items = requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig_originRequestPolicyConfig_HeadersConfig_Headers_headers_Item;
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig_originRequestPolicyConfig_HeadersConfig_HeadersIsNull = false;
            }
            System.Int32?requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig_originRequestPolicyConfig_HeadersConfig_Headers_headers_Quantity = null;
            if (cmdletContext.Headers_Quantity != null)
            {
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig_originRequestPolicyConfig_HeadersConfig_Headers_headers_Quantity = cmdletContext.Headers_Quantity.Value;
            }
            if (requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig_originRequestPolicyConfig_HeadersConfig_Headers_headers_Quantity != null)
            {
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig_originRequestPolicyConfig_HeadersConfig_Headers.Quantity = requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig_originRequestPolicyConfig_HeadersConfig_Headers_headers_Quantity.Value;
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig_originRequestPolicyConfig_HeadersConfig_HeadersIsNull    = false;
            }
            // determine if requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig_originRequestPolicyConfig_HeadersConfig_Headers should be set to null
            if (requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig_originRequestPolicyConfig_HeadersConfig_HeadersIsNull)
            {
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig_originRequestPolicyConfig_HeadersConfig_Headers = null;
            }
            if (requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig_originRequestPolicyConfig_HeadersConfig_Headers != null)
            {
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig.Headers = requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig_originRequestPolicyConfig_HeadersConfig_Headers;
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfigIsNull   = false;
            }
            // determine if requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig should be set to null
            if (requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfigIsNull)
            {
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig = null;
            }
            if (requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig != null)
            {
                request.OriginRequestPolicyConfig.HeadersConfig = requestOriginRequestPolicyConfig_originRequestPolicyConfig_HeadersConfig;
                requestOriginRequestPolicyConfigIsNull          = false;
            }
            Amazon.CloudFront.Model.OriginRequestPolicyQueryStringsConfig requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig = null;

            // populate QueryStringsConfig
            var requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfigIsNull = true;

            requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig = new Amazon.CloudFront.Model.OriginRequestPolicyQueryStringsConfig();
            Amazon.CloudFront.OriginRequestPolicyQueryStringBehavior requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig_queryStringsConfig_QueryStringBehavior = null;
            if (cmdletContext.QueryStringsConfig_QueryStringBehavior != null)
            {
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig_queryStringsConfig_QueryStringBehavior = cmdletContext.QueryStringsConfig_QueryStringBehavior;
            }
            if (requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig_queryStringsConfig_QueryStringBehavior != null)
            {
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig.QueryStringBehavior = requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig_queryStringsConfig_QueryStringBehavior;
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfigIsNull = false;
            }
            Amazon.CloudFront.Model.QueryStringNames requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig_originRequestPolicyConfig_QueryStringsConfig_QueryStrings = null;

            // populate QueryStrings
            var requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig_originRequestPolicyConfig_QueryStringsConfig_QueryStringsIsNull = true;

            requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig_originRequestPolicyConfig_QueryStringsConfig_QueryStrings = new Amazon.CloudFront.Model.QueryStringNames();
            List <System.String> requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig_originRequestPolicyConfig_QueryStringsConfig_QueryStrings_queryStrings_Item = null;

            if (cmdletContext.QueryStrings_Item != null)
            {
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig_originRequestPolicyConfig_QueryStringsConfig_QueryStrings_queryStrings_Item = cmdletContext.QueryStrings_Item;
            }
            if (requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig_originRequestPolicyConfig_QueryStringsConfig_QueryStrings_queryStrings_Item != null)
            {
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig_originRequestPolicyConfig_QueryStringsConfig_QueryStrings.Items = requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig_originRequestPolicyConfig_QueryStringsConfig_QueryStrings_queryStrings_Item;
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig_originRequestPolicyConfig_QueryStringsConfig_QueryStringsIsNull = false;
            }
            System.Int32?requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig_originRequestPolicyConfig_QueryStringsConfig_QueryStrings_queryStrings_Quantity = null;
            if (cmdletContext.QueryStrings_Quantity != null)
            {
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig_originRequestPolicyConfig_QueryStringsConfig_QueryStrings_queryStrings_Quantity = cmdletContext.QueryStrings_Quantity.Value;
            }
            if (requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig_originRequestPolicyConfig_QueryStringsConfig_QueryStrings_queryStrings_Quantity != null)
            {
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig_originRequestPolicyConfig_QueryStringsConfig_QueryStrings.Quantity = requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig_originRequestPolicyConfig_QueryStringsConfig_QueryStrings_queryStrings_Quantity.Value;
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig_originRequestPolicyConfig_QueryStringsConfig_QueryStringsIsNull    = false;
            }
            // determine if requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig_originRequestPolicyConfig_QueryStringsConfig_QueryStrings should be set to null
            if (requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig_originRequestPolicyConfig_QueryStringsConfig_QueryStringsIsNull)
            {
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig_originRequestPolicyConfig_QueryStringsConfig_QueryStrings = null;
            }
            if (requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig_originRequestPolicyConfig_QueryStringsConfig_QueryStrings != null)
            {
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig.QueryStrings = requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig_originRequestPolicyConfig_QueryStringsConfig_QueryStrings;
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfigIsNull        = false;
            }
            // determine if requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig should be set to null
            if (requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfigIsNull)
            {
                requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig = null;
            }
            if (requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig != null)
            {
                request.OriginRequestPolicyConfig.QueryStringsConfig = requestOriginRequestPolicyConfig_originRequestPolicyConfig_QueryStringsConfig;
                requestOriginRequestPolicyConfigIsNull = false;
            }
            // determine if request.OriginRequestPolicyConfig should be set to null
            if (requestOriginRequestPolicyConfigIsNull)
            {
                request.OriginRequestPolicyConfig = null;
            }

            CmdletOutput output;

            // issue call
            var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);

            try
            {
                var    response       = CallAWSServiceOperation(client, request);
                object pipelineOutput = null;
                pipelineOutput = cmdletContext.Select(response, this);
                output         = new CmdletOutput
                {
                    PipelineOutput  = pipelineOutput,
                    ServiceResponse = response
                };
            }
            catch (Exception e)
            {
                output = new CmdletOutput {
                    ErrorResponse = e
                };
            }

            return(output);
        }