private Amazon.IoT.Model.CreateTopicRuleDestinationResponse CallAWSServiceOperation(IAmazonIoT client, Amazon.IoT.Model.CreateTopicRuleDestinationRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS IoT", "CreateTopicRuleDestination");
     try
     {
         #if DESKTOP
         return(client.CreateTopicRuleDestination(request));
         #elif CORECLR
         return(client.CreateTopicRuleDestinationAsync(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.IoT.Model.CreateTopicRuleDestinationRequest();


            // populate DestinationConfiguration
            var requestDestinationConfigurationIsNull = true;

            request.DestinationConfiguration = new Amazon.IoT.Model.TopicRuleDestinationConfiguration();
            Amazon.IoT.Model.HttpUrlDestinationConfiguration requestDestinationConfiguration_destinationConfiguration_HttpUrlConfiguration = null;

            // populate HttpUrlConfiguration
            var requestDestinationConfiguration_destinationConfiguration_HttpUrlConfigurationIsNull = true;

            requestDestinationConfiguration_destinationConfiguration_HttpUrlConfiguration = new Amazon.IoT.Model.HttpUrlDestinationConfiguration();
            System.String requestDestinationConfiguration_destinationConfiguration_HttpUrlConfiguration_httpUrlConfiguration_ConfirmationUrl = null;
            if (cmdletContext.HttpUrlConfiguration_ConfirmationUrl != null)
            {
                requestDestinationConfiguration_destinationConfiguration_HttpUrlConfiguration_httpUrlConfiguration_ConfirmationUrl = cmdletContext.HttpUrlConfiguration_ConfirmationUrl;
            }
            if (requestDestinationConfiguration_destinationConfiguration_HttpUrlConfiguration_httpUrlConfiguration_ConfirmationUrl != null)
            {
                requestDestinationConfiguration_destinationConfiguration_HttpUrlConfiguration.ConfirmationUrl = requestDestinationConfiguration_destinationConfiguration_HttpUrlConfiguration_httpUrlConfiguration_ConfirmationUrl;
                requestDestinationConfiguration_destinationConfiguration_HttpUrlConfigurationIsNull           = false;
            }
            // determine if requestDestinationConfiguration_destinationConfiguration_HttpUrlConfiguration should be set to null
            if (requestDestinationConfiguration_destinationConfiguration_HttpUrlConfigurationIsNull)
            {
                requestDestinationConfiguration_destinationConfiguration_HttpUrlConfiguration = null;
            }
            if (requestDestinationConfiguration_destinationConfiguration_HttpUrlConfiguration != null)
            {
                request.DestinationConfiguration.HttpUrlConfiguration = requestDestinationConfiguration_destinationConfiguration_HttpUrlConfiguration;
                requestDestinationConfigurationIsNull = false;
            }
            Amazon.IoT.Model.VpcDestinationConfiguration requestDestinationConfiguration_destinationConfiguration_VpcConfiguration = null;

            // populate VpcConfiguration
            var requestDestinationConfiguration_destinationConfiguration_VpcConfigurationIsNull = true;

            requestDestinationConfiguration_destinationConfiguration_VpcConfiguration = new Amazon.IoT.Model.VpcDestinationConfiguration();
            System.String requestDestinationConfiguration_destinationConfiguration_VpcConfiguration_vpcConfiguration_RoleArn = null;
            if (cmdletContext.VpcConfiguration_RoleArn != null)
            {
                requestDestinationConfiguration_destinationConfiguration_VpcConfiguration_vpcConfiguration_RoleArn = cmdletContext.VpcConfiguration_RoleArn;
            }
            if (requestDestinationConfiguration_destinationConfiguration_VpcConfiguration_vpcConfiguration_RoleArn != null)
            {
                requestDestinationConfiguration_destinationConfiguration_VpcConfiguration.RoleArn = requestDestinationConfiguration_destinationConfiguration_VpcConfiguration_vpcConfiguration_RoleArn;
                requestDestinationConfiguration_destinationConfiguration_VpcConfigurationIsNull   = false;
            }
            List <System.String> requestDestinationConfiguration_destinationConfiguration_VpcConfiguration_vpcConfiguration_SecurityGroup = null;

            if (cmdletContext.VpcConfiguration_SecurityGroup != null)
            {
                requestDestinationConfiguration_destinationConfiguration_VpcConfiguration_vpcConfiguration_SecurityGroup = cmdletContext.VpcConfiguration_SecurityGroup;
            }
            if (requestDestinationConfiguration_destinationConfiguration_VpcConfiguration_vpcConfiguration_SecurityGroup != null)
            {
                requestDestinationConfiguration_destinationConfiguration_VpcConfiguration.SecurityGroups = requestDestinationConfiguration_destinationConfiguration_VpcConfiguration_vpcConfiguration_SecurityGroup;
                requestDestinationConfiguration_destinationConfiguration_VpcConfigurationIsNull          = false;
            }
            List <System.String> requestDestinationConfiguration_destinationConfiguration_VpcConfiguration_vpcConfiguration_SubnetId = null;

            if (cmdletContext.VpcConfiguration_SubnetId != null)
            {
                requestDestinationConfiguration_destinationConfiguration_VpcConfiguration_vpcConfiguration_SubnetId = cmdletContext.VpcConfiguration_SubnetId;
            }
            if (requestDestinationConfiguration_destinationConfiguration_VpcConfiguration_vpcConfiguration_SubnetId != null)
            {
                requestDestinationConfiguration_destinationConfiguration_VpcConfiguration.SubnetIds = requestDestinationConfiguration_destinationConfiguration_VpcConfiguration_vpcConfiguration_SubnetId;
                requestDestinationConfiguration_destinationConfiguration_VpcConfigurationIsNull     = false;
            }
            System.String requestDestinationConfiguration_destinationConfiguration_VpcConfiguration_vpcConfiguration_VpcId = null;
            if (cmdletContext.VpcConfiguration_VpcId != null)
            {
                requestDestinationConfiguration_destinationConfiguration_VpcConfiguration_vpcConfiguration_VpcId = cmdletContext.VpcConfiguration_VpcId;
            }
            if (requestDestinationConfiguration_destinationConfiguration_VpcConfiguration_vpcConfiguration_VpcId != null)
            {
                requestDestinationConfiguration_destinationConfiguration_VpcConfiguration.VpcId = requestDestinationConfiguration_destinationConfiguration_VpcConfiguration_vpcConfiguration_VpcId;
                requestDestinationConfiguration_destinationConfiguration_VpcConfigurationIsNull = false;
            }
            // determine if requestDestinationConfiguration_destinationConfiguration_VpcConfiguration should be set to null
            if (requestDestinationConfiguration_destinationConfiguration_VpcConfigurationIsNull)
            {
                requestDestinationConfiguration_destinationConfiguration_VpcConfiguration = null;
            }
            if (requestDestinationConfiguration_destinationConfiguration_VpcConfiguration != null)
            {
                request.DestinationConfiguration.VpcConfiguration = requestDestinationConfiguration_destinationConfiguration_VpcConfiguration;
                requestDestinationConfigurationIsNull             = false;
            }
            // determine if request.DestinationConfiguration should be set to null
            if (requestDestinationConfigurationIsNull)
            {
                request.DestinationConfiguration = 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);
        }