{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.LexV2Models.Types.BotImportSpecification
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.LexV2Models.Types.BotImportSpecification where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LexV2Models.Types.DataPrivacy
import qualified Amazonka.Prelude as Prelude

-- | Provides the bot parameters required for importing a bot.
--
-- /See:/ 'newBotImportSpecification' smart constructor.
data BotImportSpecification = BotImportSpecification'
  { -- | A list of tags to add to the bot. You can only add tags when you import
    -- a bot. You can\'t use the @UpdateBot@ operation to update tags. To
    -- update tags, use the @TagResource@ operation.
    BotImportSpecification -> Maybe (HashMap Text Text)
botTags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The time, in seconds, that Amazon Lex should keep information about a
    -- user\'s conversation with the bot.
    --
    -- A user interaction remains active for the amount of time specified. If
    -- no conversation occurs during this time, the session expires and Amazon
    -- Lex deletes any data provided before the timeout.
    --
    -- You can specify between 60 (1 minute) and 86,400 (24 hours) seconds.
    BotImportSpecification -> Maybe Natural
idleSessionTTLInSeconds :: Prelude.Maybe Prelude.Natural,
    -- | A list of tags to add to the test alias for a bot. You can only add tags
    -- when you import a bot. You can\'t use the @UpdateAlias@ operation to
    -- update tags. To update tags on the test alias, use the @TagResource@
    -- operation.
    BotImportSpecification -> Maybe (HashMap Text Text)
testBotAliasTags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The name that Amazon Lex should use for the bot.
    BotImportSpecification -> Text
botName :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the IAM role used to build and run the
    -- bot.
    BotImportSpecification -> Text
roleArn :: Prelude.Text,
    BotImportSpecification -> DataPrivacy
dataPrivacy :: DataPrivacy
  }
  deriving (BotImportSpecification -> BotImportSpecification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BotImportSpecification -> BotImportSpecification -> Bool
$c/= :: BotImportSpecification -> BotImportSpecification -> Bool
== :: BotImportSpecification -> BotImportSpecification -> Bool
$c== :: BotImportSpecification -> BotImportSpecification -> Bool
Prelude.Eq, ReadPrec [BotImportSpecification]
ReadPrec BotImportSpecification
Int -> ReadS BotImportSpecification
ReadS [BotImportSpecification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BotImportSpecification]
$creadListPrec :: ReadPrec [BotImportSpecification]
readPrec :: ReadPrec BotImportSpecification
$creadPrec :: ReadPrec BotImportSpecification
readList :: ReadS [BotImportSpecification]
$creadList :: ReadS [BotImportSpecification]
readsPrec :: Int -> ReadS BotImportSpecification
$creadsPrec :: Int -> ReadS BotImportSpecification
Prelude.Read, Int -> BotImportSpecification -> ShowS
[BotImportSpecification] -> ShowS
BotImportSpecification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BotImportSpecification] -> ShowS
$cshowList :: [BotImportSpecification] -> ShowS
show :: BotImportSpecification -> String
$cshow :: BotImportSpecification -> String
showsPrec :: Int -> BotImportSpecification -> ShowS
$cshowsPrec :: Int -> BotImportSpecification -> ShowS
Prelude.Show, forall x. Rep BotImportSpecification x -> BotImportSpecification
forall x. BotImportSpecification -> Rep BotImportSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BotImportSpecification x -> BotImportSpecification
$cfrom :: forall x. BotImportSpecification -> Rep BotImportSpecification x
Prelude.Generic)

