From 5842b42d4a55c2ce5ecc74155f5322ac9c9b166a Mon Sep 17 00:00:00 2001 From: Seth <18116602+sethkor@users.noreply.github.com> Date: Wed, 16 Sep 2020 21:07:04 +1000 Subject: [PATCH 1/3] Fix bug with setting name --- bot.go | 6 +++--- lexbelt.go | 4 ++-- provisioner.go | 12 ++++++------ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/bot.go b/bot.go index ee5d65c..a0f7957 100644 --- a/bot.go +++ b/bot.go @@ -13,7 +13,7 @@ type botYaml struct { LexBot *lexmodelbuildingservice.PutBotInput `locationName:"lexBot" type:"structure"` } -func putBot(svc *lexmodelbuildingservice.LexModelBuildingService, file string, poll int) { +func putBot(svc *lexmodelbuildingservice.LexModelBuildingService, file string, name string, poll int) { var myBot botYaml readAndUnmarshal(file, &myBot) @@ -22,8 +22,8 @@ func putBot(svc *lexmodelbuildingservice.LexModelBuildingService, file string, p log.Fatal("Yaml file is not as expected, please check your syntax.") } - if *putBotCommandName != "" { - myBot.LexBot.Name = putBotCommandName + if name != "" { + myBot.LexBot.Name = &name } getResult, err := svc.GetBot(&lexmodelbuildingservice.GetBotInput{ diff --git a/lexbelt.go b/lexbelt.go index 8722963..d58cdcb 100644 --- a/lexbelt.go +++ b/lexbelt.go @@ -88,9 +88,9 @@ func main() { case putIntentCommand.FullCommand(): putIntent(svc, (*putIntentCommandFile).Name()) case putBotCommand.FullCommand(): - putBot(svc, (*putBotCommandFile).Name(), *putBotCommandPoll) + putBot(svc, (*putBotCommandFile).Name(), *putBotCommandName, *putBotCommandPoll) case provisionCommand.FullCommand(): - provision(svc, (*provisionCommandFile).Name(), *provisionCommandPoll) + provision(svc, (*provisionCommandFile).Name(), *provisionCommandName, *provisionCommandPoll) } } diff --git a/provisioner.go b/provisioner.go index 56fa93f..0beaae0 100644 --- a/provisioner.go +++ b/provisioner.go @@ -24,7 +24,7 @@ type provisionerSpecification struct { } `locationName:"lexBotProvisioner" type:"structure"` } -func provision(svc *lexmodelbuildingservice.LexModelBuildingService, file string, poll int) { +func provision(svc *lexmodelbuildingservice.LexModelBuildingService, file string, name string, poll int) { var myProvisionerSpecification provisionerSpecification readAndUnmarshal(file, &myProvisionerSpecification) @@ -34,11 +34,11 @@ func provision(svc *lexmodelbuildingservice.LexModelBuildingService, file string } var myProvisioner provisioner - if *provisionCommandName != "" { - myProvisioner.LexBot.Name = putIntentCommandName - } else { - myProvisioner.LexBot.Name = myProvisionerSpecification.LexBotProvisioner.LexBotName + + if name == "" { + name = *myProvisionerSpecification.LexBotProvisioner.LexBotName } + myProvisioner.LexBot.Name = &name //based on the mono bot yaml, load slots, intents and the bot and provision in the correct order @@ -59,6 +59,6 @@ func provision(svc *lexmodelbuildingservice.LexModelBuildingService, file string //lastly the bot fmt.Println("Adding the bot and building it") - putBot(svc, basePath+"bots"+separator+*myProvisionerSpecification.LexBotProvisioner.LexBot, poll) + putBot(svc, basePath+"bots"+separator+*myProvisionerSpecification.LexBotProvisioner.LexBot, name, poll) } From b3b2a4cc7683f68e7f33347f5cc5051327f1258f Mon Sep 17 00:00:00 2001 From: Seth <18116602+sethkor@users.noreply.github.com> Date: Wed, 16 Sep 2020 21:09:52 +1000 Subject: [PATCH 2/3] Fix bug with setting name --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index daef857..85e9bd8 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,7 @@ your-lex-workspace ├──bots └──monobot ``` +When using the provision command for a mono bot, the `--name` flag is optional. If it is not present `lexbelt` will use the `lexBotName` in the monobot specification file. You can take a look at examples/yaml/monobot/OrderFlowersMono.yaml to see an example monobot yaml file like so: ``` From d437e4686384f1e20a5d4f46420ff760ff0db274 Mon Sep 17 00:00:00 2001 From: Seth <18116602+sethkor@users.noreply.github.com> Date: Wed, 16 Sep 2020 21:10:41 +1000 Subject: [PATCH 3/3] Remove usnused config file --- examples/yaml/config.yaml | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 examples/yaml/config.yaml diff --git a/examples/yaml/config.yaml b/examples/yaml/config.yaml deleted file mode 100644 index 711d61e..0000000 --- a/examples/yaml/config.yaml +++ /dev/null @@ -1,2 +0,0 @@ -region: ap-southeast-2 -profile: versent \ No newline at end of file