private Amazon.PinpointEmail.Model.UpdateConfigurationSetEventDestinationResponse CallAWSServiceOperation(IAmazonPinpointEmail client, Amazon.PinpointEmail.Model.UpdateConfigurationSetEventDestinationRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Pinpoint Email", "UpdateConfigurationSetEventDestination");
     try
     {
         #if DESKTOP
         return(client.UpdateConfigurationSetEventDestination(request));
         #elif CORECLR
         return(client.UpdateConfigurationSetEventDestinationAsync(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.PinpointEmail.Model.UpdateConfigurationSetEventDestinationRequest();

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

            // populate EventDestination
            var requestEventDestinationIsNull = true;

            request.EventDestination = new Amazon.PinpointEmail.Model.EventDestinationDefinition();
            System.Boolean?requestEventDestination_eventDestination_Enabled = null;
            if (cmdletContext.EventDestination_Enabled != null)
            {
                requestEventDestination_eventDestination_Enabled = cmdletContext.EventDestination_Enabled.Value;
            }
            if (requestEventDestination_eventDestination_Enabled != null)
            {
                request.EventDestination.Enabled = requestEventDestination_eventDestination_Enabled.Value;
                requestEventDestinationIsNull    = false;
            }
            List <System.String> requestEventDestination_eventDestination_MatchingEventType = null;

            if (cmdletContext.EventDestination_MatchingEventType != null)
            {
                requestEventDestination_eventDestination_MatchingEventType = cmdletContext.EventDestination_MatchingEventType;
            }
            if (requestEventDestination_eventDestination_MatchingEventType != null)
            {
                request.EventDestination.MatchingEventTypes = requestEventDestination_eventDestination_MatchingEventType;
                requestEventDestinationIsNull = false;
            }
            Amazon.PinpointEmail.Model.CloudWatchDestination requestEventDestination_eventDestination_CloudWatchDestination = null;

            // populate CloudWatchDestination
            var requestEventDestination_eventDestination_CloudWatchDestinationIsNull = true;

            requestEventDestination_eventDestination_CloudWatchDestination = new Amazon.PinpointEmail.Model.CloudWatchDestination();
            List <Amazon.PinpointEmail.Model.CloudWatchDimensionConfiguration> requestEventDestination_eventDestination_CloudWatchDestination_cloudWatchDestination_DimensionConfiguration = null;

            if (cmdletContext.CloudWatchDestination_DimensionConfiguration != null)
            {
                requestEventDestination_eventDestination_CloudWatchDestination_cloudWatchDestination_DimensionConfiguration = cmdletContext.CloudWatchDestination_DimensionConfiguration;
            }
            if (requestEventDestination_eventDestination_CloudWatchDestination_cloudWatchDestination_DimensionConfiguration != null)
            {
                requestEventDestination_eventDestination_CloudWatchDestination.DimensionConfigurations = requestEventDestination_eventDestination_CloudWatchDestination_cloudWatchDestination_DimensionConfiguration;
                requestEventDestination_eventDestination_CloudWatchDestinationIsNull = false;
            }
            // determine if requestEventDestination_eventDestination_CloudWatchDestination should be set to null
            if (requestEventDestination_eventDestination_CloudWatchDestinationIsNull)
            {
                requestEventDestination_eventDestination_CloudWatchDestination = null;
            }
            if (requestEventDestination_eventDestination_CloudWatchDestination != null)
            {
                request.EventDestination.CloudWatchDestination = requestEventDestination_eventDestination_CloudWatchDestination;
                requestEventDestinationIsNull = false;
            }
            Amazon.PinpointEmail.Model.PinpointDestination requestEventDestination_eventDestination_PinpointDestination = null;

            // populate PinpointDestination
            var requestEventDestination_eventDestination_PinpointDestinationIsNull = true;

            requestEventDestination_eventDestination_PinpointDestination = new Amazon.PinpointEmail.Model.PinpointDestination();
            System.String requestEventDestination_eventDestination_PinpointDestination_pinpointDestination_ApplicationArn = null;
            if (cmdletContext.PinpointDestination_ApplicationArn != null)
            {
                requestEventDestination_eventDestination_PinpointDestination_pinpointDestination_ApplicationArn = cmdletContext.PinpointDestination_ApplicationArn;
            }
            if (requestEventDestination_eventDestination_PinpointDestination_pinpointDestination_ApplicationArn != null)
            {
                requestEventDestination_eventDestination_PinpointDestination.ApplicationArn = requestEventDestination_eventDestination_PinpointDestination_pinpointDestination_ApplicationArn;
                requestEventDestination_eventDestination_PinpointDestinationIsNull          = false;
            }
            // determine if requestEventDestination_eventDestination_PinpointDestination should be set to null
            if (requestEventDestination_eventDestination_PinpointDestinationIsNull)
            {
                requestEventDestination_eventDestination_PinpointDestination = null;
            }
            if (requestEventDestination_eventDestination_PinpointDestination != null)
            {
                request.EventDestination.PinpointDestination = requestEventDestination_eventDestination_PinpointDestination;
                requestEventDestinationIsNull = false;
            }
            Amazon.PinpointEmail.Model.SnsDestination requestEventDestination_eventDestination_SnsDestination = null;

            // populate SnsDestination
            var requestEventDestination_eventDestination_SnsDestinationIsNull = true;

            requestEventDestination_eventDestination_SnsDestination = new Amazon.PinpointEmail.Model.SnsDestination();
            System.String requestEventDestination_eventDestination_SnsDestination_snsDestination_TopicArn = null;
            if (cmdletContext.SnsDestination_TopicArn != null)
            {
                requestEventDestination_eventDestination_SnsDestination_snsDestination_TopicArn = cmdletContext.SnsDestination_TopicArn;
            }
            if (requestEventDestination_eventDestination_SnsDestination_snsDestination_TopicArn != null)
            {
                requestEventDestination_eventDestination_SnsDestination.TopicArn = requestEventDestination_eventDestination_SnsDestination_snsDestination_TopicArn;
                requestEventDestination_eventDestination_SnsDestinationIsNull    = false;
            }
            // determine if requestEventDestination_eventDestination_SnsDestination should be set to null
            if (requestEventDestination_eventDestination_SnsDestinationIsNull)
            {
                requestEventDestination_eventDestination_SnsDestination = null;
            }
            if (requestEventDestination_eventDestination_SnsDestination != null)
            {
                request.EventDestination.SnsDestination = requestEventDestination_eventDestination_SnsDestination;
                requestEventDestinationIsNull           = false;
            }
            Amazon.PinpointEmail.Model.KinesisFirehoseDestination requestEventDestination_eventDestination_KinesisFirehoseDestination = null;

            // populate KinesisFirehoseDestination
            var requestEventDestination_eventDestination_KinesisFirehoseDestinationIsNull = true;

            requestEventDestination_eventDestination_KinesisFirehoseDestination = new Amazon.PinpointEmail.Model.KinesisFirehoseDestination();
            System.String requestEventDestination_eventDestination_KinesisFirehoseDestination_kinesisFirehoseDestination_DeliveryStreamArn = null;
            if (cmdletContext.KinesisFirehoseDestination_DeliveryStreamArn != null)
            {
                requestEventDestination_eventDestination_KinesisFirehoseDestination_kinesisFirehoseDestination_DeliveryStreamArn = cmdletContext.KinesisFirehoseDestination_DeliveryStreamArn;
            }
            if (requestEventDestination_eventDestination_KinesisFirehoseDestination_kinesisFirehoseDestination_DeliveryStreamArn != null)
            {
                requestEventDestination_eventDestination_KinesisFirehoseDestination.DeliveryStreamArn = requestEventDestination_eventDestination_KinesisFirehoseDestination_kinesisFirehoseDestination_DeliveryStreamArn;
                requestEventDestination_eventDestination_KinesisFirehoseDestinationIsNull             = false;
            }
            System.String requestEventDestination_eventDestination_KinesisFirehoseDestination_kinesisFirehoseDestination_IamRoleArn = null;
            if (cmdletContext.KinesisFirehoseDestination_IamRoleArn != null)
            {
                requestEventDestination_eventDestination_KinesisFirehoseDestination_kinesisFirehoseDestination_IamRoleArn = cmdletContext.KinesisFirehoseDestination_IamRoleArn;
            }
            if (requestEventDestination_eventDestination_KinesisFirehoseDestination_kinesisFirehoseDestination_IamRoleArn != null)
            {
                requestEventDestination_eventDestination_KinesisFirehoseDestination.IamRoleArn = requestEventDestination_eventDestination_KinesisFirehoseDestination_kinesisFirehoseDestination_IamRoleArn;
                requestEventDestination_eventDestination_KinesisFirehoseDestinationIsNull      = false;
            }
            // determine if requestEventDestination_eventDestination_KinesisFirehoseDestination should be set to null
            if (requestEventDestination_eventDestination_KinesisFirehoseDestinationIsNull)
            {
                requestEventDestination_eventDestination_KinesisFirehoseDestination = null;
            }
            if (requestEventDestination_eventDestination_KinesisFirehoseDestination != null)
            {
                request.EventDestination.KinesisFirehoseDestination = requestEventDestination_eventDestination_KinesisFirehoseDestination;
                requestEventDestinationIsNull = false;
            }
            // determine if request.EventDestination should be set to null
            if (requestEventDestinationIsNull)
            {
                request.EventDestination = null;
            }
            if (cmdletContext.EventDestinationName != null)
            {
                request.EventDestinationName = cmdletContext.EventDestinationName;
            }

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