rclone/vendor/github.com/aws/aws-sdk-go/service/lexmodelbuildingservice/examples_test.go

902 lines
24 KiB
Go

// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package lexmodelbuildingservice_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/lexmodelbuildingservice"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleLexModelBuildingService_CreateBotVersion() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.CreateBotVersionInput{
Name: aws.String("BotName"), // Required
Checksum: aws.String("String"),
}
resp, err := svc.CreateBotVersion(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 ExampleLexModelBuildingService_CreateIntentVersion() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.CreateIntentVersionInput{
Name: aws.String("IntentName"), // Required
Checksum: aws.String("String"),
}
resp, err := svc.CreateIntentVersion(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 ExampleLexModelBuildingService_CreateSlotTypeVersion() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.CreateSlotTypeVersionInput{
Name: aws.String("SlotTypeName"), // Required
Checksum: aws.String("String"),
}
resp, err := svc.CreateSlotTypeVersion(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 ExampleLexModelBuildingService_DeleteBot() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.DeleteBotInput{
Name: aws.String("BotName"), // Required
}
resp, err := svc.DeleteBot(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 ExampleLexModelBuildingService_DeleteBotAlias() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.DeleteBotAliasInput{
BotName: aws.String("BotName"), // Required
Name: aws.String("AliasName"), // Required
}
resp, err := svc.DeleteBotAlias(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 ExampleLexModelBuildingService_DeleteBotChannelAssociation() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.DeleteBotChannelAssociationInput{
BotAlias: aws.String("AliasName"), // Required
BotName: aws.String("BotName"), // Required
Name: aws.String("BotChannelName"), // Required
}
resp, err := svc.DeleteBotChannelAssociation(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 ExampleLexModelBuildingService_DeleteBotVersion() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.DeleteBotVersionInput{
Name: aws.String("BotName"), // Required
Version: aws.String("NumericalVersion"), // Required
}
resp, err := svc.DeleteBotVersion(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 ExampleLexModelBuildingService_DeleteIntent() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.DeleteIntentInput{
Name: aws.String("IntentName"), // Required
}
resp, err := svc.DeleteIntent(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 ExampleLexModelBuildingService_DeleteIntentVersion() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.DeleteIntentVersionInput{
Name: aws.String("IntentName"), // Required
Version: aws.String("NumericalVersion"), // Required
}
resp, err := svc.DeleteIntentVersion(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 ExampleLexModelBuildingService_DeleteSlotType() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.DeleteSlotTypeInput{
Name: aws.String("SlotTypeName"), // Required
}
resp, err := svc.DeleteSlotType(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 ExampleLexModelBuildingService_DeleteSlotTypeVersion() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.DeleteSlotTypeVersionInput{
Name: aws.String("SlotTypeName"), // Required
Version: aws.String("NumericalVersion"), // Required
}
resp, err := svc.DeleteSlotTypeVersion(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 ExampleLexModelBuildingService_DeleteUtterances() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.DeleteUtterancesInput{
BotName: aws.String("BotName"), // Required
UserId: aws.String("UserId"), // Required
}
resp, err := svc.DeleteUtterances(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 ExampleLexModelBuildingService_GetBot() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.GetBotInput{
Name: aws.String("BotName"), // Required
VersionOrAlias: aws.String("String"), // Required
}
resp, err := svc.GetBot(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 ExampleLexModelBuildingService_GetBotAlias() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.GetBotAliasInput{
BotName: aws.String("BotName"), // Required
Name: aws.String("AliasName"), // Required
}
resp, err := svc.GetBotAlias(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 ExampleLexModelBuildingService_GetBotAliases() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.GetBotAliasesInput{
BotName: aws.String("BotName"), // Required
MaxResults: aws.Int64(1),
NameContains: aws.String("AliasName"),
NextToken: aws.String("NextToken"),
}
resp, err := svc.GetBotAliases(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 ExampleLexModelBuildingService_GetBotChannelAssociation() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.GetBotChannelAssociationInput{
BotAlias: aws.String("AliasName"), // Required
BotName: aws.String("BotName"), // Required
Name: aws.String("BotChannelName"), // Required
}
resp, err := svc.GetBotChannelAssociation(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 ExampleLexModelBuildingService_GetBotChannelAssociations() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.GetBotChannelAssociationsInput{
BotAlias: aws.String("AliasNameOrListAll"), // Required
BotName: aws.String("BotName"), // Required
MaxResults: aws.Int64(1),
NameContains: aws.String("BotChannelName"),
NextToken: aws.String("NextToken"),
}
resp, err := svc.GetBotChannelAssociations(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 ExampleLexModelBuildingService_GetBotVersions() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.GetBotVersionsInput{
Name: aws.String("BotName"), // Required
MaxResults: aws.Int64(1),
NextToken: aws.String("NextToken"),
}
resp, err := svc.GetBotVersions(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 ExampleLexModelBuildingService_GetBots() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.GetBotsInput{
MaxResults: aws.Int64(1),
NameContains: aws.String("BotName"),
NextToken: aws.String("NextToken"),
}
resp, err := svc.GetBots(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 ExampleLexModelBuildingService_GetBuiltinIntent() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.GetBuiltinIntentInput{
Signature: aws.String("BuiltinIntentSignature"), // Required
}
resp, err := svc.GetBuiltinIntent(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 ExampleLexModelBuildingService_GetBuiltinIntents() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.GetBuiltinIntentsInput{
Locale: aws.String("Locale"),
MaxResults: aws.Int64(1),
NextToken: aws.String("NextToken"),
SignatureContains: aws.String("String"),
}
resp, err := svc.GetBuiltinIntents(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 ExampleLexModelBuildingService_GetBuiltinSlotTypes() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.GetBuiltinSlotTypesInput{
Locale: aws.String("Locale"),
MaxResults: aws.Int64(1),
NextToken: aws.String("NextToken"),
SignatureContains: aws.String("String"),
}
resp, err := svc.GetBuiltinSlotTypes(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 ExampleLexModelBuildingService_GetIntent() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.GetIntentInput{
Name: aws.String("IntentName"), // Required
Version: aws.String("Version"), // Required
}
resp, err := svc.GetIntent(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 ExampleLexModelBuildingService_GetIntentVersions() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.GetIntentVersionsInput{
Name: aws.String("IntentName"), // Required
MaxResults: aws.Int64(1),
NextToken: aws.String("NextToken"),
}
resp, err := svc.GetIntentVersions(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 ExampleLexModelBuildingService_GetIntents() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.GetIntentsInput{
MaxResults: aws.Int64(1),
NameContains: aws.String("IntentName"),
NextToken: aws.String("NextToken"),
}
resp, err := svc.GetIntents(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 ExampleLexModelBuildingService_GetSlotType() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.GetSlotTypeInput{
Name: aws.String("SlotTypeName"), // Required
Version: aws.String("Version"), // Required
}
resp, err := svc.GetSlotType(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 ExampleLexModelBuildingService_GetSlotTypeVersions() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.GetSlotTypeVersionsInput{
Name: aws.String("SlotTypeName"), // Required
MaxResults: aws.Int64(1),
NextToken: aws.String("NextToken"),
}
resp, err := svc.GetSlotTypeVersions(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 ExampleLexModelBuildingService_GetSlotTypes() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.GetSlotTypesInput{
MaxResults: aws.Int64(1),
NameContains: aws.String("SlotTypeName"),
NextToken: aws.String("NextToken"),
}
resp, err := svc.GetSlotTypes(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 ExampleLexModelBuildingService_GetUtterancesView() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.GetUtterancesViewInput{
BotName: aws.String("BotName"), // Required
BotVersions: []*string{ // Required
aws.String("Version"), // Required
// More values...
},
StatusType: aws.String("StatusType"), // Required
}
resp, err := svc.GetUtterancesView(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 ExampleLexModelBuildingService_PutBot() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.PutBotInput{
ChildDirected: aws.Bool(true), // Required
Locale: aws.String("Locale"), // Required
Name: aws.String("BotName"), // Required
AbortStatement: &lexmodelbuildingservice.Statement{
Messages: []*lexmodelbuildingservice.Message{ // Required
{ // Required
Content: aws.String("ContentString"), // Required
ContentType: aws.String("ContentType"), // Required
},
// More values...
},
ResponseCard: aws.String("ResponseCard"),
},
Checksum: aws.String("String"),
ClarificationPrompt: &lexmodelbuildingservice.Prompt{
MaxAttempts: aws.Int64(1), // Required
Messages: []*lexmodelbuildingservice.Message{ // Required
{ // Required
Content: aws.String("ContentString"), // Required
ContentType: aws.String("ContentType"), // Required
},
// More values...
},
ResponseCard: aws.String("ResponseCard"),
},
Description: aws.String("Description"),
IdleSessionTTLInSeconds: aws.Int64(1),
Intents: []*lexmodelbuildingservice.Intent{
{ // Required
IntentName: aws.String("IntentName"), // Required
IntentVersion: aws.String("Version"), // Required
},
// More values...
},
ProcessBehavior: aws.String("ProcessBehavior"),
VoiceId: aws.String("String"),
}
resp, err := svc.PutBot(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 ExampleLexModelBuildingService_PutBotAlias() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.PutBotAliasInput{
BotName: aws.String("BotName"), // Required
BotVersion: aws.String("Version"), // Required
Name: aws.String("AliasName"), // Required
Checksum: aws.String("String"),
Description: aws.String("Description"),
}
resp, err := svc.PutBotAlias(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 ExampleLexModelBuildingService_PutIntent() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.PutIntentInput{
Name: aws.String("IntentName"), // Required
Checksum: aws.String("String"),
ConclusionStatement: &lexmodelbuildingservice.Statement{
Messages: []*lexmodelbuildingservice.Message{ // Required
{ // Required
Content: aws.String("ContentString"), // Required
ContentType: aws.String("ContentType"), // Required
},
// More values...
},
ResponseCard: aws.String("ResponseCard"),
},
ConfirmationPrompt: &lexmodelbuildingservice.Prompt{
MaxAttempts: aws.Int64(1), // Required
Messages: []*lexmodelbuildingservice.Message{ // Required
{ // Required
Content: aws.String("ContentString"), // Required
ContentType: aws.String("ContentType"), // Required
},
// More values...
},
ResponseCard: aws.String("ResponseCard"),
},
Description: aws.String("Description"),
DialogCodeHook: &lexmodelbuildingservice.CodeHook{
MessageVersion: aws.String("MessageVersion"), // Required
Uri: aws.String("LambdaARN"), // Required
},
FollowUpPrompt: &lexmodelbuildingservice.FollowUpPrompt{
Prompt: &lexmodelbuildingservice.Prompt{ // Required
MaxAttempts: aws.Int64(1), // Required
Messages: []*lexmodelbuildingservice.Message{ // Required
{ // Required
Content: aws.String("ContentString"), // Required
ContentType: aws.String("ContentType"), // Required
},
// More values...
},
ResponseCard: aws.String("ResponseCard"),
},
RejectionStatement: &lexmodelbuildingservice.Statement{ // Required
Messages: []*lexmodelbuildingservice.Message{ // Required
{ // Required
Content: aws.String("ContentString"), // Required
ContentType: aws.String("ContentType"), // Required
},
// More values...
},
ResponseCard: aws.String("ResponseCard"),
},
},
FulfillmentActivity: &lexmodelbuildingservice.FulfillmentActivity{
Type: aws.String("FulfillmentActivityType"), // Required
CodeHook: &lexmodelbuildingservice.CodeHook{
MessageVersion: aws.String("MessageVersion"), // Required
Uri: aws.String("LambdaARN"), // Required
},
},
ParentIntentSignature: aws.String("BuiltinIntentSignature"),
RejectionStatement: &lexmodelbuildingservice.Statement{
Messages: []*lexmodelbuildingservice.Message{ // Required
{ // Required
Content: aws.String("ContentString"), // Required
ContentType: aws.String("ContentType"), // Required
},
// More values...
},
ResponseCard: aws.String("ResponseCard"),
},
SampleUtterances: []*string{
aws.String("Utterance"), // Required
// More values...
},
Slots: []*lexmodelbuildingservice.Slot{
{ // Required
Name: aws.String("SlotName"), // Required
SlotConstraint: aws.String("SlotConstraint"), // Required
Description: aws.String("Description"),
Priority: aws.Int64(1),
ResponseCard: aws.String("ResponseCard"),
SampleUtterances: []*string{
aws.String("Utterance"), // Required
// More values...
},
SlotType: aws.String("CustomOrBuiltinSlotTypeName"),
SlotTypeVersion: aws.String("Version"),
ValueElicitationPrompt: &lexmodelbuildingservice.Prompt{
MaxAttempts: aws.Int64(1), // Required
Messages: []*lexmodelbuildingservice.Message{ // Required
{ // Required
Content: aws.String("ContentString"), // Required
ContentType: aws.String("ContentType"), // Required
},
// More values...
},
ResponseCard: aws.String("ResponseCard"),
},
},
// More values...
},
}
resp, err := svc.PutIntent(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 ExampleLexModelBuildingService_PutSlotType() {
sess := session.Must(session.NewSession())
svc := lexmodelbuildingservice.New(sess)
params := &lexmodelbuildingservice.PutSlotTypeInput{
Name: aws.String("SlotTypeName"), // Required
Checksum: aws.String("String"),
Description: aws.String("Description"),
EnumerationValues: []*lexmodelbuildingservice.EnumerationValue{
{ // Required
Value: aws.String("Value"), // Required
},
// More values...
},
}
resp, err := svc.PutSlotType(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)
}