private Amazon.Pinpoint.Model.CreateVoiceTemplateResponse CallAWSServiceOperation(IAmazonPinpoint client, Amazon.Pinpoint.Model.CreateVoiceTemplateRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Pinpoint", "CreateVoiceTemplate");
     try
     {
         #if DESKTOP
         return(client.CreateVoiceTemplate(request));
         #elif CORECLR
         return(client.CreateVoiceTemplateAsync(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.Pinpoint.Model.CreateVoiceTemplateRequest();

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

            // populate VoiceTemplateRequest
            var requestVoiceTemplateRequestIsNull = true;

            request.VoiceTemplateRequest = new Amazon.Pinpoint.Model.VoiceTemplateRequest();
            System.String requestVoiceTemplateRequest_voiceTemplateRequest_Body = null;
            if (cmdletContext.VoiceTemplateRequest_Body != null)
            {
                requestVoiceTemplateRequest_voiceTemplateRequest_Body = cmdletContext.VoiceTemplateRequest_Body;
            }
            if (requestVoiceTemplateRequest_voiceTemplateRequest_Body != null)
            {
                request.VoiceTemplateRequest.Body = requestVoiceTemplateRequest_voiceTemplateRequest_Body;
                requestVoiceTemplateRequestIsNull = false;
            }
            System.String requestVoiceTemplateRequest_voiceTemplateRequest_DefaultSubstitution = null;
            if (cmdletContext.VoiceTemplateRequest_DefaultSubstitution != null)
            {
                requestVoiceTemplateRequest_voiceTemplateRequest_DefaultSubstitution = cmdletContext.VoiceTemplateRequest_DefaultSubstitution;
            }
            if (requestVoiceTemplateRequest_voiceTemplateRequest_DefaultSubstitution != null)
            {
                request.VoiceTemplateRequest.DefaultSubstitutions = requestVoiceTemplateRequest_voiceTemplateRequest_DefaultSubstitution;
                requestVoiceTemplateRequestIsNull = false;
            }
            System.String requestVoiceTemplateRequest_voiceTemplateRequest_LanguageCode = null;
            if (cmdletContext.VoiceTemplateRequest_LanguageCode != null)
            {
                requestVoiceTemplateRequest_voiceTemplateRequest_LanguageCode = cmdletContext.VoiceTemplateRequest_LanguageCode;
            }
            if (requestVoiceTemplateRequest_voiceTemplateRequest_LanguageCode != null)
            {
                request.VoiceTemplateRequest.LanguageCode = requestVoiceTemplateRequest_voiceTemplateRequest_LanguageCode;
                requestVoiceTemplateRequestIsNull         = false;
            }
            Dictionary <System.String, System.String> requestVoiceTemplateRequest_voiceTemplateRequest_Tag = null;

            if (cmdletContext.VoiceTemplateRequest_Tag != null)
            {
                requestVoiceTemplateRequest_voiceTemplateRequest_Tag = cmdletContext.VoiceTemplateRequest_Tag;
            }
            if (requestVoiceTemplateRequest_voiceTemplateRequest_Tag != null)
            {
                request.VoiceTemplateRequest.Tags = requestVoiceTemplateRequest_voiceTemplateRequest_Tag;
                requestVoiceTemplateRequestIsNull = false;
            }
            System.String requestVoiceTemplateRequest_voiceTemplateRequest_TemplateDescription = null;
            if (cmdletContext.VoiceTemplateRequest_TemplateDescription != null)
            {
                requestVoiceTemplateRequest_voiceTemplateRequest_TemplateDescription = cmdletContext.VoiceTemplateRequest_TemplateDescription;
            }
            if (requestVoiceTemplateRequest_voiceTemplateRequest_TemplateDescription != null)
            {
                request.VoiceTemplateRequest.TemplateDescription = requestVoiceTemplateRequest_voiceTemplateRequest_TemplateDescription;
                requestVoiceTemplateRequestIsNull = false;
            }
            System.String requestVoiceTemplateRequest_voiceTemplateRequest_VoiceId = null;
            if (cmdletContext.VoiceTemplateRequest_VoiceId != null)
            {
                requestVoiceTemplateRequest_voiceTemplateRequest_VoiceId = cmdletContext.VoiceTemplateRequest_VoiceId;
            }
            if (requestVoiceTemplateRequest_voiceTemplateRequest_VoiceId != null)
            {
                request.VoiceTemplateRequest.VoiceId = requestVoiceTemplateRequest_voiceTemplateRequest_VoiceId;
                requestVoiceTemplateRequestIsNull    = false;
            }
            // determine if request.VoiceTemplateRequest should be set to null
            if (requestVoiceTemplateRequestIsNull)
            {
                request.VoiceTemplateRequest = 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);
        }