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

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

-- |
-- Module      : Amazonka.LexModels.StartMigration
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Starts migrating a bot from Amazon Lex V1 to Amazon Lex V2. Migrate your
-- bot when you want to take advantage of the new features of Amazon Lex
-- V2.
--
-- For more information, see
-- <https://docs.aws.amazon.com/lex/latest/dg/migrate.html Migrating a bot>
-- in the /Amazon Lex developer guide/.
module Amazonka.LexModels.StartMigration
  ( -- * Creating a Request
    StartMigration (..),
    newStartMigration,

    -- * Request Lenses
    startMigration_v1BotName,
    startMigration_v1BotVersion,
    startMigration_v2BotName,
    startMigration_v2BotRole,
    startMigration_migrationStrategy,

    -- * Destructuring the Response
    StartMigrationResponse (..),
    newStartMigrationResponse,

    -- * Response Lenses
    startMigrationResponse_v1BotVersion,
    startMigrationResponse_migrationStrategy,
    startMigrationResponse_migrationTimestamp,
    startMigrationResponse_v2BotId,
    startMigrationResponse_v1BotLocale,
    startMigrationResponse_v1BotName,
    startMigrationResponse_v2BotRole,
    startMigrationResponse_migrationId,
    startMigrationResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LexModels.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newStartMigration' smart constructor.
data StartMigration = StartMigration'
  { -- | The name of the Amazon Lex V1 bot that you are migrating to Amazon Lex
    -- V2.
    StartMigration -> Text
v1BotName :: Prelude.Text,
    -- | The version of the bot to migrate to Amazon Lex V2. You can migrate the
    -- @$LATEST@ version as well as any numbered version.
    StartMigration -> Text
v1BotVersion :: Prelude.Text,
    -- | The name of the Amazon Lex V2 bot that you are migrating the Amazon Lex
    -- V1 bot to.
    --
    -- -   If the Amazon Lex V2 bot doesn\'t exist, you must use the
    --     @CREATE_NEW@ migration strategy.
    --
    -- -   If the Amazon Lex V2 bot exists, you must use the @UPDATE_EXISTING@
    --     migration strategy to change the contents of the Amazon Lex V2 bot.
    StartMigration -> Text
v2BotName :: Prelude.Text,
    -- | The IAM role that Amazon Lex uses to run the Amazon Lex V2 bot.
    StartMigration -> Text
v2BotRole :: Prelude.Text,
    -- | The strategy used to conduct the migration.
    --
    -- -   @CREATE_NEW@ - Creates a new Amazon Lex V2 bot and migrates the
    --     Amazon Lex V1 bot to the new bot.
    --
    -- -   @UPDATE_EXISTING@ - Overwrites the existing Amazon Lex V2 bot
    --     metadata and the locale being migrated. It doesn\'t change any other
    --     locales in the Amazon Lex V2 bot. If the locale doesn\'t exist, a
    --     new locale is created in the Amazon Lex V2 bot.
    StartMigration -> MigrationStrategy
migrationStrategy :: MigrationStrategy
  }
  deriving (StartMigration -> StartMigration -> Bool
(StartMigration -> StartMigration -> Bool)
-> (StartMigration -> StartMigration -> Bool) -> Eq StartMigration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartMigration -> StartMigration -> Bool
$c/= :: StartMigration -> StartMigration -> Bool
== :: StartMigration -> StartMigration -> Bool
$c== :: StartMigration -> StartMigration -> Bool
Prelude.Eq, ReadPrec [StartMigration]
ReadPrec StartMigration
Int -> ReadS StartMigration
ReadS [StartMigration]
(Int -> ReadS StartMigration)
-> ReadS [StartMigration]
-> ReadPrec StartMigration
-> ReadPrec [StartMigration]
-> Read StartMigration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartMigration]
$creadListPrec :: ReadPrec [StartMigration]
readPrec :: ReadPrec StartMigration
$creadPrec :: ReadPrec StartMigration
readList :: ReadS [StartMigration]
$creadList :: ReadS [StartMigration]
readsPrec :: Int -> ReadS StartMigration
$creadsPrec :: Int -> ReadS StartMigration
Prelude.Read, Int -> StartMigration -> ShowS
[StartMigration] -> ShowS
StartMigration -> String
(Int -> StartMigration -> ShowS)
-> (StartMigration -> String)
-> ([StartMigration] -> ShowS)
-> Show StartMigration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartMigration] -> ShowS
$cshowList :: [StartMigration] -> ShowS
show :: StartMigration -> String
$cshow :: StartMigration -> String
showsPrec :: Int -> StartMigration -> ShowS
$cshowsPrec :: Int -> StartMigration -> ShowS
Prelude.Show, (forall x. StartMigration -> Rep StartMigration x)
-> (forall x. Rep StartMigration x -> StartMigration)
-> Generic StartMigration
forall x. Rep StartMigration x -> StartMigration
forall x. StartMigration -> Rep StartMigration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartMigration x -> StartMigration
$cfrom :: forall x. StartMigration -> Rep StartMigration x
Prelude.Generic)

