Vendor aws-sdk-go (dep ensure) (#178)

This commit is contained in:
Onur Filiz
2018-04-27 18:18:36 -07:00
committed by Robbie Zhang
parent 228a1f7a5f
commit 8d67098d06
2785 changed files with 1973570 additions and 25 deletions

1557
vendor/github.com/aws/aws-sdk-go/service/polly/api.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,24 @@
package polly
import (
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/private/protocol/rest"
)
func init() {
initRequest = func(r *request.Request) {
if r.Operation.Name == opSynthesizeSpeech {
r.Operation.BeforePresignFn = restGETPresignStrategy
}
}
}
// restGETPresignStrategy will prepare the request from a POST to a GET request.
// Enabling the presigner to sign the request as a GET.
func restGETPresignStrategy(r *request.Request) error {
r.Handlers.Build.Clear()
r.Handlers.Build.PushBack(rest.BuildAsGET)
r.Operation.HTTPMethod = "GET"
r.HTTPRequest.Method = "GET"
return nil
}

View File

@@ -0,0 +1,43 @@
package polly
import (
"regexp"
"testing"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/awstesting/unit"
)
func TestRestGETStrategy(t *testing.T) {
svc := New(unit.Session, &aws.Config{Region: aws.String("us-west-2")})
r, _ := svc.SynthesizeSpeechRequest(nil)
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) {
svc := New(unit.Session, &aws.Config{Region: aws.String("us-west-2")})
r, _ := svc.SynthesizeSpeechRequest(&SynthesizeSpeechInput{
Text: aws.String("Moo"),
OutputFormat: aws.String("mp3"),
VoiceId: aws.String("Foo"),
})
url, err := r.Presign(time.Second)
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
vendor/github.com/aws/aws-sdk-go/service/polly/doc.go generated vendored Normal file
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 contact 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

View File

@@ -0,0 +1,103 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package polly
const (
// ErrCodeInvalidLexiconException for service response error code
// "InvalidLexiconException".
//
// Amazon Polly can't find the specified lexicon. Verify that the lexicon's
// name is spelled correctly, and then try again.
ErrCodeInvalidLexiconException = "InvalidLexiconException"
// ErrCodeInvalidNextTokenException for service response error code
// "InvalidNextTokenException".
//
// The NextToken is invalid. Verify that it's spelled correctly, and then try
// again.
ErrCodeInvalidNextTokenException = "InvalidNextTokenException"
// ErrCodeInvalidSampleRateException for service response error code
// "InvalidSampleRateException".
//
// The specified sample rate is not valid.
ErrCodeInvalidSampleRateException = "InvalidSampleRateException"
// ErrCodeInvalidSsmlException for service response error code
// "InvalidSsmlException".
//
// The SSML you provided is invalid. Verify the SSML syntax, spelling of tags
// and values, and then try again.
ErrCodeInvalidSsmlException = "InvalidSsmlException"
// ErrCodeLexiconNotFoundException for service response error code
// "LexiconNotFoundException".
//
// Amazon Polly can't find the specified lexicon. This could be caused by a
// lexicon that is missing, its name is misspelled or specifying a lexicon that
// is in a different region.
//
// Verify that the lexicon exists, is in the region (see ListLexicons) and that
// you spelled its name is spelled correctly. Then try again.
ErrCodeLexiconNotFoundException = "LexiconNotFoundException"
// ErrCodeLexiconSizeExceededException for service response error code
// "LexiconSizeExceededException".
//
// 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".
//
// The maximum size of the lexeme would be exceeded by this operation.
ErrCodeMaxLexemeLengthExceededException = "MaxLexemeLengthExceededException"
// ErrCodeMaxLexiconsNumberExceededException for service response error code
// "MaxLexiconsNumberExceededException".
//
// The maximum number of lexicons would be exceeded by this operation.
ErrCodeMaxLexiconsNumberExceededException = "MaxLexiconsNumberExceededException"
// ErrCodeServiceFailureException for service response error code
// "ServiceFailureException".
//
// 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".
//
// The value of the "Text" parameter is longer than the accepted limits. The
// limit for input text is a maximum of 3000 characters total, of which no more
// than 1500 can be billed characters. SSML tags are not counted as billed characters.
ErrCodeTextLengthExceededException = "TextLengthExceededException"
// ErrCodeUnsupportedPlsAlphabetException for service response error code
// "UnsupportedPlsAlphabetException".
//
// The alphabet specified by the lexicon is not a supported alphabet. Valid
// values are x-sampa and ipa.
ErrCodeUnsupportedPlsAlphabetException = "UnsupportedPlsAlphabetException"
// ErrCodeUnsupportedPlsLanguageException for service response error code
// "UnsupportedPlsLanguageException".
//
// The language specified in the lexicon is unsupported. For a list of supported
// languages, see Lexicon Attributes (http://docs.aws.amazon.com/polly/latest/dg/API_LexiconAttributes.html).
ErrCodeUnsupportedPlsLanguageException = "UnsupportedPlsLanguageException"
)

View File

@@ -0,0 +1,240 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package polly_test
import (
"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 _ strings.Reader
var _ aws.Config
func parseTime(layout, value string) *time.Time {
t, err := time.Parse(layout, value)
if err != nil {
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
}
fmt.Println(result)
}
// 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"),
}
result, err := svc.DescribeVoices(input)
if err != nil {
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
}
fmt.Println(result)
}
// 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(""),
}
result, err := svc.GetLexicon(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
}
fmt.Println(result)
}
// 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 {
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
}
fmt.Println(result)
}
// 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"),
}
result, err := svc.PutLexicon(input)
if err != nil {
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
}
fmt.Println(result)
}
// 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("example"),
},
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"),
}
result, err := svc.SynthesizeSpeech(input)
if err != nil {
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
}
fmt.Println(result)
}