-- |
-- Create a value of 'BotImportSpecification' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'botTags', 'botImportSpecification_botTags' - A list of tags to add to the bot. You can only add tags when you import
-- a bot. You can\'t use the @UpdateBot@ operation to update tags. To
-- update tags, use the @TagResource@ operation.
--
-- 'idleSessionTTLInSeconds', 'botImportSpecification_idleSessionTTLInSeconds' - The time, in seconds, that Amazon Lex should keep information about a
-- user\'s conversation with the bot.
--
-- A user interaction remains active for the amount of time specified. If
-- no conversation occurs during this time, the session expires and Amazon
-- Lex deletes any data provided before the timeout.
--
-- You can specify between 60 (1 minute) and 86,400 (24 hours) seconds.
--
-- 'testBotAliasTags', 'botImportSpecification_testBotAliasTags' - A list of tags to add to the test alias for a bot. You can only add tags
-- when you import a bot. You can\'t use the @UpdateAlias@ operation to
-- update tags. To update tags on the test alias, use the @TagResource@
-- operation.
--
-- 'botName', 'botImportSpecification_botName' - The name that Amazon Lex should use for the bot.
--
-- 'roleArn', 'botImportSpecification_roleArn' - The Amazon Resource Name (ARN) of the IAM role used to build and run the
-- bot.
--
-- 'dataPrivacy', 'botImportSpecification_dataPrivacy' - Undocumented member.
newBotImportSpecification ::
  -- | 'botName'
  Prelude.Text ->
  -- | 'roleArn'
  Prelude.Text ->
  -- | 'dataPrivacy'
  DataPrivacy ->
  BotImportSpecification
newBotImportSpecification :: Text -> Text -> DataPrivacy -> BotImportSpecification
newBotImportSpecification
  Text
pBotName_
  Text
pRoleArn_
  DataPrivacy
pDataPrivacy_ =
    BotImportSpecification'
      { $sel:botTags:BotImportSpecification' :: Maybe (HashMap Text Text)
botTags = forall a. Maybe a
Prelude.Nothing,
        $sel:idleSessionTTLInSeconds:BotImportSpecification' :: Maybe Natural
idleSessionTTLInSeconds = forall a. Maybe a
Prelude.Nothing,
        $sel:testBotAliasTags:BotImportSpecification' :: Maybe (HashMap Text Text)
testBotAliasTags = forall a. Maybe a
Prelude.Nothing,
        $sel:botName:BotImportSpecification' :: Text
botName = Text
pBotName_,
        $sel:roleArn:BotImportSpecification' :: Text
roleArn = Text
pRoleArn_,
        $sel:dataPrivacy:BotImportSpecification' :: DataPrivacy
dataPrivacy = DataPrivacy
pDataPrivacy_
      }

-- | A list of tags to add to the bot. You can only add tags when you import
-- a bot. You can\'t use the @UpdateBot@ operation to update tags. To
-- update tags, use the @TagResource@ operation.
botImportSpecification_botTags :: Lens.Lens' BotImportSpecification (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
botImportSpecification_botTags :: Lens' BotImportSpecification (Maybe (HashMap Text Text))
botImportSpecification_botTags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BotImportSpecification' {Maybe (HashMap Text Text)
botTags :: Maybe (HashMap Text Text)
$sel:botTags:BotImportSpecification' :: BotImportSpecification -> Maybe (HashMap Text Text)
botTags} -> Maybe (HashMap Text Text)
botTags) (\s :: BotImportSpecification
s@BotImportSpecification' {} Maybe (HashMap Text Text)
a -> BotImportSpecification
s {$sel:botTags:BotImportSpecification' :: Maybe (HashMap Text Text)
botTags = Maybe (HashMap Text Text)
a} :: BotImportSpecification) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The time, in seconds, that Amazon Lex should keep information about a
-- user\'s conversation with the bot.
--
-- A user interaction remains active for the amount of time specified. If
-- no conversation occurs during this time, the session expires and Amazon
-- Lex deletes any data provided before the timeout.
--
-- You can specify between 60 (1 minute) and 86,400 (24 hours) seconds.
botImportSpecification_idleSessionTTLInSeconds :: Lens.Lens' BotImportSpecification (Prelude.Maybe Prelude.Natural)
botImportSpecification_idleSessionTTLInSeconds :: Lens' BotImportSpecification (Maybe Natural)
botImportSpecification_idleSessionTTLInSeconds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BotImportSpecification' {Maybe Natural
idleSessionTTLInSeconds :: Maybe Natural
$sel:idleSessionTTLInSeconds:BotImportSpecification' :: BotImportSpecification -> Maybe Natural
idleSessionTTLInSeconds} -> Maybe Natural
idleSessionTTLInSeconds) (\s :: BotImportSpecification
s@BotImportSpecification' {} Maybe Natural
a -> BotImportSpecification
s {$sel:idleSessionTTLInSeconds:BotImportSpecification' :: Maybe Natural
idleSessionTTLInSeconds = Maybe Natural
a} :: BotImportSpecification)