-- |
-- Create a value of 'StartMigration' 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:
--
-- 'v1BotName', 'startMigration_v1BotName' - The name of the Amazon Lex V1 bot that you are migrating to Amazon Lex
-- V2.
--
-- 'v1BotVersion', 'startMigration_v1BotVersion' - The version of the bot to migrate to Amazon Lex V2. You can migrate the
-- @$LATEST@ version as well as any numbered version.
--
-- 'v2BotName', 'startMigration_v2BotName' - The name of the Amazon Lex V2 bot that you are migrating the Amazon Lex
-- V1 bot to.
--
-- -   If the Amazon Lex V2 bot doesn\'t exist, you must use the
--     @CREATE_NEW@ migration strategy.
--
-- -   If the Amazon Lex V2 bot exists, you must use the @UPDATE_EXISTING@
--     migration strategy to change the contents of the Amazon Lex V2 bot.
--
-- 'v2BotRole', 'startMigration_v2BotRole' - The IAM role that Amazon Lex uses to run the Amazon Lex V2 bot.
--
-- 'migrationStrategy', 'startMigration_migrationStrategy' - The strategy used to conduct the migration.
--
-- -   @CREATE_NEW@ - Creates a new Amazon Lex V2 bot and migrates the
--     Amazon Lex V1 bot to the new bot.
--
-- -   @UPDATE_EXISTING@ - Overwrites the existing Amazon Lex V2 bot
--     metadata and the locale being migrated. It doesn\'t change any other
--     locales in the Amazon Lex V2 bot. If the locale doesn\'t exist, a
--     new locale is created in the Amazon Lex V2 bot.
newStartMigration ::
  -- | 'v1BotName'
  Prelude.Text ->
  -- | 'v1BotVersion'
  Prelude.Text ->
  -- | 'v2BotName'
  Prelude.Text ->
  -- | 'v2BotRole'
  Prelude.Text ->
  -- | 'migrationStrategy'
  MigrationStrategy ->
  StartMigration
newStartMigration :: Text -> Text -> Text -> Text -> MigrationStrategy -> StartMigration
newStartMigration
  Text
pV1BotName_
  Text
pV1BotVersion_
  Text
pV2BotName_
  Text
pV2BotRole_
  MigrationStrategy
pMigrationStrategy_ =
    StartMigration' :: Text -> Text -> Text -> Text -> MigrationStrategy -> StartMigration
StartMigration'
      { $sel:v1BotName:StartMigration' :: Text
v1BotName = Text
pV1BotName_,
        $sel:v1BotVersion:StartMigration' :: Text
v1BotVersion = Text
pV1BotVersion_,
        $sel:v2BotName:StartMigration' :: Text
v2BotName = Text
pV2BotName_,
        $sel:v2BotRole:StartMigration' :: Text
v2BotRole = Text
pV2BotRole_,
        $sel:migrationStrategy:StartMigration' :: MigrationStrategy
migrationStrategy = MigrationStrategy
pMigrationStrategy_
      }

