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

View File

@@ -0,0 +1,258 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package translate
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awsutil"
"github.com/aws/aws-sdk-go/aws/request"
)
const opText = "TranslateText"
// TextRequest generates a "aws/request.Request" representing the
// client's request for the Text operation. The "output" return
// value will be populated with the request's response once the request completes
// successfuly.
//
// 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.
//
// See Text for more information on using the Text
// 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.
//
//
// // Example sending a request using the TextRequest method.
// req, resp := client.TextRequest(params)
//
// err := req.Send()
// if err == nil { // resp is now filled
// fmt.Println(resp)
// }
//
// See also, https://docs.aws.amazon.com/goto/WebAPI/translate-2017-07-01/Text
func (c *Translate) TextRequest(input *TextInput) (req *request.Request, output *TextOutput) {
op := &request.Operation{
Name: opText,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &TextInput{}
}
output = &TextOutput{}
req = c.newRequest(op, input, output)
return
}
// Text API operation for Amazon Translate.
//
// Translates input text from the source language to the target language. You
// can translate between English (en) and one of the following languages, or
// between one of the following languages and English.
//
// * Arabic (ar)
//
// * Chinese (Simplified) (zh)
//
// * French (fr)
//
// * German (de)
//
// * Portuguese (pt)
//
// * Spanish (es)
//
// To have Amazon Translate determine the source language of your text, you
// can specify auto in the SourceLanguageCode field. If you specify auto, Amazon
// Translate will call Amazon Comprehend to determine the source language.
//
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
// with awserr.Error's Code and Message methods to get detailed information about
// the error.
//
// See the AWS API reference guide for Amazon Translate's
// API operation Text for usage and error information.
//
// Returned Error Codes:
// * ErrCodeInvalidRequestException "InvalidRequestException"
// The request is invalid.
//
// * ErrCodeTextSizeLimitExceededException "TextSizeLimitExceededException"
// The size of the input text exceeds the length constraint for the Text field.
// Try again with a shorter text.
//
// * ErrCodeTooManyRequestsException "TooManyRequestsException"
// The number of requests exceeds the limit. Resubmit your request later.
//
// * ErrCodeUnsupportedLanguagePairException "UnsupportedLanguagePairException"
// Amazon Translate cannot translate input text in the source language into
// this target language. For more information, see how-to-error-msg.
//
// * ErrCodeDetectedLanguageLowConfidenceException "DetectedLanguageLowConfidenceException"
// The confidence that Amazon Comprehend accurately detected the source language
// is low. If a low confidence level is acceptable for your application, you
// can use the language in the exception to call Amazon Translate again. For
// more information, see the DetectDominantLanguage (https://docs.aws.amazon.com/comprehend/latest/dg/API_DetectDominantLanguage.html)
// operation in the Amazon Comprehend Developer Guide.
//
// * ErrCodeInternalServerException "InternalServerException"
// An internal server error occurred. Retry your request.
//
// * ErrCodeServiceUnavailableException "ServiceUnavailableException"
// Amazon Translate is unavailable. Retry your request later.
//
// See also, https://docs.aws.amazon.com/goto/WebAPI/translate-2017-07-01/Text
func (c *Translate) Text(input *TextInput) (*TextOutput, error) {
req, out := c.TextRequest(input)
return out, req.Send()
}
// TextWithContext is the same as Text with the addition of
// the ability to pass a context and additional request options.
//
// See Text for details on how to use this API operation.
//
// The context must be non-nil and will be used for request cancellation. If
// the context is nil a panic will occur. In the future the SDK may create
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *Translate) TextWithContext(ctx aws.Context, input *TextInput, opts ...request.Option) (*TextOutput, error) {
req, out := c.TextRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
}
type TextInput struct {
_ struct{} `type:"structure"`
// One of the supported language codes for the source text. If the TargetLanguageCode
// is not "en", the SourceLanguageCode must be "en".
//
// To have Amazon Translate determine the source language of your text, you
// can specify auto in the SourceLanguageCode field. If you specify auto, Amazon
// Translate will call Amazon Comprehend to determine the source language.
//
// SourceLanguageCode is a required field
SourceLanguageCode *string `min:"2" type:"string" required:"true"`
// One of the supported language codes for the target text. If the SourceLanguageCode
// is not "en", the TargetLanguageCode must be "en".
//
// TargetLanguageCode is a required field
TargetLanguageCode *string `min:"2" type:"string" required:"true"`
// The text to translate.
//
// Text is a required field
Text *string `min:"1" type:"string" required:"true"`
}
// String returns the string representation
func (s TextInput) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s TextInput) GoString() string {
return s.String()
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *TextInput) Validate() error {
invalidParams := request.ErrInvalidParams{Context: "TextInput"}
if s.SourceLanguageCode == nil {
invalidParams.Add(request.NewErrParamRequired("SourceLanguageCode"))
}
if s.SourceLanguageCode != nil && len(*s.SourceLanguageCode) < 2 {
invalidParams.Add(request.NewErrParamMinLen("SourceLanguageCode", 2))
}
if s.TargetLanguageCode == nil {
invalidParams.Add(request.NewErrParamRequired("TargetLanguageCode"))
}
if s.TargetLanguageCode != nil && len(*s.TargetLanguageCode) < 2 {
invalidParams.Add(request.NewErrParamMinLen("TargetLanguageCode", 2))
}
if s.Text == nil {
invalidParams.Add(request.NewErrParamRequired("Text"))
}
if s.Text != nil && len(*s.Text) < 1 {
invalidParams.Add(request.NewErrParamMinLen("Text", 1))
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
// SetSourceLanguageCode sets the SourceLanguageCode field's value.
func (s *TextInput) SetSourceLanguageCode(v string) *TextInput {
s.SourceLanguageCode = &v
return s
}
// SetTargetLanguageCode sets the TargetLanguageCode field's value.
func (s *TextInput) SetTargetLanguageCode(v string) *TextInput {
s.TargetLanguageCode = &v
return s
}
// SetText sets the Text field's value.
func (s *TextInput) SetText(v string) *TextInput {
s.Text = &v
return s
}
type TextOutput struct {
_ struct{} `type:"structure"`
// The language code for the language of the input text.
//
// SourceLanguageCode is a required field
SourceLanguageCode *string `min:"2" type:"string" required:"true"`
// The language code for the language of the translated text.
//
// TargetLanguageCode is a required field
TargetLanguageCode *string `min:"2" type:"string" required:"true"`
// The text translated into the target language.
//
// TranslatedText is a required field
TranslatedText *string `min:"1" type:"string" required:"true"`
}
// String returns the string representation
func (s TextOutput) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s TextOutput) GoString() string {
return s.String()
}
// SetSourceLanguageCode sets the SourceLanguageCode field's value.
func (s *TextOutput) SetSourceLanguageCode(v string) *TextOutput {
s.SourceLanguageCode = &v
return s
}
// SetTargetLanguageCode sets the TargetLanguageCode field's value.
func (s *TextOutput) SetTargetLanguageCode(v string) *TextOutput {
s.TargetLanguageCode = &v
return s
}
// SetTranslatedText sets the TranslatedText field's value.
func (s *TextOutput) SetTranslatedText(v string) *TextOutput {
s.TranslatedText = &v
return s
}

View File

@@ -0,0 +1,29 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package translate provides the client and types for making API
// requests to Amazon Translate.
//
// Provides translation between English and one of six languages, or between
// one of the six languages and English.
//
// See https://docs.aws.amazon.com/goto/WebAPI/translate-2017-07-01 for more information on this service.
//
// See translate package documentation for more information.
// https://docs.aws.amazon.com/sdk-for-go/api/service/translate/
//
// Using the Client
//
// To contact Amazon Translate 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 Translate client Translate for more
// information on creating client for this service.
// https://docs.aws.amazon.com/sdk-for-go/api/service/translate/#New
package translate

View File

@@ -0,0 +1,54 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package translate
const (
// ErrCodeDetectedLanguageLowConfidenceException for service response error code
// "DetectedLanguageLowConfidenceException".
//
// The confidence that Amazon Comprehend accurately detected the source language
// is low. If a low confidence level is acceptable for your application, you
// can use the language in the exception to call Amazon Translate again. For
// more information, see the DetectDominantLanguage (https://docs.aws.amazon.com/comprehend/latest/dg/API_DetectDominantLanguage.html)
// operation in the Amazon Comprehend Developer Guide.
ErrCodeDetectedLanguageLowConfidenceException = "DetectedLanguageLowConfidenceException"
// ErrCodeInternalServerException for service response error code
// "InternalServerException".
//
// An internal server error occurred. Retry your request.
ErrCodeInternalServerException = "InternalServerException"
// ErrCodeInvalidRequestException for service response error code
// "InvalidRequestException".
//
// The request is invalid.
ErrCodeInvalidRequestException = "InvalidRequestException"
// ErrCodeServiceUnavailableException for service response error code
// "ServiceUnavailableException".
//
// Amazon Translate is unavailable. Retry your request later.
ErrCodeServiceUnavailableException = "ServiceUnavailableException"
// ErrCodeTextSizeLimitExceededException for service response error code
// "TextSizeLimitExceededException".
//
// The size of the input text exceeds the length constraint for the Text field.
// Try again with a shorter text.
ErrCodeTextSizeLimitExceededException = "TextSizeLimitExceededException"
// ErrCodeTooManyRequestsException for service response error code
// "TooManyRequestsException".
//
// The number of requests exceeds the limit. Resubmit your request later.
ErrCodeTooManyRequestsException = "TooManyRequestsException"
// ErrCodeUnsupportedLanguagePairException for service response error code
// "UnsupportedLanguagePairException".
//
// Amazon Translate cannot translate input text in the source language into
// this target language. For more information, see how-to-error-msg.
ErrCodeUnsupportedLanguagePairException = "UnsupportedLanguagePairException"
)

View File

@@ -0,0 +1,98 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package translate
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/jsonrpc"
)
// Translate provides the API operation methods for making requests to
// Amazon Translate. See this package's package overview docs
// for details on the service.
//
// Translate methods are safe to use concurrently. It is not safe to
// modify mutate any of the struct's properties though.
type Translate 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 = "translate" // Service endpoint prefix API calls made to.
EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata.
)
// New creates a new instance of the Translate 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 Translate client from just a session.
// svc := translate.New(mySession)
//
// // Create a Translate client with additional configuration
// svc := translate.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *Translate {
c := p.ClientConfig(EndpointsID, cfgs...)
if c.SigningNameDerived || len(c.SigningName) == 0 {
c.SigningName = "translate"
}
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) *Translate {
svc := &Translate{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningName: signingName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2017-07-01",
JSONVersion: "1.1",
TargetPrefix: "AWSShineFrontendService_20170701",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a Translate operation and runs any
// custom request initialization.
func (c *Translate) 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
}

View File

@@ -0,0 +1,68 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package translateiface provides an interface to enable mocking the Amazon Translate 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 translateiface
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/translate"
)
// TranslateAPI provides an interface to enable mocking the
// translate.Translate 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 Translate.
// func myFunc(svc translateiface.TranslateAPI) bool {
// // Make svc.Text request
// }
//
// func main() {
// sess := session.New()
// svc := translate.New(sess)
//
// myFunc(svc)
// }
//
// In your _test.go file:
//
// // Define a mock struct to be used in your unit tests of myFunc.
// type mockTranslateClient struct {
// translateiface.TranslateAPI
// }
// func (m *mockTranslateClient) Text(input *translate.TextInput) (*translate.TextOutput, error) {
// // mock response/functionality
// }
//
// func TestMyFunc(t *testing.T) {
// // Setup Test
// mockSvc := &mockTranslateClient{}
//
// 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 TranslateAPI interface {
Text(*translate.TextInput) (*translate.TextOutput, error)
TextWithContext(aws.Context, *translate.TextInput, ...request.Option) (*translate.TextOutput, error)
TextRequest(*translate.TextInput) (*request.Request, *translate.TextOutput)
}
var _ TranslateAPI = (*translate.Translate)(nil)