View File

@@ -0,0 +1,88 @@
// 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.
//
// It is important to note that this interface will have breaking changes
// when the service model is updated and adds new API operations, paginators,
// and waiters.
package pollyiface
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/polly"
)
// PollyAPI provides an interface to enable mocking the
// polly.Polly service client's API operation,
// paginators, and waiters. This make unit testing your code that calls out
// to the SDK's service client's calls easier.
//
// 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 SDK's request pipeline.
//
// // myFunc uses an SDK service client to make a request to
// // Amazon Polly.
// func myFunc(svc pollyiface.PollyAPI) bool {
// // Make svc.DeleteLexicon request
// }
//
// func main() {
// sess := session.New()
// svc := polly.New(sess)
//
// myFunc(svc)
// }
//
// In your _test.go file:
//
// // Define a mock struct to be used in your unit tests of myFunc.
// type mockPollyClient struct {
// pollyiface.PollyAPI
// }
// func (m *mockPollyClient) DeleteLexicon(input *polly.DeleteLexiconInput) (*polly.DeleteLexiconOutput, error) {
// // mock response/functionality
// }
//
// func TestMyFunc(t *testing.T) {
// // Setup Test
// mockSvc := &mockPollyClient{}
//
// myfunc(mockSvc)
//
// // Verify myFunc's functionality
// }
//
// It is important to note that this interface will have breaking changes
// when the service model is updated and adds new API operations, paginators,
// and waiters. Its suggested to use the pattern above for testing, or using
// tooling to generate mocks to satisfy the interfaces.
type PollyAPI interface {
DeleteLexicon(*polly.DeleteLexiconInput) (*polly.DeleteLexiconOutput, error)
DeleteLexiconWithContext(aws.Context, *polly.DeleteLexiconInput, ...request.Option) (*polly.DeleteLexiconOutput, error)
DeleteLexiconRequest(*polly.DeleteLexiconInput) (*request.Request, *polly.DeleteLexiconOutput)
DescribeVoices(*polly.DescribeVoicesInput) (*polly.DescribeVoicesOutput, error)
DescribeVoicesWithContext(aws.Context, *polly.DescribeVoicesInput, ...request.Option) (*polly.DescribeVoicesOutput, error)
DescribeVoicesRequest(*polly.DescribeVoicesInput) (*request.Request, *polly.DescribeVoicesOutput)
GetLexicon(*polly.GetLexiconInput) (*polly.GetLexiconOutput, error)
GetLexiconWithContext(aws.Context, *polly.GetLexiconInput, ...request.Option) (*polly.GetLexiconOutput, error)
GetLexiconRequest(*polly.GetLexiconInput) (*request.Request, *polly.GetLexiconOutput)
ListLexicons(*polly.ListLexiconsInput) (*polly.ListLexiconsOutput, error)
ListLexiconsWithContext(aws.Context, *polly.ListLexiconsInput, ...request.Option) (*polly.ListLexiconsOutput, error)
ListLexiconsRequest(*polly.ListLexiconsInput) (*request.Request, *polly.ListLexiconsOutput)
PutLexicon(*polly.PutLexiconInput) (*polly.PutLexiconOutput, error)
PutLexiconWithContext(aws.Context, *polly.PutLexiconInput, ...request.Option) (*polly.PutLexiconOutput, error)
PutLexiconRequest(*polly.PutLexiconInput) (*request.Request, *polly.PutLexiconOutput)
SynthesizeSpeech(*polly.SynthesizeSpeechInput) (*polly.SynthesizeSpeechOutput, error)
SynthesizeSpeechWithContext(aws.Context, *polly.SynthesizeSpeechInput, ...request.Option) (*polly.SynthesizeSpeechOutput, error)
SynthesizeSpeechRequest(*polly.SynthesizeSpeechInput) (*request.Request, *polly.SynthesizeSpeechOutput)
}
var _ PollyAPI = (*polly.Polly)(nil)

View File

@@ -0,0 +1,93 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package polly
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/restjson"
)
// Polly provides the API operation methods for making requests to
// Amazon Polly. See this package's package overview docs
// for details on the service.
//
// 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
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// Service information constants
const (
ServiceName = "polly" // Service endpoint prefix API calls made to.
EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata.
)
// New creates a new instance of the Polly client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a Polly client from just a session.
// svc := polly.New(mySession)
//
// // Create a Polly client with additional configuration
// svc := polly.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *Polly {
c := p.ClientConfig(EndpointsID, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *Polly {
svc := &Polly{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningName: signingName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2016-06-10",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(restjson.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a Polly operation and runs any
// custom request initialization.
func (c *Polly) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}