-- | The name of the Amazon Lex V1 bot that you are migrating to Amazon Lex
-- V2.
startMigration_v1BotName :: Lens.Lens' StartMigration Prelude.Text
startMigration_v1BotName :: (Text -> f Text) -> StartMigration -> f StartMigration
startMigration_v1BotName = (StartMigration -> Text)
-> (StartMigration -> Text -> StartMigration)
-> Lens StartMigration StartMigration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartMigration' {Text
v1BotName :: Text
$sel:v1BotName:StartMigration' :: StartMigration -> Text
v1BotName} -> Text
v1BotName) (\s :: StartMigration
s@StartMigration' {} Text
a -> StartMigration
s {$sel:v1BotName:StartMigration' :: Text
v1BotName = Text
a} :: StartMigration)

-- | The version of the bot to migrate to Amazon Lex V2. You can migrate the
-- @$LATEST@ version as well as any numbered version.
startMigration_v1BotVersion :: Lens.Lens' StartMigration Prelude.Text
startMigration_v1BotVersion :: (Text -> f Text) -> StartMigration -> f StartMigration
startMigration_v1BotVersion = (StartMigration -> Text)
-> (StartMigration -> Text -> StartMigration)
-> Lens StartMigration StartMigration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartMigration' {Text
v1BotVersion :: Text
$sel:v1BotVersion:StartMigration' :: StartMigration -> Text
v1BotVersion} -> Text
v1BotVersion) (\s :: StartMigration
s@StartMigration' {} Text
a -> StartMigration
s {$sel:v1BotVersion:StartMigration' :: Text
v1BotVersion = Text
a} :: StartMigration)

-- | The name of the Amazon Lex V2 bot that you are migrating the Amazon Lex
-- V1 bot to.
--
-- -   If the Amazon Lex V2 bot doesn\'t exist, you must use the
--     @CREATE_NEW@ migration strategy.
--
-- -   If the Amazon Lex V2 bot exists, you must use the @UPDATE_EXISTING@
--     migration strategy to change the contents of the Amazon Lex V2 bot.
startMigration_v2BotName :: Lens.Lens' StartMigration Prelude.Text
startMigration_v2BotName :: (Text -> f Text) -> StartMigration -> f StartMigration
startMigration_v2BotName = (StartMigration -> Text)
-> (StartMigration -> Text -> StartMigration)
-> Lens StartMigration StartMigration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartMigration' {Text
v2BotName :: Text
$sel:v2BotName:StartMigration' :: StartMigration -> Text
v2BotName} -> Text
v2BotName) (\s :: StartMigration
s@StartMigration' {} Text
a -> StartMigration
s {$sel:v2BotName:StartMigration' :: Text
v2BotName = Text
a} :: StartMigration)

-- | The IAM role that Amazon Lex uses to run the Amazon Lex V2 bot.
startMigration_v2BotRole :: Lens.Lens' StartMigration Prelude.Text
startMigration_v2BotRole :: (Text -> f Text) -> StartMigration -> f StartMigration
startMigration_v2BotRole = (StartMigration -> Text)
-> (StartMigration -> Text -> StartMigration)
-> Lens StartMigration StartMigration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartMigration' {Text
v2BotRole :: Text
$sel:v2BotRole:StartMigration' :: StartMigration -> Text
v2BotRole} -> Text
v2BotRole) (\s :: StartMigration
s@StartMigration' {} Text
a -> StartMigration
s {$sel:v2BotRole:StartMigration' :: Text
v2BotRole = Text
a} :: StartMigration)

-- | The strategy used to conduct the migration.
--
-- -   @CREATE_NEW@ - Creates a new Amazon Lex V2 bot and migrates the
--     Amazon Lex V1 bot to the new bot.
--
-- -   @UPDATE_EXISTING@ - Overwrites the existing Amazon Lex V2 bot
--     metadata and the locale being migrated. It doesn\'t change any other
--     locales in the Amazon Lex V2 bot. If the locale doesn\'t exist, a
--     new locale is created in the Amazon Lex V2 bot.
startMigration_migrationStrategy :: Lens.Lens' StartMigration MigrationStrategy
startMigration_migrationStrategy :: (MigrationStrategy -> f MigrationStrategy)
-> StartMigration -> f StartMigration
startMigration_migrationStrategy = (StartMigration -> MigrationStrategy)
-> (StartMigration -> MigrationStrategy -> StartMigration)
-> Lens
     StartMigration StartMigration MigrationStrategy MigrationStrategy
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartMigration' {MigrationStrategy
migrationStrategy :: MigrationStrategy
$sel:migrationStrategy:StartMigration' :: StartMigration -> MigrationStrategy
migrationStrategy} -> MigrationStrategy
migrationStrategy) (\s :: StartMigration
s@StartMigration' {} MigrationStrategy
a -> StartMigration
s {$sel:migrationStrategy:StartMigration' :: MigrationStrategy
migrationStrategy = MigrationStrategy
a} :: StartMigration)