-- | A list of tags to add to the test alias for a bot. You can only add tags
-- when you import a bot. You can\'t use the @UpdateAlias@ operation to
-- update tags. To update tags on the test alias, use the @TagResource@
-- operation.
botImportSpecification_testBotAliasTags :: Lens.Lens' BotImportSpecification (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
botImportSpecification_testBotAliasTags :: Lens' BotImportSpecification (Maybe (HashMap Text Text))
botImportSpecification_testBotAliasTags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BotImportSpecification' {Maybe (HashMap Text Text)
testBotAliasTags :: Maybe (HashMap Text Text)
$sel:testBotAliasTags:BotImportSpecification' :: BotImportSpecification -> Maybe (HashMap Text Text)
testBotAliasTags} -> Maybe (HashMap Text Text)
testBotAliasTags) (\s :: BotImportSpecification
s@BotImportSpecification' {} Maybe (HashMap Text Text)
a -> BotImportSpecification
s {$sel:testBotAliasTags:BotImportSpecification' :: Maybe (HashMap Text Text)
testBotAliasTags = Maybe (HashMap Text Text)
a} :: BotImportSpecification) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name that Amazon Lex should use for the bot.
botImportSpecification_botName :: Lens.Lens' BotImportSpecification Prelude.Text
botImportSpecification_botName :: Lens' BotImportSpecification Text
botImportSpecification_botName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BotImportSpecification' {Text
botName :: Text
$sel:botName:BotImportSpecification' :: BotImportSpecification -> Text
botName} -> Text
botName) (\s :: BotImportSpecification
s@BotImportSpecification' {} Text
a -> BotImportSpecification
s {$sel:botName:BotImportSpecification' :: Text
botName = Text
a} :: BotImportSpecification)

-- | The Amazon Resource Name (ARN) of the IAM role used to build and run the
-- bot.
botImportSpecification_roleArn :: Lens.Lens' BotImportSpecification Prelude.Text
botImportSpecification_roleArn :: Lens' BotImportSpecification Text
botImportSpecification_roleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BotImportSpecification' {Text
roleArn :: Text
$sel:roleArn:BotImportSpecification' :: BotImportSpecification -> Text
roleArn} -> Text
roleArn) (\s :: BotImportSpecification
s@BotImportSpecification' {} Text
a -> BotImportSpecification
s {$sel:roleArn:BotImportSpecification' :: Text
roleArn = Text
a} :: BotImportSpecification)

-- | Undocumented member.
botImportSpecification_dataPrivacy :: Lens.Lens' BotImportSpecification DataPrivacy
botImportSpecification_dataPrivacy :: Lens' BotImportSpecification DataPrivacy
botImportSpecification_dataPrivacy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BotImportSpecification' {DataPrivacy
dataPrivacy :: DataPrivacy
$sel:dataPrivacy:BotImportSpecification' :: BotImportSpecification -> DataPrivacy
dataPrivacy} -> DataPrivacy
dataPrivacy) (\s :: BotImportSpecification
s@BotImportSpecification' {} DataPrivacy
a -> BotImportSpecification
s {$sel:dataPrivacy:BotImportSpecification' :: DataPrivacy
dataPrivacy = DataPrivacy
a} :: BotImportSpecification)

instance Data.FromJSON BotImportSpecification where
  parseJSON :: Value -> Parser BotImportSpecification
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BotImportSpecification"
      ( \Object
x ->
          Maybe (HashMap Text Text)
-> Maybe Natural
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> DataPrivacy
-> BotImportSpecification
BotImportSpecification'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"botTags" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"idleSessionTTLInSeconds")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"testBotAliasTags"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"botName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"roleArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"dataPrivacy")
      )

