Upgrade AWS SDK to the latest version

This commit is contained in:
Andrey Smirnov
2017-09-28 17:57:05 +03:00
parent 9a767b7631
commit 182c21e38c
1096 changed files with 309697 additions and 132612 deletions
+96 -63
View File
@@ -1,6 +1,5 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package polly provides a client for Amazon Polly.
package polly
import (
@@ -16,19 +15,18 @@ const opDeleteLexicon = "DeleteLexicon"
// DeleteLexiconRequest generates a "aws/request.Request" representing the
// client's request for the DeleteLexicon operation. The "output" return
// value can be used to capture response data after the request's "Send" method
// is called.
// value will be populated with the request's response once the request complets
// successfuly.
//
// See DeleteLexicon for usage and error information.
// Use "Send" method on the returned Request to send the API call to the service.
// the "output" return value is not valid until after Send returns without error.
//
// Creating a request object using this method should be used when you want to inject
// custom logic into the request's lifecycle using a custom handler, or if you want to
// access properties on the request object before or after sending the request. If
// you just want the service response, call the DeleteLexicon method directly
// instead.
// See DeleteLexicon for more information on using the DeleteLexicon
// API call, and error handling.
//
// This method is useful when you want to inject custom logic or configuration
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
//
// Note: You must call the "Send" method on the returned request object in order
// to execute the request.
//
// // Example sending a request using the DeleteLexiconRequest method.
// req, resp := client.DeleteLexiconRequest(params)
@@ -108,19 +106,18 @@ const opDescribeVoices = "DescribeVoices"
// DescribeVoicesRequest generates a "aws/request.Request" representing the
// client's request for the DescribeVoices operation. The "output" return
// value can be used to capture response data after the request's "Send" method
// is called.
// value will be populated with the request's response once the request complets
// successfuly.
//
// See DescribeVoices for usage and error information.
// Use "Send" method on the returned Request to send the API call to the service.
// the "output" return value is not valid until after Send returns without error.
//
// Creating a request object using this method should be used when you want to inject
// custom logic into the request's lifecycle using a custom handler, or if you want to
// access properties on the request object before or after sending the request. If
// you just want the service response, call the DescribeVoices method directly
// instead.
// See DescribeVoices for more information on using the DescribeVoices
// API call, and error handling.
//
// This method is useful when you want to inject custom logic or configuration
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
//
// Note: You must call the "Send" method on the returned request object in order
// to execute the request.
//
// // Example sending a request using the DescribeVoicesRequest method.
// req, resp := client.DescribeVoicesRequest(params)
@@ -208,19 +205,18 @@ const opGetLexicon = "GetLexicon"
// GetLexiconRequest generates a "aws/request.Request" representing the
// client's request for the GetLexicon operation. The "output" return
// value can be used to capture response data after the request's "Send" method
// is called.
// value will be populated with the request's response once the request complets
// successfuly.
//
// See GetLexicon for usage and error information.
// Use "Send" method on the returned Request to send the API call to the service.
// the "output" return value is not valid until after Send returns without error.
//
// Creating a request object using this method should be used when you want to inject
// custom logic into the request's lifecycle using a custom handler, or if you want to
// access properties on the request object before or after sending the request. If
// you just want the service response, call the GetLexicon method directly
// instead.
// See GetLexicon for more information on using the GetLexicon
// API call, and error handling.
//
// This method is useful when you want to inject custom logic or configuration
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
//
// Note: You must call the "Send" method on the returned request object in order
// to execute the request.
//
// // Example sending a request using the GetLexiconRequest method.
// req, resp := client.GetLexiconRequest(params)
@@ -297,19 +293,18 @@ const opListLexicons = "ListLexicons"
// ListLexiconsRequest generates a "aws/request.Request" representing the
// client's request for the ListLexicons operation. The "output" return
// value can be used to capture response data after the request's "Send" method
// is called.
// value will be populated with the request's response once the request complets
// successfuly.
//
// See ListLexicons for usage and error information.
// Use "Send" method on the returned Request to send the API call to the service.
// the "output" return value is not valid until after Send returns without error.
//
// Creating a request object using this method should be used when you want to inject
// custom logic into the request's lifecycle using a custom handler, or if you want to
// access properties on the request object before or after sending the request. If
// you just want the service response, call the ListLexicons method directly
// instead.
// See ListLexicons for more information on using the ListLexicons
// API call, and error handling.
//
// This method is useful when you want to inject custom logic or configuration
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
//
// Note: You must call the "Send" method on the returned request object in order
// to execute the request.
//
// // Example sending a request using the ListLexiconsRequest method.
// req, resp := client.ListLexiconsRequest(params)
@@ -382,19 +377,18 @@ const opPutLexicon = "PutLexicon"
// PutLexiconRequest generates a "aws/request.Request" representing the
// client's request for the PutLexicon operation. The "output" return
// value can be used to capture response data after the request's "Send" method
// is called.
// value will be populated with the request's response once the request complets
// successfuly.
//
// See PutLexicon for usage and error information.
// Use "Send" method on the returned Request to send the API call to the service.
// the "output" return value is not valid until after Send returns without error.
//
// Creating a request object using this method should be used when you want to inject
// custom logic into the request's lifecycle using a custom handler, or if you want to
// access properties on the request object before or after sending the request. If
// you just want the service response, call the PutLexicon method directly
// instead.
// See PutLexicon for more information on using the PutLexicon
// API call, and error handling.
//
// This method is useful when you want to inject custom logic or configuration
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
//
// Note: You must call the "Send" method on the returned request object in order
// to execute the request.
//
// // Example sending a request using the PutLexiconRequest method.
// req, resp := client.PutLexiconRequest(params)
@@ -488,19 +482,18 @@ const opSynthesizeSpeech = "SynthesizeSpeech"
// SynthesizeSpeechRequest generates a "aws/request.Request" representing the
// client's request for the SynthesizeSpeech operation. The "output" return
// value can be used to capture response data after the request's "Send" method
// is called.
// value will be populated with the request's response once the request complets
// successfuly.
//
// See SynthesizeSpeech for usage and error information.
// Use "Send" method on the returned Request to send the API call to the service.
// the "output" return value is not valid until after Send returns without error.
//
// Creating a request object using this method should be used when you want to inject
// custom logic into the request's lifecycle using a custom handler, or if you want to
// access properties on the request object before or after sending the request. If
// you just want the service response, call the SynthesizeSpeech method directly
// instead.
// See SynthesizeSpeech for more information on using the SynthesizeSpeech
// API call, and error handling.
//
// This method is useful when you want to inject custom logic or configuration
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
//
// Note: You must call the "Send" method on the returned request object in order
// to execute the request.
//
// // Example sending a request using the SynthesizeSpeechRequest method.
// req, resp := client.SynthesizeSpeechRequest(params)
@@ -566,6 +559,13 @@ func (c *Polly) SynthesizeSpeechRequest(input *SynthesizeSpeechInput) (req *requ
// * ErrCodeServiceFailureException "ServiceFailureException"
// An unknown condition has caused a service failure.
//
// * ErrCodeMarksNotSupportedForFormatException "MarksNotSupportedForFormatException"
// Speech marks are not supported for the OutputFormat selected. Speech marks
// are only available for content in json format.
//
// * ErrCodeSsmlMarksNotSupportedForTextTypeException "SsmlMarksNotSupportedForTextTypeException"
// SSML speech marks are not supported for plain text-type input.
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/polly-2016-06-10/SynthesizeSpeech
func (c *Polly) SynthesizeSpeech(input *SynthesizeSpeechInput) (*SynthesizeSpeechOutput, error) {
req, out := c.SynthesizeSpeechRequest(input)
@@ -1068,7 +1068,8 @@ type SynthesizeSpeechInput struct {
// see PutLexicon (http://docs.aws.amazon.com/polly/latest/dg/API_PutLexicon.html).
LexiconNames []*string `type:"list"`
// The audio format in which the resulting stream will be encoded.
// The format in which the returned output will be encoded. For audio stream,
// this will be mp3, ogg_vorbis, or pcm. For speech marks, this will be json.
//
// OutputFormat is a required field
OutputFormat *string `type:"string" required:"true" enum:"OutputFormat"`
@@ -1081,6 +1082,9 @@ type SynthesizeSpeechInput struct {
// Valid values for pcm are "8000" and "16000" The default value is "16000".
SampleRate *string `type:"string"`
// The type of speech marks returned for the input text.
SpeechMarkTypes []*string `type:"list"`
// Input text to synthesize. If you specify ssml as the TextType, follow the
// SSML format for the input text.
//
@@ -1146,6 +1150,12 @@ func (s *SynthesizeSpeechInput) SetSampleRate(v string) *SynthesizeSpeechInput {
return s
}
// SetSpeechMarkTypes sets the SpeechMarkTypes field's value.
func (s *SynthesizeSpeechInput) SetSpeechMarkTypes(v []*string) *SynthesizeSpeechInput {
s.SpeechMarkTypes = v
return s
}
// SetText sets the Text field's value.
func (s *SynthesizeSpeechInput) SetText(v string) *SynthesizeSpeechInput {
s.Text = &v
@@ -1183,6 +1193,9 @@ type SynthesizeSpeechOutput struct {
// * If you request pcm as the OutputFormat, the ContentType returned is
// audio/pcm in a signed 16-bit, 1 channel (mono), little-endian format.
//
//
// * If you request json as the OutputFormat, the ContentType returned is
// audio/json.
ContentType *string `location:"header" locationName:"Content-Type" type:"string"`
// Number of characters synthesized.
@@ -1363,6 +1376,9 @@ const (
)
const (
// OutputFormatJson is a OutputFormat enum value
OutputFormatJson = "json"
// OutputFormatMp3 is a OutputFormat enum value
OutputFormatMp3 = "mp3"
@@ -1373,6 +1389,20 @@ const (
OutputFormatPcm = "pcm"
)
const (
// SpeechMarkTypeSentence is a SpeechMarkType enum value
SpeechMarkTypeSentence = "sentence"
// SpeechMarkTypeSsml is a SpeechMarkType enum value
SpeechMarkTypeSsml = "ssml"
// SpeechMarkTypeViseme is a SpeechMarkType enum value
SpeechMarkTypeViseme = "viseme"
// SpeechMarkTypeWord is a SpeechMarkType enum value
SpeechMarkTypeWord = "word"
)
const (
// TextTypeSsml is a TextType enum value
TextTypeSsml = "ssml"
@@ -1522,4 +1552,7 @@ const (
// VoiceIdFiliz is a VoiceId enum value
VoiceIdFiliz = "Filiz"
// VoiceIdVicki is a VoiceId enum value
VoiceIdVicki = "Vicki"
)
+19 -8
View File
@@ -1,22 +1,27 @@
package polly
import (
"regexp"
"testing"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/awstesting/unit"
"github.com/stretchr/testify/assert"
)
func TestRestGETStrategy(t *testing.T) {
svc := New(unit.Session, &aws.Config{Region: aws.String("us-west-2")})
r, _ := svc.SynthesizeSpeechRequest(nil)
err := restGETPresignStrategy(r)
assert.NoError(t, err)
assert.Equal(t, "GET", r.HTTPRequest.Method)
assert.NotEqual(t, nil, r.Operation.BeforePresignFn)
if err := restGETPresignStrategy(r); err != nil {
t.Error(err)
}
if "GET" != r.HTTPRequest.Method {
t.Errorf("Expected 'GET', but received %s", r.HTTPRequest.Method)
}
if r.Operation.BeforePresignFn == nil {
t.Error("Expected non-nil value for 'BeforePresignFn'")
}
}
func TestPresign(t *testing.T) {
@@ -27,6 +32,12 @@ func TestPresign(t *testing.T) {
VoiceId: aws.String("Foo"),
})
url, err := r.Presign(time.Second)
assert.NoError(t, err)
assert.Regexp(t, `^https://polly.us-west-2.amazonaws.com/v1/speech\?.*?OutputFormat=mp3.*?Text=Moo.*?VoiceId=Foo.*`, url)
if err != nil {
t.Error(err)
}
expectedURL := `^https://polly.us-west-2.amazonaws.com/v1/speech\?.*?OutputFormat=mp3.*?Text=Moo.*?VoiceId=Foo.*`
if matched, err := regexp.MatchString(expectedURL, url); !matched || err != nil {
t.Errorf("Expected:\n%q\nReceived:\n%q\nError:\n%v\n", expectedURL, url, err)
}
}
+34
View File
@@ -0,0 +1,34 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package polly provides the client and types for making API
// requests to Amazon Polly.
//
// Amazon Polly is a web service that makes it easy to synthesize speech from
// text.
//
// The Amazon Polly service provides API operations for synthesizing high-quality
// speech from plain text and Speech Synthesis Markup Language (SSML), along
// with managing pronunciations lexicons that enable you to get the best results
// for your application domain.
//
// See https://docs.aws.amazon.com/goto/WebAPI/polly-2016-06-10 for more information on this service.
//
// See polly package documentation for more information.
// https://docs.aws.amazon.com/sdk-for-go/api/service/polly/
//
// Using the Client
//
// To Amazon Polly with the SDK use the New function to create
// a new service client. With that client you can make API requests to the service.
// These clients are safe to use concurrently.
//
// See the SDK's documentation for more information on how to use the SDK.
// https://docs.aws.amazon.com/sdk-for-go/api/
//
// See aws.Config documentation for more information on configuring SDK clients.
// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config
//
// See the Amazon Polly client Polly for more
// information on creating client for this service.
// https://docs.aws.amazon.com/sdk-for-go/api/service/polly/#New
package polly
+14 -1
View File
@@ -1,4 +1,4 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package polly
@@ -48,6 +48,13 @@ const (
// The maximum size of the specified lexicon would be exceeded by this operation.
ErrCodeLexiconSizeExceededException = "LexiconSizeExceededException"
// ErrCodeMarksNotSupportedForFormatException for service response error code
// "MarksNotSupportedForFormatException".
//
// Speech marks are not supported for the OutputFormat selected. Speech marks
// are only available for content in json format.
ErrCodeMarksNotSupportedForFormatException = "MarksNotSupportedForFormatException"
// ErrCodeMaxLexemeLengthExceededException for service response error code
// "MaxLexemeLengthExceededException".
//
@@ -66,6 +73,12 @@ const (
// An unknown condition has caused a service failure.
ErrCodeServiceFailureException = "ServiceFailureException"
// ErrCodeSsmlMarksNotSupportedForTextTypeException for service response error code
// "SsmlMarksNotSupportedForTextTypeException".
//
// SSML speech marks are not supported for plain text-type input.
ErrCodeSsmlMarksNotSupportedForTextTypeException = "SsmlMarksNotSupportedForTextTypeException"
// ErrCodeTextLengthExceededException for service response error code
// "TextLengthExceededException".
//
+180 -92
View File
@@ -1,152 +1,240 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package polly_test
import (
"bytes"
"fmt"
"strings"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/polly"
)
var _ time.Duration
var _ bytes.Buffer
func ExamplePolly_DeleteLexicon() {
sess := session.Must(session.NewSession())
svc := polly.New(sess)
params := &polly.DeleteLexiconInput{
Name: aws.String("LexiconName"), // Required
}
resp, err := svc.DeleteLexicon(params)
var _ strings.Reader
var _ aws.Config
func parseTime(layout, value string) *time.Time {
t, err := time.Parse(layout, value)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
panic(err)
}
return &t
}
// To delete a lexicon
//
// Deletes a specified pronunciation lexicon stored in an AWS Region.
func ExamplePolly_DeleteLexicon_shared00() {
svc := polly.New(session.New())
input := &polly.DeleteLexiconInput{
Name: aws.String("example"),
}
result, err := svc.DeleteLexicon(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case polly.ErrCodeLexiconNotFoundException:
fmt.Println(polly.ErrCodeLexiconNotFoundException, aerr.Error())
case polly.ErrCodeServiceFailureException:
fmt.Println(polly.ErrCodeServiceFailureException, aerr.Error())
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
// Pretty-print the response data.
fmt.Println(resp)
fmt.Println(result)
}
func ExamplePolly_DescribeVoices() {
sess := session.Must(session.NewSession())
svc := polly.New(sess)
params := &polly.DescribeVoicesInput{
LanguageCode: aws.String("LanguageCode"),
NextToken: aws.String("NextToken"),
// To describe available voices
//
// Returns the list of voices that are available for use when requesting speech synthesis.
// Displayed languages are those within the specified language code. If no language
// code is specified, voices for all available languages are displayed.
func ExamplePolly_DescribeVoices_shared00() {
svc := polly.New(session.New())
input := &polly.DescribeVoicesInput{
LanguageCode: aws.String("en-GB"),
}
resp, err := svc.DescribeVoices(params)
result, err := svc.DescribeVoices(input)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case polly.ErrCodeInvalidNextTokenException:
fmt.Println(polly.ErrCodeInvalidNextTokenException, aerr.Error())
case polly.ErrCodeServiceFailureException:
fmt.Println(polly.ErrCodeServiceFailureException, aerr.Error())
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
// Pretty-print the response data.
fmt.Println(resp)
fmt.Println(result)
}
func ExamplePolly_GetLexicon() {
sess := session.Must(session.NewSession())
svc := polly.New(sess)
params := &polly.GetLexiconInput{
Name: aws.String("LexiconName"), // Required
// To retrieve a lexicon
//
// Returns the content of the specified pronunciation lexicon stored in an AWS Region.
func ExamplePolly_GetLexicon_shared00() {
svc := polly.New(session.New())
input := &polly.GetLexiconInput{
Name: aws.String(""),
}
resp, err := svc.GetLexicon(params)
result, err := svc.GetLexicon(input)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case polly.ErrCodeLexiconNotFoundException:
fmt.Println(polly.ErrCodeLexiconNotFoundException, aerr.Error())
case polly.ErrCodeServiceFailureException:
fmt.Println(polly.ErrCodeServiceFailureException, aerr.Error())
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
// Pretty-print the response data.
fmt.Println(resp)
fmt.Println(result)
}
func ExamplePolly_ListLexicons() {
sess := session.Must(session.NewSession())
svc := polly.New(sess)
params := &polly.ListLexiconsInput{
NextToken: aws.String("NextToken"),
}
resp, err := svc.ListLexicons(params)
// To list all lexicons in a region
//
// Returns a list of pronunciation lexicons stored in an AWS Region.
func ExamplePolly_ListLexicons_shared00() {
svc := polly.New(session.New())
input := &polly.ListLexiconsInput{}
result, err := svc.ListLexicons(input)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case polly.ErrCodeInvalidNextTokenException:
fmt.Println(polly.ErrCodeInvalidNextTokenException, aerr.Error())
case polly.ErrCodeServiceFailureException:
fmt.Println(polly.ErrCodeServiceFailureException, aerr.Error())
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
// Pretty-print the response data.
fmt.Println(resp)
fmt.Println(result)
}
func ExamplePolly_PutLexicon() {
sess := session.Must(session.NewSession())
svc := polly.New(sess)
params := &polly.PutLexiconInput{
Content: aws.String("LexiconContent"), // Required
Name: aws.String("LexiconName"), // Required
// To save a lexicon
//
// Stores a pronunciation lexicon in an AWS Region.
func ExamplePolly_PutLexicon_shared00() {
svc := polly.New(session.New())
input := &polly.PutLexiconInput{
Content: aws.String("file://example.pls"),
Name: aws.String("W3C"),
}
resp, err := svc.PutLexicon(params)
result, err := svc.PutLexicon(input)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case polly.ErrCodeInvalidLexiconException:
fmt.Println(polly.ErrCodeInvalidLexiconException, aerr.Error())
case polly.ErrCodeUnsupportedPlsAlphabetException:
fmt.Println(polly.ErrCodeUnsupportedPlsAlphabetException, aerr.Error())
case polly.ErrCodeUnsupportedPlsLanguageException:
fmt.Println(polly.ErrCodeUnsupportedPlsLanguageException, aerr.Error())
case polly.ErrCodeLexiconSizeExceededException:
fmt.Println(polly.ErrCodeLexiconSizeExceededException, aerr.Error())
case polly.ErrCodeMaxLexemeLengthExceededException:
fmt.Println(polly.ErrCodeMaxLexemeLengthExceededException, aerr.Error())
case polly.ErrCodeMaxLexiconsNumberExceededException:
fmt.Println(polly.ErrCodeMaxLexiconsNumberExceededException, aerr.Error())
case polly.ErrCodeServiceFailureException:
fmt.Println(polly.ErrCodeServiceFailureException, aerr.Error())
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
// Pretty-print the response data.
fmt.Println(resp)
fmt.Println(result)
}
func ExamplePolly_SynthesizeSpeech() {
sess := session.Must(session.NewSession())
svc := polly.New(sess)
params := &polly.SynthesizeSpeechInput{
OutputFormat: aws.String("OutputFormat"), // Required
Text: aws.String("Text"), // Required
VoiceId: aws.String("VoiceId"), // Required
// To synthesize speech
//
// Synthesizes plain text or SSML into a file of human-like speech.
func ExamplePolly_SynthesizeSpeech_shared00() {
svc := polly.New(session.New())
input := &polly.SynthesizeSpeechInput{
LexiconNames: []*string{
aws.String("LexiconName"), // Required
// More values...
aws.String("example"),
},
SampleRate: aws.String("SampleRate"),
TextType: aws.String("TextType"),
OutputFormat: aws.String("mp3"),
SampleRate: aws.String("8000"),
Text: aws.String("All Gaul is divided into three parts"),
TextType: aws.String("text"),
VoiceId: aws.String("Joanna"),
}
resp, err := svc.SynthesizeSpeech(params)
result, err := svc.SynthesizeSpeech(input)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case polly.ErrCodeTextLengthExceededException:
fmt.Println(polly.ErrCodeTextLengthExceededException, aerr.Error())
case polly.ErrCodeInvalidSampleRateException:
fmt.Println(polly.ErrCodeInvalidSampleRateException, aerr.Error())
case polly.ErrCodeInvalidSsmlException:
fmt.Println(polly.ErrCodeInvalidSsmlException, aerr.Error())
case polly.ErrCodeLexiconNotFoundException:
fmt.Println(polly.ErrCodeLexiconNotFoundException, aerr.Error())
case polly.ErrCodeServiceFailureException:
fmt.Println(polly.ErrCodeServiceFailureException, aerr.Error())
case polly.ErrCodeMarksNotSupportedForFormatException:
fmt.Println(polly.ErrCodeMarksNotSupportedForFormatException, aerr.Error())
case polly.ErrCodeSsmlMarksNotSupportedForTextTypeException:
fmt.Println(polly.ErrCodeSsmlMarksNotSupportedForTextTypeException, aerr.Error())
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
// Pretty-print the response data.
fmt.Println(resp)
fmt.Println(result)
}
+2 -2
View File
@@ -1,4 +1,4 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package pollyiface provides an interface to enable mocking the Amazon Polly service client
// for testing your code.
@@ -21,7 +21,7 @@ import (
//
// The best way to use this interface is so the SDK's service client's calls
// can be stubbed out for unit testing your code with the SDK without needing
// to inject custom request handlers into the the SDK's request pipeline.
// to inject custom request handlers into the SDK's request pipeline.
//
// // myFunc uses an SDK service client to make a request to
// // Amazon Polly.
+6 -10
View File
@@ -1,4 +1,4 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package polly
@@ -11,16 +11,12 @@ import (
"github.com/aws/aws-sdk-go/private/protocol/restjson"
)
// Amazon Polly is a web service that makes it easy to synthesize speech from
// text.
// Polly provides the API operation methods for making requests to
// Amazon Polly. See this package's package overview docs
// for details on the service.
//
// The Amazon Polly service provides API operations for synthesizing high-quality
// speech from plain text and Speech Synthesis Markup Language (SSML), along
// with managing pronunciations lexicons that enable you to get the best results
// for your application domain.
// The service client's operations are safe to be used concurrently.
// It is not safe to mutate any of the client's properties though.
// Please also see https://docs.aws.amazon.com/goto/WebAPI/polly-2016-06-10
// Polly methods are safe to use concurrently. It is not safe to
// modify mutate any of the struct's properties though.
type Polly struct {
*client.Client
}