instance Core.AWSRequest StartMigration where
  type
    AWSResponse StartMigration =
      StartMigrationResponse
  request :: StartMigration -> Request StartMigration
request = Service -> StartMigration -> Request StartMigration
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StartMigration
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartMigration)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse StartMigration))
-> Logger
-> Service
-> Proxy StartMigration
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartMigration)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe MigrationStrategy
-> Maybe POSIX
-> Maybe Text
-> Maybe Locale
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> StartMigrationResponse
StartMigrationResponse'
            (Maybe Text
 -> Maybe MigrationStrategy
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Locale
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Int
 -> StartMigrationResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe MigrationStrategy
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Locale
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> StartMigrationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"v1BotVersion")
            Either
  String
  (Maybe MigrationStrategy
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Locale
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> StartMigrationResponse)
-> Either String (Maybe MigrationStrategy)
-> Either
     String
     (Maybe POSIX
      -> Maybe Text
      -> Maybe Locale
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> StartMigrationResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe MigrationStrategy)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"migrationStrategy")
            Either
  String
  (Maybe POSIX
   -> Maybe Text
   -> Maybe Locale
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> StartMigrationResponse)
-> Either String (Maybe POSIX)
-> Either
     String
     (Maybe Text
      -> Maybe Locale
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> StartMigrationResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"migrationTimestamp")
            Either
  String
  (Maybe Text
   -> Maybe Locale
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> StartMigrationResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Locale
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> StartMigrationResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"v2BotId")
            Either
  String
  (Maybe Locale
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> StartMigrationResponse)
-> Either String (Maybe Locale)
-> Either
     String
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Int -> StartMigrationResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Locale)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"v1BotLocale")
            Either
  String
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Int -> StartMigrationResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Maybe Text -> Int -> StartMigrationResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"v1BotName")
            Either
  String (Maybe Text -> Maybe Text -> Int -> StartMigrationResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> StartMigrationResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"v2BotRole")
            Either String (Maybe Text -> Int -> StartMigrationResponse)
-> Either String (Maybe Text)
-> Either String (Int -> StartMigrationResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"migrationId")
            Either String (Int -> StartMigrationResponse)
-> Either String Int -> Either String StartMigrationResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable StartMigration

instance Prelude.NFData StartMigration

instance Core.ToHeaders StartMigration where
  toHeaders :: StartMigration -> ResponseHeaders
toHeaders =
    ResponseHeaders -> StartMigration -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON StartMigration where
  toJSON :: StartMigration -> Value
toJSON StartMigration' {Text
MigrationStrategy
migrationStrategy :: MigrationStrategy
v2BotRole :: Text
v2BotName :: Text
v1BotVersion :: Text
v1BotName :: Text
$sel:migrationStrategy:StartMigration' :: StartMigration -> MigrationStrategy
$sel:v2BotRole:StartMigration' :: StartMigration -> Text
$sel:v2BotName:StartMigration' :: StartMigration -> Text
$sel:v1BotVersion:StartMigration' :: StartMigration -> Text
$sel:v1BotName:StartMigration' :: StartMigration -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"v1BotName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
v1BotName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"v1BotVersion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
v1BotVersion),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"v2BotName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
v2BotName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"v2BotRole" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
v2BotRole),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"migrationStrategy" Text -> MigrationStrategy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= MigrationStrategy
migrationStrategy)
          ]
      )

instance Core.ToPath StartMigration where
  toPath :: StartMigration -> ByteString
toPath = ByteString -> StartMigration -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/migrations"

instance Core.ToQuery StartMigration where
  toQuery :: StartMigration -> QueryString
