private Amazon.Polly.Model.StartSpeechSynthesisTaskResponse CallAWSServiceOperation(IAmazonPolly client, Amazon.Polly.Model.StartSpeechSynthesisTaskRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Polly", "StartSpeechSynthesisTask"); try { #if DESKTOP return(client.StartSpeechSynthesisTask(request)); #elif CORECLR return(client.StartSpeechSynthesisTaskAsync(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.Polly.Model.StartSpeechSynthesisTaskRequest(); if (cmdletContext.Engine != null) { request.Engine = cmdletContext.Engine; } if (cmdletContext.LanguageCode != null) { request.LanguageCode = cmdletContext.LanguageCode; } if (cmdletContext.LexiconName != null) { request.LexiconNames = cmdletContext.LexiconName; } if (cmdletContext.OutputFormat != null) { request.OutputFormat = cmdletContext.OutputFormat; } if (cmdletContext.OutputS3BucketName != null) { request.OutputS3BucketName = cmdletContext.OutputS3BucketName; } if (cmdletContext.OutputS3KeyPrefix != null) { request.OutputS3KeyPrefix = cmdletContext.OutputS3KeyPrefix; } if (cmdletContext.SampleRate != null) { request.SampleRate = cmdletContext.SampleRate; } if (cmdletContext.SnsTopicArn != null) { request.SnsTopicArn = cmdletContext.SnsTopicArn; } if (cmdletContext.SpeechMarkType != null) { request.SpeechMarkTypes = cmdletContext.SpeechMarkType; } if (cmdletContext.Text != null) { request.Text = cmdletContext.Text; } if (cmdletContext.TextType != null) { request.TextType = cmdletContext.TextType; } if (cmdletContext.VoiceId != null) { request.VoiceId = cmdletContext.VoiceId; } 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); }