instance Prelude.Hashable BotImportSpecification where
  hashWithSalt :: Int -> BotImportSpecification -> Int
hashWithSalt Int
_salt BotImportSpecification' {Maybe Natural
Maybe (HashMap Text Text)
Text
DataPrivacy
dataPrivacy :: DataPrivacy
roleArn :: Text
botName :: Text
testBotAliasTags :: Maybe (HashMap Text Text)
idleSessionTTLInSeconds :: Maybe Natural
botTags :: Maybe (HashMap Text Text)
$sel:dataPrivacy:BotImportSpecification' :: BotImportSpecification -> DataPrivacy
$sel:roleArn:BotImportSpecification' :: BotImportSpecification -> Text
$sel:botName:BotImportSpecification' :: BotImportSpecification -> Text
$sel:testBotAliasTags:BotImportSpecification' :: BotImportSpecification -> Maybe (HashMap Text Text)
$sel:idleSessionTTLInSeconds:BotImportSpecification' :: BotImportSpecification -> Maybe Natural
$sel:botTags:BotImportSpecification' :: BotImportSpecification -> Maybe (HashMap Text Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
botTags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
idleSessionTTLInSeconds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
testBotAliasTags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
botName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
roleArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DataPrivacy
dataPrivacy

instance Prelude.NFData BotImportSpecification where
  rnf :: BotImportSpecification -> ()
rnf BotImportSpecification' {Maybe Natural
Maybe (HashMap Text Text)
Text
DataPrivacy
dataPrivacy :: DataPrivacy
roleArn :: Text
botName :: Text
testBotAliasTags :: Maybe (HashMap Text Text)
idleSessionTTLInSeconds :: Maybe Natural
botTags :: Maybe (HashMap Text Text)
$sel:dataPrivacy:BotImportSpecification' :: BotImportSpecification -> DataPrivacy
$sel:roleArn:BotImportSpecification' :: BotImportSpecification -> Text
$sel:botName:BotImportSpecification' :: BotImportSpecification -> Text
$sel:testBotAliasTags:BotImportSpecification' :: BotImportSpecification -> Maybe (HashMap Text Text)
$sel:idleSessionTTLInSeconds:BotImportSpecification' :: BotImportSpecification -> Maybe Natural
$sel:botTags:BotImportSpecification' :: BotImportSpecification -> Maybe (HashMap Text Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
botTags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
idleSessionTTLInSeconds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
testBotAliasTags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
botName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
roleArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf DataPrivacy
dataPrivacy

instance Data.ToJSON BotImportSpecification where
  toJSON :: BotImportSpecification -> Value
toJSON BotImportSpecification' {Maybe Natural
Maybe (HashMap Text Text)
Text
DataPrivacy
dataPrivacy :: DataPrivacy
roleArn :: Text
botName :: Text
testBotAliasTags :: Maybe (HashMap Text Text)
idleSessionTTLInSeconds :: Maybe Natural
botTags :: Maybe (HashMap Text Text)
$sel:dataPrivacy:BotImportSpecification' :: BotImportSpecification -> DataPrivacy
$sel:roleArn:BotImportSpecification' :: BotImportSpecification -> Text
$sel:botName:BotImportSpecification' :: BotImportSpecification -> Text
$sel:testBotAliasTags:BotImportSpecification' :: BotImportSpecification -> Maybe (HashMap Text Text)
$sel:idleSessionTTLInSeconds:BotImportSpecification' :: BotImportSpecification -> Maybe Natural
$sel:botTags:BotImportSpecification' :: BotImportSpecification -> Maybe (HashMap Text Text)
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"botTags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
botTags,
            (Key
"idleSessionTTLInSeconds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
idleSessionTTLInSeconds,
            (Key
"testBotAliasTags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
testBotAliasTags,
            forall a. a -> Maybe a
Prelude.Just (Key
"botName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
botName),
            forall a. a -> Maybe a
Prelude.Just (Key
"roleArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
roleArn),
            forall a. a -> Maybe a
Prelude.Just (Key
"dataPrivacy" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= DataPrivacy
dataPrivacy)
          ]
      )