{-# 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 #-}
module Amazonka.MigrationHub.ImportMigrationTask
(
ImportMigrationTask (..),
newImportMigrationTask,
importMigrationTask_dryRun,
importMigrationTask_progressUpdateStream,
importMigrationTask_migrationTaskName,
ImportMigrationTaskResponse (..),
newImportMigrationTaskResponse,
importMigrationTaskResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MigrationHub.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ImportMigrationTask = ImportMigrationTask'
{
ImportMigrationTask -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
ImportMigrationTask -> Text
progressUpdateStream :: Prelude.Text,
ImportMigrationTask -> Text
migrationTaskName :: Prelude.Text
}
deriving (ImportMigrationTask -> ImportMigrationTask -> Bool
(ImportMigrationTask -> ImportMigrationTask -> Bool)
-> (ImportMigrationTask -> ImportMigrationTask -> Bool)
-> Eq ImportMigrationTask
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportMigrationTask -> ImportMigrationTask -> Bool
$c/= :: ImportMigrationTask -> ImportMigrationTask -> Bool
== :: ImportMigrationTask -> ImportMigrationTask -> Bool
$c== :: ImportMigrationTask -> ImportMigrationTask -> Bool
Prelude.Eq, ReadPrec [ImportMigrationTask]
ReadPrec ImportMigrationTask
Int -> ReadS ImportMigrationTask
ReadS [ImportMigrationTask]
(Int -> ReadS ImportMigrationTask)
-> ReadS [ImportMigrationTask]
-> ReadPrec ImportMigrationTask
-> ReadPrec [ImportMigrationTask]
-> Read ImportMigrationTask
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImportMigrationTask]
$creadListPrec :: ReadPrec [ImportMigrationTask]
readPrec :: ReadPrec ImportMigrationTask
$creadPrec :: ReadPrec ImportMigrationTask
readList :: ReadS [ImportMigrationTask]
$creadList :: ReadS [ImportMigrationTask]
readsPrec :: Int -> ReadS ImportMigrationTask
$creadsPrec :: Int -> ReadS ImportMigrationTask
Prelude.Read, Int -> ImportMigrationTask -> ShowS
[ImportMigrationTask] -> ShowS
ImportMigrationTask -> String
(Int -> ImportMigrationTask -> ShowS)
-> (ImportMigrationTask -> String)
-> ([ImportMigrationTask] -> ShowS)
-> Show ImportMigrationTask
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImportMigrationTask] -> ShowS
$cshowList :: [ImportMigrationTask] -> ShowS
show :: ImportMigrationTask -> String
$cshow :: ImportMigrationTask -> String
showsPrec :: Int -> ImportMigrationTask -> ShowS
$cshowsPrec :: Int -> ImportMigrationTask -> ShowS
Prelude.Show, (forall x. ImportMigrationTask -> Rep ImportMigrationTask x)
-> (forall x. Rep ImportMigrationTask x -> ImportMigrationTask)
-> Generic ImportMigrationTask
forall x. Rep ImportMigrationTask x -> ImportMigrationTask
forall x. ImportMigrationTask -> Rep ImportMigrationTask x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImportMigrationTask x -> ImportMigrationTask
$cfrom :: forall x. ImportMigrationTask -> Rep ImportMigrationTask x
Prelude.Generic)
newImportMigrationTask ::
Prelude.Text ->
Prelude.Text ->
ImportMigrationTask
newImportMigrationTask :: Text -> Text -> ImportMigrationTask
newImportMigrationTask
Text
pProgressUpdateStream_
Text
pMigrationTaskName_ =
ImportMigrationTask' :: Maybe Bool -> Text -> Text -> ImportMigrationTask
ImportMigrationTask'
{ $sel:dryRun:ImportMigrationTask' :: Maybe Bool
dryRun = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:progressUpdateStream:ImportMigrationTask' :: Text
progressUpdateStream = Text
pProgressUpdateStream_,
$sel:migrationTaskName:ImportMigrationTask' :: Text
migrationTaskName = Text
pMigrationTaskName_
}
importMigrationTask_dryRun :: Lens.Lens' ImportMigrationTask (Prelude.Maybe Prelude.Bool)
importMigrationTask_dryRun :: (Maybe Bool -> f (Maybe Bool))
-> ImportMigrationTask -> f ImportMigrationTask
importMigrationTask_dryRun = (ImportMigrationTask -> Maybe Bool)
-> (ImportMigrationTask -> Maybe Bool -> ImportMigrationTask)
-> Lens
ImportMigrationTask ImportMigrationTask (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportMigrationTask' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:ImportMigrationTask' :: ImportMigrationTask -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: ImportMigrationTask
s@ImportMigrationTask' {} Maybe Bool
a -> ImportMigrationTask
s {$sel:dryRun:ImportMigrationTask' :: Maybe Bool
dryRun = Maybe Bool
a} :: ImportMigrationTask)
importMigrationTask_progressUpdateStream :: Lens.Lens' ImportMigrationTask Prelude.Text
importMigrationTask_progressUpdateStream :: (Text -> f Text) -> ImportMigrationTask -> f ImportMigrationTask
importMigrationTask_progressUpdateStream = (ImportMigrationTask -> Text)
-> (ImportMigrationTask -> Text -> ImportMigrationTask)
-> Lens ImportMigrationTask ImportMigrationTask Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportMigrationTask' {Text
progressUpdateStream :: Text
$sel:progressUpdateStream:ImportMigrationTask' :: ImportMigrationTask -> Text
progressUpdateStream} -> Text
progressUpdateStream) (\s :: ImportMigrationTask
s@ImportMigrationTask' {} Text
a -> ImportMigrationTask
s {$sel:progressUpdateStream:ImportMigrationTask' :: Text
progressUpdateStream = Text
a} :: ImportMigrationTask)
importMigrationTask_migrationTaskName :: Lens.Lens' ImportMigrationTask Prelude.Text
importMigrationTask_migrationTaskName :: (Text -> f Text) -> ImportMigrationTask -> f ImportMigrationTask
importMigrationTask_migrationTaskName = (ImportMigrationTask -> Text)
-> (ImportMigrationTask -> Text -> ImportMigrationTask)
-> Lens ImportMigrationTask ImportMigrationTask Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportMigrationTask' {Text
migrationTaskName :: Text
$sel:migrationTaskName:ImportMigrationTask' :: ImportMigrationTask -> Text
migrationTaskName} -> Text
migrationTaskName) (\s :: ImportMigrationTask
s@ImportMigrationTask' {} Text
a -> ImportMigrationTask
s {$sel:migrationTaskName:ImportMigrationTask' :: Text
migrationTaskName = Text
a} :: ImportMigrationTask)
instance Core.AWSRequest ImportMigrationTask where
type
AWSResponse ImportMigrationTask =
ImportMigrationTaskResponse
request :: ImportMigrationTask -> Request ImportMigrationTask
request = Service -> ImportMigrationTask -> Request ImportMigrationTask
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ImportMigrationTask
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ImportMigrationTask)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse ImportMigrationTask))
-> Logger
-> Service
-> Proxy ImportMigrationTask
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ImportMigrationTask)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> ImportMigrationTaskResponse
ImportMigrationTaskResponse'
(Int -> ImportMigrationTaskResponse)
-> Either String Int -> Either String ImportMigrationTaskResponse
forall (f :: * -> *) a b. Functor 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 ImportMigrationTask
instance Prelude.NFData ImportMigrationTask
instance Core.ToHeaders ImportMigrationTask where
toHeaders :: ImportMigrationTask -> ResponseHeaders
toHeaders =
ResponseHeaders -> ImportMigrationTask -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSMigrationHub.ImportMigrationTask" ::
Prelude.ByteString
),
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 ImportMigrationTask where
toJSON :: ImportMigrationTask -> Value
toJSON ImportMigrationTask' {Maybe Bool
Text
migrationTaskName :: Text
progressUpdateStream :: Text
dryRun :: Maybe Bool
$sel:migrationTaskName:ImportMigrationTask' :: ImportMigrationTask -> Text
$sel:progressUpdateStream:ImportMigrationTask' :: ImportMigrationTask -> Text
$sel:dryRun:ImportMigrationTask' :: ImportMigrationTask -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"DryRun" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
dryRun,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"ProgressUpdateStream"
Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
progressUpdateStream
),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"MigrationTaskName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
migrationTaskName)
]
)
instance Core.ToPath ImportMigrationTask where
toPath :: ImportMigrationTask -> ByteString
toPath = ByteString -> ImportMigrationTask -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ImportMigrationTask where
toQuery :: ImportMigrationTask -> QueryString
toQuery = QueryString -> ImportMigrationTask -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ImportMigrationTaskResponse = ImportMigrationTaskResponse'
{
ImportMigrationTaskResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ImportMigrationTaskResponse -> ImportMigrationTaskResponse -> Bool
(ImportMigrationTaskResponse
-> ImportMigrationTaskResponse -> Bool)
-> (ImportMigrationTaskResponse
-> ImportMigrationTaskResponse -> Bool)
-> Eq ImportMigrationTaskResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportMigrationTaskResponse -> ImportMigrationTaskResponse -> Bool
$c/= :: ImportMigrationTaskResponse -> ImportMigrationTaskResponse -> Bool
== :: ImportMigrationTaskResponse -> ImportMigrationTaskResponse -> Bool
$c== :: ImportMigrationTaskResponse -> ImportMigrationTaskResponse -> Bool
Prelude.Eq, ReadPrec [ImportMigrationTaskResponse]
ReadPrec ImportMigrationTaskResponse
Int -> ReadS ImportMigrationTaskResponse
ReadS [ImportMigrationTaskResponse]
(Int -> ReadS ImportMigrationTaskResponse)
-> ReadS [ImportMigrationTaskResponse]
-> ReadPrec ImportMigrationTaskResponse
-> ReadPrec [ImportMigrationTaskResponse]
-> Read ImportMigrationTaskResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImportMigrationTaskResponse]
$creadListPrec :: ReadPrec [ImportMigrationTaskResponse]
readPrec :: ReadPrec ImportMigrationTaskResponse
$creadPrec :: ReadPrec ImportMigrationTaskResponse
readList :: ReadS [ImportMigrationTaskResponse]
$creadList :: ReadS [ImportMigrationTaskResponse]
readsPrec :: Int -> ReadS ImportMigrationTaskResponse
$creadsPrec :: Int -> ReadS ImportMigrationTaskResponse
Prelude.Read, Int -> ImportMigrationTaskResponse -> ShowS
[ImportMigrationTaskResponse] -> ShowS
ImportMigrationTaskResponse -> String
(Int -> ImportMigrationTaskResponse -> ShowS)
-> (ImportMigrationTaskResponse -> String)
-> ([ImportMigrationTaskResponse] -> ShowS)
-> Show ImportMigrationTaskResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImportMigrationTaskResponse] -> ShowS
$cshowList :: [ImportMigrationTaskResponse] -> ShowS
show :: ImportMigrationTaskResponse -> String
$cshow :: ImportMigrationTaskResponse -> String
showsPrec :: Int -> ImportMigrationTaskResponse -> ShowS
$cshowsPrec :: Int -> ImportMigrationTaskResponse -> ShowS
Prelude.Show, (forall x.
ImportMigrationTaskResponse -> Rep ImportMigrationTaskResponse x)
-> (forall x.
Rep ImportMigrationTaskResponse x -> ImportMigrationTaskResponse)
-> Generic ImportMigrationTaskResponse
forall x.
Rep ImportMigrationTaskResponse x -> ImportMigrationTaskResponse
forall x.
ImportMigrationTaskResponse -> Rep ImportMigrationTaskResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ImportMigrationTaskResponse x -> ImportMigrationTaskResponse
$cfrom :: forall x.
ImportMigrationTaskResponse -> Rep ImportMigrationTaskResponse x
Prelude.Generic)
newImportMigrationTaskResponse ::
Prelude.Int ->
ImportMigrationTaskResponse
newImportMigrationTaskResponse :: Int -> ImportMigrationTaskResponse
newImportMigrationTaskResponse Int
pHttpStatus_ =
ImportMigrationTaskResponse' :: Int -> ImportMigrationTaskResponse
ImportMigrationTaskResponse'
{ $sel:httpStatus:ImportMigrationTaskResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
importMigrationTaskResponse_httpStatus :: Lens.Lens' ImportMigrationTaskResponse Prelude.Int
importMigrationTaskResponse_httpStatus :: (Int -> f Int)
-> ImportMigrationTaskResponse -> f ImportMigrationTaskResponse
importMigrationTaskResponse_httpStatus = (ImportMigrationTaskResponse -> Int)
-> (ImportMigrationTaskResponse
-> Int -> ImportMigrationTaskResponse)
-> Lens
ImportMigrationTaskResponse ImportMigrationTaskResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportMigrationTaskResponse' {Int
httpStatus :: Int
$sel:httpStatus:ImportMigrationTaskResponse' :: ImportMigrationTaskResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ImportMigrationTaskResponse
s@ImportMigrationTaskResponse' {} Int
a -> ImportMigrationTaskResponse
s {$sel:httpStatus:ImportMigrationTaskResponse' :: Int
httpStatus = Int
a} :: ImportMigrationTaskResponse)
instance Prelude.NFData ImportMigrationTaskResponse