Switch to using the dep tool and update all the dependencies
This commit is contained in:
+1167
File diff suppressed because it is too large
Load Diff
+90
@@ -0,0 +1,90 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
// Package lexruntimeservice provides the client and types for making API
|
||||
// requests to Amazon Lex Runtime Service.
|
||||
//
|
||||
// Amazon Lex provides both build and runtime endpoints. Each endpoint provides
|
||||
// a set of operations (API). Your conversational bot uses the runtime API to
|
||||
// understand user utterances (user input text or voice). For example, suppose
|
||||
// a user says "I want pizza", your bot sends this input to Amazon Lex using
|
||||
// the runtime API. Amazon Lex recognizes that the user request is for the OrderPizza
|
||||
// intent (one of the intents defined in the bot). Then Amazon Lex engages in
|
||||
// user conversation on behalf of the bot to elicit required information (slot
|
||||
// values, such as pizza size and crust type), and then performs fulfillment
|
||||
// activity (that you configured when you created the bot). You use the build-time
|
||||
// API to create and manage your Amazon Lex bot. For a list of build-time operations,
|
||||
// see the build-time API, .
|
||||
//
|
||||
// See https://docs.aws.amazon.com/goto/WebAPI/runtime.lex-2016-11-28 for more information on this service.
|
||||
//
|
||||
// See lexruntimeservice package documentation for more information.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/service/lexruntimeservice/
|
||||
//
|
||||
// Using the Client
|
||||
//
|
||||
// To use the client for Amazon Lex Runtime Service you will first need
|
||||
// to create a new instance of it.
|
||||
//
|
||||
// When creating a client for an AWS service you'll first need to have a Session
|
||||
// already created. The Session provides configuration that can be shared
|
||||
// between multiple service clients. Additional configuration can be applied to
|
||||
// the Session and service's client when they are constructed. The aws package's
|
||||
// Config type contains several fields such as Region for the AWS Region the
|
||||
// client should make API requests too. The optional Config value can be provided
|
||||
// as the variadic argument for Sessions and client creation.
|
||||
//
|
||||
// Once the service's client is created you can use it to make API requests the
|
||||
// AWS service. These clients are safe to use concurrently.
|
||||
//
|
||||
// // Create a session to share configuration, and load external configuration.
|
||||
// sess := session.Must(session.NewSession())
|
||||
//
|
||||
// // Create the service's client with the session.
|
||||
// svc := lexruntimeservice.New(sess)
|
||||
//
|
||||
// See the SDK's documentation for more information on how to use service clients.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/
|
||||
//
|
||||
// See aws package's Config type for more information on configuration options.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config
|
||||
//
|
||||
// See the Amazon Lex Runtime Service client LexRuntimeService for more
|
||||
// information on creating the service's client.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/service/lexruntimeservice/#New
|
||||
//
|
||||
// Once the client is created you can make an API request to the service.
|
||||
// Each API method takes a input parameter, and returns the service response
|
||||
// and an error.
|
||||
//
|
||||
// The API method will document which error codes the service can be returned
|
||||
// by the operation if the service models the API operation's errors. These
|
||||
// errors will also be available as const strings prefixed with "ErrCode".
|
||||
//
|
||||
// result, err := svc.PostContent(params)
|
||||
// if err != nil {
|
||||
// // Cast err to awserr.Error to handle specific error codes.
|
||||
// aerr, ok := err.(awserr.Error)
|
||||
// if ok && aerr.Code() == <error code to check for> {
|
||||
// // Specific error code handling
|
||||
// }
|
||||
// return err
|
||||
// }
|
||||
//
|
||||
// fmt.Println("PostContent result:")
|
||||
// fmt.Println(result)
|
||||
//
|
||||
// Using the Client with Context
|
||||
//
|
||||
// The service's client also provides methods to make API requests with a Context
|
||||
// value. This allows you to control the timeout, and cancellation of pending
|
||||
// requests. These methods also take request Option as variadic parameter to apply
|
||||
// additional configuration to the API request.
|
||||
//
|
||||
// ctx := context.Background()
|
||||
//
|
||||
// result, err := svc.PostContentWithContext(ctx, params)
|
||||
//
|
||||
// See the request package documentation for more information on using Context pattern
|
||||
// with the SDK.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/aws/request/
|
||||
package lexruntimeservice
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
package lexruntimeservice
|
||||
|
||||
const (
|
||||
|
||||
// ErrCodeBadGatewayException for service response error code
|
||||
// "BadGatewayException".
|
||||
//
|
||||
// Either the Amazon Lex bot is still building, or one of the dependent services
|
||||
// (Amazon Polly, AWS Lambda) failed with an internal service error.
|
||||
ErrCodeBadGatewayException = "BadGatewayException"
|
||||
|
||||
// ErrCodeBadRequestException for service response error code
|
||||
// "BadRequestException".
|
||||
//
|
||||
// Request validation failed, there is no usable message in the context, or
|
||||
// the bot build failed.
|
||||
ErrCodeBadRequestException = "BadRequestException"
|
||||
|
||||
// ErrCodeConflictException for service response error code
|
||||
// "ConflictException".
|
||||
//
|
||||
// Two clients are using the same AWS account, Amazon Lex bot, and user ID.
|
||||
ErrCodeConflictException = "ConflictException"
|
||||
|
||||
// ErrCodeDependencyFailedException for service response error code
|
||||
// "DependencyFailedException".
|
||||
//
|
||||
// One of the downstream dependencies, such as AWS Lambda or Amazon Polly, threw
|
||||
// an exception. For example, if Amazon Lex does not have sufficient permissions
|
||||
// to call a Lambda function, it results in Lambda throwing an exception.
|
||||
ErrCodeDependencyFailedException = "DependencyFailedException"
|
||||
|
||||
// ErrCodeInternalFailureException for service response error code
|
||||
// "InternalFailureException".
|
||||
//
|
||||
// Internal service error. Retry the call.
|
||||
ErrCodeInternalFailureException = "InternalFailureException"
|
||||
|
||||
// ErrCodeLimitExceededException for service response error code
|
||||
// "LimitExceededException".
|
||||
//
|
||||
// Exceeded a limit.
|
||||
ErrCodeLimitExceededException = "LimitExceededException"
|
||||
|
||||
// ErrCodeLoopDetectedException for service response error code
|
||||
// "LoopDetectedException".
|
||||
//
|
||||
// Lambda fulfilment function returned DelegateDialogAction to Amazon Lex without
|
||||
// changing any slot values.
|
||||
ErrCodeLoopDetectedException = "LoopDetectedException"
|
||||
|
||||
// ErrCodeNotAcceptableException for service response error code
|
||||
// "NotAcceptableException".
|
||||
//
|
||||
// The accept header in the request does not have a valid value.
|
||||
ErrCodeNotAcceptableException = "NotAcceptableException"
|
||||
|
||||
// ErrCodeNotFoundException for service response error code
|
||||
// "NotFoundException".
|
||||
//
|
||||
// The resource (such as the Amazon Lex bot or an alias) that is referred to
|
||||
// is not found.
|
||||
ErrCodeNotFoundException = "NotFoundException"
|
||||
|
||||
// ErrCodeRequestTimeoutException for service response error code
|
||||
// "RequestTimeoutException".
|
||||
//
|
||||
// The input speech is too long.
|
||||
ErrCodeRequestTimeoutException = "RequestTimeoutException"
|
||||
|
||||
// ErrCodeUnsupportedMediaTypeException for service response error code
|
||||
// "UnsupportedMediaTypeException".
|
||||
//
|
||||
// The Content-Type header (PostContent API) has an invalid value.
|
||||
ErrCodeUnsupportedMediaTypeException = "UnsupportedMediaTypeException"
|
||||
)
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
package lexruntimeservice_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/session"
|
||||
"github.com/aws/aws-sdk-go/service/lexruntimeservice"
|
||||
)
|
||||
|
||||
var _ time.Duration
|
||||
var _ bytes.Buffer
|
||||
|
||||
func ExampleLexRuntimeService_PostContent() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := lexruntimeservice.New(sess)
|
||||
|
||||
params := &lexruntimeservice.PostContentInput{
|
||||
BotAlias: aws.String("BotAlias"), // Required
|
||||
BotName: aws.String("BotName"), // Required
|
||||
ContentType: aws.String("HttpContentType"), // Required
|
||||
InputStream: bytes.NewReader([]byte("PAYLOAD")), // Required
|
||||
UserId: aws.String("UserId"), // Required
|
||||
Accept: aws.String("Accept"),
|
||||
SessionAttributes: aws.JSONValue{"key": "value"},
|
||||
}
|
||||
resp, err := svc.PostContent(params)
|
||||
|
||||
if err != nil {
|
||||
// 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)
|
||||
}
|
||||
|
||||
func ExampleLexRuntimeService_PostText() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := lexruntimeservice.New(sess)
|
||||
|
||||
params := &lexruntimeservice.PostTextInput{
|
||||
BotAlias: aws.String("BotAlias"), // Required
|
||||
BotName: aws.String("BotName"), // Required
|
||||
InputText: aws.String("Text"), // Required
|
||||
UserId: aws.String("UserId"), // Required
|
||||
SessionAttributes: map[string]*string{
|
||||
"Key": aws.String("String"), // Required
|
||||
// More values...
|
||||
},
|
||||
}
|
||||
resp, err := svc.PostText(params)
|
||||
|
||||
if err != nil {
|
||||
// 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)
|
||||
}
|
||||
Generated
Vendored
+72
@@ -0,0 +1,72 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
// Package lexruntimeserviceiface provides an interface to enable mocking the Amazon Lex Runtime Service 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 lexruntimeserviceiface
|
||||
|
||||
import (
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/service/lexruntimeservice"
|
||||
)
|
||||
|
||||
// LexRuntimeServiceAPI provides an interface to enable mocking the
|
||||
// lexruntimeservice.LexRuntimeService 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 the SDK's request pipeline.
|
||||
//
|
||||
// // myFunc uses an SDK service client to make a request to
|
||||
// // Amazon Lex Runtime Service.
|
||||
// func myFunc(svc lexruntimeserviceiface.LexRuntimeServiceAPI) bool {
|
||||
// // Make svc.PostContent request
|
||||
// }
|
||||
//
|
||||
// func main() {
|
||||
// sess := session.New()
|
||||
// svc := lexruntimeservice.New(sess)
|
||||
//
|
||||
// myFunc(svc)
|
||||
// }
|
||||
//
|
||||
// In your _test.go file:
|
||||
//
|
||||
// // Define a mock struct to be used in your unit tests of myFunc.
|
||||
// type mockLexRuntimeServiceClient struct {
|
||||
// lexruntimeserviceiface.LexRuntimeServiceAPI
|
||||
// }
|
||||
// func (m *mockLexRuntimeServiceClient) PostContent(input *lexruntimeservice.PostContentInput) (*lexruntimeservice.PostContentOutput, error) {
|
||||
// // mock response/functionality
|
||||
// }
|
||||
//
|
||||
// func TestMyFunc(t *testing.T) {
|
||||
// // Setup Test
|
||||
// mockSvc := &mockLexRuntimeServiceClient{}
|
||||
//
|
||||
// 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 LexRuntimeServiceAPI interface {
|
||||
PostContent(*lexruntimeservice.PostContentInput) (*lexruntimeservice.PostContentOutput, error)
|
||||
PostContentWithContext(aws.Context, *lexruntimeservice.PostContentInput, ...request.Option) (*lexruntimeservice.PostContentOutput, error)
|
||||
PostContentRequest(*lexruntimeservice.PostContentInput) (*request.Request, *lexruntimeservice.PostContentOutput)
|
||||
|
||||
PostText(*lexruntimeservice.PostTextInput) (*lexruntimeservice.PostTextOutput, error)
|
||||
PostTextWithContext(aws.Context, *lexruntimeservice.PostTextInput, ...request.Option) (*lexruntimeservice.PostTextOutput, error)
|
||||
PostTextRequest(*lexruntimeservice.PostTextInput) (*request.Request, *lexruntimeservice.PostTextOutput)
|
||||
}
|
||||
|
||||
var _ LexRuntimeServiceAPI = (*lexruntimeservice.LexRuntimeService)(nil)
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
package lexruntimeservice
|
||||
|
||||
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"
|
||||
)
|
||||
|
||||
// LexRuntimeService provides the API operation methods for making requests to
|
||||
// Amazon Lex Runtime Service. See this package's package overview docs
|
||||
// for details on the service.
|
||||
//
|
||||
// LexRuntimeService methods are safe to use concurrently. It is not safe to
|
||||
// modify mutate any of the struct's properties though.
|
||||
type LexRuntimeService 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 = "runtime.lex" // Service endpoint prefix API calls made to.
|
||||
EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata.
|
||||
)
|
||||
|
||||
// New creates a new instance of the LexRuntimeService 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 LexRuntimeService client from just a session.
|
||||
// svc := lexruntimeservice.New(mySession)
|
||||
//
|
||||
// // Create a LexRuntimeService client with additional configuration
|
||||
// svc := lexruntimeservice.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
|
||||
func New(p client.ConfigProvider, cfgs ...*aws.Config) *LexRuntimeService {
|
||||
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) *LexRuntimeService {
|
||||
if len(signingName) == 0 {
|
||||
signingName = "lex"
|
||||
}
|
||||
svc := &LexRuntimeService{
|
||||
Client: client.New(
|
||||
cfg,
|
||||
metadata.ClientInfo{
|
||||
ServiceName: ServiceName,
|
||||
SigningName: signingName,
|
||||
SigningRegion: signingRegion,
|
||||
Endpoint: endpoint,
|
||||
APIVersion: "2016-11-28",
|
||||
JSONVersion: "1.1",
|
||||
},
|
||||
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 LexRuntimeService operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *LexRuntimeService) 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
|
||||
}
|
||||
Reference in New Issue
Block a user