toQuery = QueryString -> StartMigration -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newStartMigrationResponse' smart constructor.
data StartMigrationResponse = StartMigrationResponse'
  { -- | The version of the bot to migrate to Amazon Lex V2.
    StartMigrationResponse -> Maybe Text
v1BotVersion :: Prelude.Maybe Prelude.Text,
    -- | The strategy used to conduct the migration.
    StartMigrationResponse -> Maybe MigrationStrategy
migrationStrategy :: Prelude.Maybe MigrationStrategy,
    -- | The date and time that the migration started.
    StartMigrationResponse -> Maybe POSIX
migrationTimestamp :: Prelude.Maybe Core.POSIX,
    -- | The unique identifier for the Amazon Lex V2 bot.
    StartMigrationResponse -> Maybe Text
v2BotId :: Prelude.Maybe Prelude.Text,
    -- | The locale used for the Amazon Lex V1 bot.
    StartMigrationResponse -> Maybe Locale
v1BotLocale :: Prelude.Maybe Locale,
    -- | The name of the Amazon Lex V1 bot that you are migrating to Amazon Lex
    -- V2.
    StartMigrationResponse -> Maybe Text
v1BotName :: Prelude.Maybe Prelude.Text,
    -- | The IAM role that Amazon Lex uses to run the Amazon Lex V2 bot.
    StartMigrationResponse -> Maybe Text
v2BotRole :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier that Amazon Lex assigned to the migration.
    StartMigrationResponse -> Maybe Text
migrationId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    StartMigrationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (StartMigrationResponse -> StartMigrationResponse -> Bool
(StartMigrationResponse -> StartMigrationResponse -> Bool)
-> (StartMigrationResponse -> StartMigrationResponse -> Bool)
-> Eq StartMigrationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartMigrationResponse -> StartMigrationResponse -> Bool
$c/= :: StartMigrationResponse -> StartMigrationResponse -> Bool
== :: StartMigrationResponse -> StartMigrationResponse -> Bool
$c== :: StartMigrationResponse -> StartMigrationResponse -> Bool
Prelude.Eq, ReadPrec [StartMigrationResponse]
ReadPrec StartMigrationResponse
Int -> ReadS StartMigrationResponse
ReadS [StartMigrationResponse]
(Int -> ReadS StartMigrationResponse)
-> ReadS [StartMigrationResponse]
-> ReadPrec StartMigrationResponse
-> ReadPrec [StartMigrationResponse]
-> Read StartMigrationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartMigrationResponse]
$creadListPrec :: ReadPrec [StartMigrationResponse]
readPrec :: ReadPrec StartMigrationResponse
$creadPrec :: ReadPrec StartMigrationResponse
readList :: ReadS [StartMigrationResponse]
$creadList :: ReadS [StartMigrationResponse]
readsPrec :: Int -> ReadS StartMigrationResponse
$creadsPrec :: Int -> ReadS StartMigrationResponse
Prelude.Read, Int -> StartMigrationResponse -> ShowS
[StartMigrationResponse] -> ShowS
StartMigrationResponse -> String
(Int -> StartMigrationResponse -> ShowS)
-> (StartMigrationResponse -> String)
-> ([StartMigrationResponse] -> ShowS)
-> Show StartMigrationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartMigrationResponse] -> ShowS
$cshowList :: [StartMigrationResponse] -> ShowS
show :: StartMigrationResponse -> String
$cshow :: StartMigrationResponse -> String
showsPrec :: Int -> StartMigrationResponse -> ShowS
$cshowsPrec :: Int -> StartMigrationResponse -> ShowS
Prelude.Show, (forall x. StartMigrationResponse -> Rep StartMigrationResponse x)
-> (forall x.
    Rep StartMigrationResponse x -> StartMigrationResponse)
-> Generic StartMigrationResponse
forall x. Rep StartMigrationResponse x -> StartMigrationResponse
forall x. StartMigrationResponse -> Rep StartMigrationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartMigrationResponse x -> StartMigrationResponse
$cfrom :: forall x. StartMigrationResponse -> Rep StartMigrationResponse x
Prelude.Generic)

