private Amazon.XRay.Model.CreateSamplingRuleResponse CallAWSServiceOperation(IAmazonXRay client, Amazon.XRay.Model.CreateSamplingRuleRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS X-Ray", "CreateSamplingRule");
     try
     {
         #if DESKTOP
         return(client.CreateSamplingRule(request));
         #elif CORECLR
         return(client.CreateSamplingRuleAsync(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.XRay.Model.CreateSamplingRuleRequest();


            // populate SamplingRule
            var requestSamplingRuleIsNull = true;

            request.SamplingRule = new Amazon.XRay.Model.SamplingRule();
            Dictionary <System.String, System.String> requestSamplingRule_samplingRule_Attribute = null;

            if (cmdletContext.SamplingRule_Attribute != null)
            {
                requestSamplingRule_samplingRule_Attribute = cmdletContext.SamplingRule_Attribute;
            }
            if (requestSamplingRule_samplingRule_Attribute != null)
            {
                request.SamplingRule.Attributes = requestSamplingRule_samplingRule_Attribute;
                requestSamplingRuleIsNull       = false;
            }
            System.Double?requestSamplingRule_samplingRule_FixedRate = null;
            if (cmdletContext.SamplingRule_FixedRate != null)
            {
                requestSamplingRule_samplingRule_FixedRate = cmdletContext.SamplingRule_FixedRate.Value;
            }
            if (requestSamplingRule_samplingRule_FixedRate != null)
            {
                request.SamplingRule.FixedRate = requestSamplingRule_samplingRule_FixedRate.Value;
                requestSamplingRuleIsNull      = false;
            }
            System.String requestSamplingRule_samplingRule_Host = null;
            if (cmdletContext.SamplingRule_Host != null)
            {
                requestSamplingRule_samplingRule_Host = cmdletContext.SamplingRule_Host;
            }
            if (requestSamplingRule_samplingRule_Host != null)
            {
                request.SamplingRule.Host = requestSamplingRule_samplingRule_Host;
                requestSamplingRuleIsNull = false;
            }
            System.String requestSamplingRule_samplingRule_HTTPMethod = null;
            if (cmdletContext.SamplingRule_HTTPMethod != null)
            {
                requestSamplingRule_samplingRule_HTTPMethod = cmdletContext.SamplingRule_HTTPMethod;
            }
            if (requestSamplingRule_samplingRule_HTTPMethod != null)
            {
                request.SamplingRule.HTTPMethod = requestSamplingRule_samplingRule_HTTPMethod;
                requestSamplingRuleIsNull       = false;
            }
            System.Int32?requestSamplingRule_samplingRule_Priority = null;
            if (cmdletContext.SamplingRule_Priority != null)
            {
                requestSamplingRule_samplingRule_Priority = cmdletContext.SamplingRule_Priority.Value;
            }
            if (requestSamplingRule_samplingRule_Priority != null)
            {
                request.SamplingRule.Priority = requestSamplingRule_samplingRule_Priority.Value;
                requestSamplingRuleIsNull     = false;
            }
            System.Int32?requestSamplingRule_samplingRule_ReservoirSize = null;
            if (cmdletContext.SamplingRule_ReservoirSize != null)
            {
                requestSamplingRule_samplingRule_ReservoirSize = cmdletContext.SamplingRule_ReservoirSize.Value;
            }
            if (requestSamplingRule_samplingRule_ReservoirSize != null)
            {
                request.SamplingRule.ReservoirSize = requestSamplingRule_samplingRule_ReservoirSize.Value;
                requestSamplingRuleIsNull          = false;
            }
            System.String requestSamplingRule_samplingRule_ResourceARN = null;
            if (cmdletContext.SamplingRule_ResourceARN != null)
            {
                requestSamplingRule_samplingRule_ResourceARN = cmdletContext.SamplingRule_ResourceARN;
            }
            if (requestSamplingRule_samplingRule_ResourceARN != null)
            {
                request.SamplingRule.ResourceARN = requestSamplingRule_samplingRule_ResourceARN;
                requestSamplingRuleIsNull        = false;
            }
            System.String requestSamplingRule_samplingRule_RuleARN = null;
            if (cmdletContext.SamplingRule_RuleARN != null)
            {
                requestSamplingRule_samplingRule_RuleARN = cmdletContext.SamplingRule_RuleARN;
            }
            if (requestSamplingRule_samplingRule_RuleARN != null)
            {
                request.SamplingRule.RuleARN = requestSamplingRule_samplingRule_RuleARN;
                requestSamplingRuleIsNull    = false;
            }
            System.String requestSamplingRule_samplingRule_RuleName = null;
            if (cmdletContext.SamplingRule_RuleName != null)
            {
                requestSamplingRule_samplingRule_RuleName = cmdletContext.SamplingRule_RuleName;
            }
            if (requestSamplingRule_samplingRule_RuleName != null)
            {
                request.SamplingRule.RuleName = requestSamplingRule_samplingRule_RuleName;
                requestSamplingRuleIsNull     = false;
            }
            System.String requestSamplingRule_samplingRule_ServiceName = null;
            if (cmdletContext.SamplingRule_ServiceName != null)
            {
                requestSamplingRule_samplingRule_ServiceName = cmdletContext.SamplingRule_ServiceName;
            }
            if (requestSamplingRule_samplingRule_ServiceName != null)
            {
                request.SamplingRule.ServiceName = requestSamplingRule_samplingRule_ServiceName;
                requestSamplingRuleIsNull        = false;
            }
            System.String requestSamplingRule_samplingRule_ServiceType = null;
            if (cmdletContext.SamplingRule_ServiceType != null)
            {
                requestSamplingRule_samplingRule_ServiceType = cmdletContext.SamplingRule_ServiceType;
            }
            if (requestSamplingRule_samplingRule_ServiceType != null)
            {
                request.SamplingRule.ServiceType = requestSamplingRule_samplingRule_ServiceType;
                requestSamplingRuleIsNull        = false;
            }
            System.String requestSamplingRule_samplingRule_URLPath = null;
            if (cmdletContext.SamplingRule_URLPath != null)
            {
                requestSamplingRule_samplingRule_URLPath = cmdletContext.SamplingRule_URLPath;
            }
            if (requestSamplingRule_samplingRule_URLPath != null)
            {
                request.SamplingRule.URLPath = requestSamplingRule_samplingRule_URLPath;
                requestSamplingRuleIsNull    = false;
            }
            System.Int32?requestSamplingRule_samplingRule_Version = null;
            if (cmdletContext.SamplingRule_Version != null)
            {
                requestSamplingRule_samplingRule_Version = cmdletContext.SamplingRule_Version.Value;
            }
            if (requestSamplingRule_samplingRule_Version != null)
            {
                request.SamplingRule.Version = requestSamplingRule_samplingRule_Version.Value;
                requestSamplingRuleIsNull    = false;
            }
            // determine if request.SamplingRule should be set to null
            if (requestSamplingRuleIsNull)
            {
                request.SamplingRule = null;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }

            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);
        }