-- |
-- Create a value of 'StartMigrationResponse' 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:
--
-- 'v1BotVersion', 'startMigrationResponse_v1BotVersion' - The version of the bot to migrate to Amazon Lex V2.
--
-- 'migrationStrategy', 'startMigrationResponse_migrationStrategy' - The strategy used to conduct the migration.
--
-- 'migrationTimestamp', 'startMigrationResponse_migrationTimestamp' - The date and time that the migration started.
--
-- 'v2BotId', 'startMigrationResponse_v2BotId' - The unique identifier for the Amazon Lex V2 bot.
--
-- 'v1BotLocale', 'startMigrationResponse_v1BotLocale' - The locale used for the Amazon Lex V1 bot.
--
-- 'v1BotName', 'startMigrationResponse_v1BotName' - The name of the Amazon Lex V1 bot that you are migrating to Amazon Lex
-- V2.
--
-- 'v2BotRole', 'startMigrationResponse_v2BotRole' - The IAM role that Amazon Lex uses to run the Amazon Lex V2 bot.
--
-- 'migrationId', 'startMigrationResponse_migrationId' - The unique identifier that Amazon Lex assigned to the migration.
--
-- 'httpStatus', 'startMigrationResponse_httpStatus' - The response's http status code.
newStartMigrationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StartMigrationResponse
newStartMigrationResponse :: Int -> StartMigrationResponse
newStartMigrationResponse Int
pHttpStatus_ =
  StartMigrationResponse' :: Maybe Text
-> Maybe MigrationStrategy
-> Maybe POSIX
-> Maybe Text
-> Maybe Locale
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> StartMigrationResponse
StartMigrationResponse'
    { $sel:v1BotVersion:StartMigrationResponse' :: Maybe Text
v1BotVersion =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:migrationStrategy:StartMigrationResponse' :: Maybe MigrationStrategy
migrationStrategy = Maybe MigrationStrategy
forall a. Maybe a
Prelude.Nothing,
      $sel:migrationTimestamp:StartMigrationResponse' :: Maybe POSIX
migrationTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:v2BotId:StartMigrationResponse' :: Maybe Text
v2BotId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:v1BotLocale:StartMigrationResponse' :: Maybe Locale
v1BotLocale = Maybe Locale
forall a. Maybe a
Prelude.Nothing,
      $sel:v1BotName:StartMigrationResponse' :: Maybe Text
v1BotName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:v2BotRole:StartMigrationResponse' :: Maybe Text
v2BotRole = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:migrationId:StartMigrationResponse' :: Maybe Text
migrationId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:StartMigrationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The version of the bot to migrate to Amazon Lex V2.
startMigrationResponse_v1BotVersion :: Lens.Lens' StartMigrationResponse (Prelude.Maybe Prelude.Text)
startMigrationResponse_v1BotVersion :: (Maybe Text -> f (Maybe Text))
-> StartMigrationResponse -> f StartMigrationResponse
startMigrationResponse_v1BotVersion = (StartMigrationResponse -> Maybe Text)
-> (StartMigrationResponse -> Maybe Text -> StartMigrationResponse)
-> Lens
     StartMigrationResponse
     StartMigrationResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartMigrationResponse' {Maybe Text
v1BotVersion :: Maybe Text
$sel:v1BotVersion:StartMigrationResponse' :: StartMigrationResponse -> Maybe Text
v1BotVersion} -> Maybe Text
v1BotVersion) (\s :: StartMigrationResponse
s@StartMigrationResponse' {} Maybe Text
a -> StartMigrationResponse
s {$sel:v1BotVersion:StartMigrationResponse' :: Maybe Text
v1BotVersion = Maybe Text
a} :: StartMigrationResponse)

-- | The strategy used to conduct the migration.
startMigrationResponse_migrationStrategy :: Lens.Lens' StartMigrationResponse (Prelude.Maybe MigrationStrategy)
startMigrationResponse_migrationStrategy :: (Maybe MigrationStrategy -> f (Maybe MigrationStrategy))
-> StartMigrationResponse -> f StartMigrationResponse
startMigrationResponse_migrationStrategy = (StartMigrationResponse -> Maybe MigrationStrategy)
-> (StartMigrationResponse
    -> Maybe MigrationStrategy -> StartMigrationResponse)
-> Lens
     StartMigrationResponse
     StartMigrationResponse
     (Maybe MigrationStrategy)
     (Maybe MigrationStrategy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartMigrationResponse' {Maybe MigrationStrategy
migrationStrategy :: Maybe MigrationStrategy
$sel:migrationStrategy:StartMigrationResponse' :: StartMigrationResponse -> Maybe MigrationStrategy
migrationStrategy} -> Maybe MigrationStrategy
migrationStrategy) (\s :: StartMigrationResponse
s@StartMigrationResponse' {} Maybe MigrationStrategy
a -> StartMigrationResponse
s {$sel:migrationStrategy:StartMigrationResponse' :: Maybe MigrationStrategy
migrationStrategy = Maybe MigrationStrategy
a} :: StartMigrationResponse)

-- | The date and time that the migration started.
startMigrationResponse_migrationTimestamp :: Lens.Lens' StartMigrationResponse (Prelude.Maybe Prelude.UTCTime)
startMigrationResponse_migrationTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> StartMigrationResponse -> f StartMigrationResponse
startMigrationResponse_migrationTimestamp = (StartMigrationResponse -> Maybe POSIX)
-> (StartMigrationResponse
    -> Maybe POSIX -> StartMigrationResponse)
-> Lens
     StartMigrationResponse
     StartMigrationResponse
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartMigrationResponse' {Maybe POSIX
migrationTimestamp :: Maybe POSIX
$sel:migrationTimestamp:StartMigrationResponse' :: StartMigrationResponse -> Maybe POSIX
migrationTimestamp} -> Maybe POSIX
migrationTimestamp) (\s :: StartMigrationResponse
s@StartMigrationResponse' {} Maybe POSIX
a -> StartMigrationResponse
s {$sel:migrationTimestamp:StartMigrationResponse' :: Maybe POSIX
migrationTimestamp = Maybe POSIX
a} :: StartMigrationResponse) ((Maybe POSIX -> f (Maybe POSIX))
 -> StartMigrationResponse -> f StartMigrationResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> StartMigrationResponse
-> f StartMigrationResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The unique identifier for the Amazon Lex V2 bot.
startMigrationResponse_v2BotId :: Lens.Lens' StartMigrationResponse (Prelude.Maybe Prelude.Text)
startMigrationResponse_v2BotId :: (Maybe Text -> f (Maybe Text))
-> StartMigrationResponse -> f StartMigrationResponse
startMigrationResponse_v2BotId = (StartMigrationResponse -> Maybe Text)
-> (StartMigrationResponse -> Maybe Text -> StartMigrationResponse)
-> Lens
     StartMigrationResponse
     StartMigrationResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartMigrationResponse' {Maybe Text
v2BotId :: Maybe Text
$sel:v2BotId:StartMigrationResponse' :: StartMigrationResponse -> Maybe Text
v2BotId} -> Maybe Text
v2BotId) (\s :: StartMigrationResponse
s@StartMigrationResponse' {} Maybe Text
a -> StartMigrationResponse
s {$sel:v2BotId:StartMigrationResponse' :: Maybe Text
v2BotId = Maybe Text
a} :: StartMigrationResponse)

-- | The locale used for the Amazon Lex V1 bot.
startMigrationResponse_v1BotLocale :: Lens.Lens' StartMigrationResponse (Prelude.Maybe Locale)
startMigrationResponse_v1BotLocale :: (Maybe Locale -> f (Maybe Locale))
-> StartMigrationResponse -> f StartMigrationResponse
startMigrationResponse_v1BotLocale = (StartMigrationResponse -> Maybe Locale)
-> (StartMigrationResponse
    -> Maybe Locale -> StartMigrationResponse)
-> Lens
     StartMigrationResponse
     StartMigrationResponse
     (Maybe Locale)
     (Maybe Locale)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartMigrationResponse' {Maybe Locale
v1BotLocale :: Maybe Locale
$sel:v1BotLocale:StartMigrationResponse' :: StartMigrationResponse -> Maybe Locale
v1BotLocale} -> Maybe Locale
v1BotLocale) (\s :: StartMigrationResponse
s@StartMigrationResponse' {} Maybe Locale
a -> StartMigrationResponse
s {$sel:v1BotLocale:StartMigrationResponse' :: Maybe Locale
v1BotLocale = Maybe Locale
a} :: StartMigrationResponse)

-- | The name of the Amazon Lex V1 bot that you are migrating to Amazon Lex
-- V2.
startMigrationResponse_v1BotName :: Lens.Lens' StartMigrationResponse (Prelude.Maybe Prelude.Text)
startMigrationResponse_v1BotName :: (Maybe Text -> f (Maybe Text))
-> StartMigrationResponse -> f StartMigrationResponse
startMigrationResponse_v1BotName = (StartMigrationResponse -> Maybe Text)
-> (StartMigrationResponse -> Maybe Text -> StartMigrationResponse)
-> Lens
     StartMigrationResponse
     StartMigrationResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartMigrationResponse' {Maybe Text
v1BotName :: Maybe Text
$sel:v1BotName:StartMigrationResponse' :: StartMigrationResponse -> Maybe Text
v1BotName} -> Maybe Text
v1BotName) (\s :: StartMigrationResponse
s@StartMigrationResponse' {} Maybe Text
a -> StartMigrationResponse
s {$sel:v1BotName:StartMigrationResponse' :: Maybe Text
v1BotName = Maybe Text
a} :: StartMigrationResponse)

-- | The IAM role that Amazon Lex uses to run the Amazon Lex V2 bot.
startMigrationResponse_v2BotRole :: Lens.Lens' StartMigrationResponse (Prelude.Maybe Prelude.Text)
startMigrationResponse_v2BotRole :: (Maybe Text -> f (Maybe Text))
-> StartMigrationResponse -> f StartMigrationResponse
startMigrationResponse_v2BotRole = (StartMigrationResponse -> Maybe Text)
-> (StartMigrationResponse -> Maybe Text -> StartMigrationResponse)
-> Lens
     StartMigrationResponse
     StartMigrationResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartMigrationResponse' {Maybe Text
v2BotRole :: Maybe Text
$sel:v2BotRole:StartMigrationResponse' :: StartMigrationResponse -> Maybe Text
v2BotRole} -> Maybe Text
v2BotRole) (\s :: StartMigrationResponse
s@StartMigrationResponse' {} Maybe Text
a -> StartMigrationResponse
s {$sel:v2BotRole:StartMigrationResponse' :: Maybe Text
v2BotRole = Maybe Text
a} :: StartMigrationResponse)

-- | The unique identifier that Amazon Lex assigned to the migration.
startMigrationResponse_migrationId :: Lens.Lens' StartMigrationResponse (Prelude.Maybe Prelude.Text)
startMigrationResponse_migrationId :: (Maybe Text -> f (Maybe Text))
-> StartMigrationResponse -> f StartMigrationResponse
startMigrationResponse_migrationId = (StartMigrationResponse -> Maybe Text)
-> (StartMigrationResponse -> Maybe Text -> StartMigrationResponse)
-> Lens
     StartMigrationResponse
     StartMigrationResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartMigrationResponse' {Maybe Text
migrationId :: Maybe Text
$sel:migrationId:StartMigrationResponse' :: StartMigrationResponse -> Maybe Text
migrationId} -> Maybe Text
migrationId) (\s :: StartMigrationResponse
s@StartMigrationResponse' {} Maybe Text
a -> StartMigrationResponse
s {$sel:migrationId:StartMigrationResponse' :: Maybe Text
migrationId = Maybe Text
a} :: StartMigrationResponse)

-- | The response's http status code.
startMigrationResponse_httpStatus :: Lens.Lens' StartMigrationResponse Prelude.Int
startMigrationResponse_httpStatus :: (Int -> f Int)
-> StartMigrationResponse -> f StartMigrationResponse
startMigrationResponse_httpStatus = (StartMigrationResponse -> Int)
-> (StartMigrationResponse -> Int -> StartMigrationResponse)
-> Lens StartMigrationResponse StartMigrationResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartMigrationResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartMigrationResponse' :: StartMigrationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartMigrationResponse
s@StartMigrationResponse' {} Int
a -> StartMigrationResponse
s {$sel:httpStatus:StartMigrationResponse' :: Int
httpStatus = Int
a} :: StartMigrationResponse)

instance Prelude.NFData StartMigrationResponse