{-# 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.DescribeMigrationTask
(
DescribeMigrationTask (..),
newDescribeMigrationTask,
describeMigrationTask_progressUpdateStream,
describeMigrationTask_migrationTaskName,
DescribeMigrationTaskResponse (..),
newDescribeMigrationTaskResponse,
describeMigrationTaskResponse_migrationTask,
describeMigrationTaskResponse_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 DescribeMigrationTask = DescribeMigrationTask'
{
DescribeMigrationTask -> Text
progressUpdateStream :: Prelude.Text,
DescribeMigrationTask -> Text
migrationTaskName :: Prelude.Text
}
deriving (DescribeMigrationTask -> DescribeMigrationTask -> Bool
(DescribeMigrationTask -> DescribeMigrationTask -> Bool)
-> (DescribeMigrationTask -> DescribeMigrationTask -> Bool)
-> Eq DescribeMigrationTask
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeMigrationTask -> DescribeMigrationTask -> Bool
$c/= :: DescribeMigrationTask -> DescribeMigrationTask -> Bool
== :: DescribeMigrationTask -> DescribeMigrationTask -> Bool
$c== :: DescribeMigrationTask -> DescribeMigrationTask -> Bool
Prelude.Eq, ReadPrec [DescribeMigrationTask]
ReadPrec DescribeMigrationTask
Int -> ReadS DescribeMigrationTask
ReadS [DescribeMigrationTask]
(Int -> ReadS DescribeMigrationTask)
-> ReadS [DescribeMigrationTask]
-> ReadPrec DescribeMigrationTask
-> ReadPrec [DescribeMigrationTask]
-> Read DescribeMigrationTask
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeMigrationTask]
$creadListPrec :: ReadPrec [DescribeMigrationTask]
readPrec :: ReadPrec DescribeMigrationTask
$creadPrec :: ReadPrec DescribeMigrationTask
readList :: ReadS [DescribeMigrationTask]
$creadList :: ReadS [DescribeMigrationTask]
readsPrec :: Int -> ReadS DescribeMigrationTask
$creadsPrec :: Int -> ReadS DescribeMigrationTask
Prelude.Read, Int -> DescribeMigrationTask -> ShowS
[DescribeMigrationTask] -> ShowS
DescribeMigrationTask -> String
(Int -> DescribeMigrationTask -> ShowS)
-> (DescribeMigrationTask -> String)
-> ([DescribeMigrationTask] -> ShowS)
-> Show DescribeMigrationTask
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeMigrationTask] -> ShowS
$cshowList :: [DescribeMigrationTask] -> ShowS
show :: DescribeMigrationTask -> String
$cshow :: DescribeMigrationTask -> String
showsPrec :: Int -> DescribeMigrationTask -> ShowS
$cshowsPrec :: Int -> DescribeMigrationTask -> ShowS
Prelude.Show, (forall x. DescribeMigrationTask -> Rep DescribeMigrationTask x)
-> (forall x. Rep DescribeMigrationTask x -> DescribeMigrationTask)
-> Generic DescribeMigrationTask
forall x. Rep DescribeMigrationTask x -> DescribeMigrationTask
forall x. DescribeMigrationTask -> Rep DescribeMigrationTask x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeMigrationTask x -> DescribeMigrationTask
$cfrom :: forall x. DescribeMigrationTask -> Rep DescribeMigrationTask x
Prelude.Generic)
newDescribeMigrationTask ::
Prelude.Text ->
Prelude.Text ->
DescribeMigrationTask
newDescribeMigrationTask :: Text -> Text -> DescribeMigrationTask
newDescribeMigrationTask
Text
pProgressUpdateStream_
Text
pMigrationTaskName_ =
DescribeMigrationTask' :: Text -> Text -> DescribeMigrationTask
DescribeMigrationTask'
{ $sel:progressUpdateStream:DescribeMigrationTask' :: Text
progressUpdateStream =
Text
pProgressUpdateStream_,
$sel:migrationTaskName:DescribeMigrationTask' :: Text
migrationTaskName = Text
pMigrationTaskName_
}
describeMigrationTask_progressUpdateStream :: Lens.Lens' DescribeMigrationTask Prelude.Text
describeMigrationTask_progressUpdateStream :: (Text -> f Text)
-> DescribeMigrationTask -> f DescribeMigrationTask
describeMigrationTask_progressUpdateStream = (DescribeMigrationTask -> Text)
-> (DescribeMigrationTask -> Text -> DescribeMigrationTask)
-> Lens DescribeMigrationTask DescribeMigrationTask Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMigrationTask' {Text
progressUpdateStream :: Text
$sel:progressUpdateStream:DescribeMigrationTask' :: DescribeMigrationTask -> Text
progressUpdateStream} -> Text
progressUpdateStream) (\s :: DescribeMigrationTask
s@DescribeMigrationTask' {} Text
a -> DescribeMigrationTask
s {$sel:progressUpdateStream:DescribeMigrationTask' :: Text
progressUpdateStream = Text
a} :: DescribeMigrationTask)
describeMigrationTask_migrationTaskName :: Lens.Lens' DescribeMigrationTask Prelude.Text
describeMigrationTask_migrationTaskName :: (Text -> f Text)
-> DescribeMigrationTask -> f DescribeMigrationTask
describeMigrationTask_migrationTaskName = (DescribeMigrationTask -> Text)
-> (DescribeMigrationTask -> Text -> DescribeMigrationTask)
-> Lens DescribeMigrationTask DescribeMigrationTask Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMigrationTask' {Text
migrationTaskName :: Text
$sel:migrationTaskName:DescribeMigrationTask' :: DescribeMigrationTask -> Text
migrationTaskName} -> Text
migrationTaskName) (\s :: DescribeMigrationTask
s@DescribeMigrationTask' {} Text
a -> DescribeMigrationTask
s {$sel:migrationTaskName:DescribeMigrationTask' :: Text
migrationTaskName = Text
a} :: DescribeMigrationTask)
instance Core.AWSRequest DescribeMigrationTask where
type
AWSResponse DescribeMigrationTask =
DescribeMigrationTaskResponse
request :: DescribeMigrationTask -> Request DescribeMigrationTask
request = Service -> DescribeMigrationTask -> Request DescribeMigrationTask
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeMigrationTask
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeMigrationTask)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeMigrationTask))
-> Logger
-> Service
-> Proxy DescribeMigrationTask
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeMigrationTask)))
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 MigrationTask -> Int -> DescribeMigrationTaskResponse
DescribeMigrationTaskResponse'
(Maybe MigrationTask -> Int -> DescribeMigrationTaskResponse)
-> Either String (Maybe MigrationTask)
-> Either String (Int -> DescribeMigrationTaskResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe MigrationTask)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"MigrationTask")
Either String (Int -> DescribeMigrationTaskResponse)
-> Either String Int -> Either String DescribeMigrationTaskResponse
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 DescribeMigrationTask
instance Prelude.NFData DescribeMigrationTask
instance Core.ToHeaders DescribeMigrationTask where
toHeaders :: DescribeMigrationTask -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeMigrationTask -> 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.DescribeMigrationTask" ::
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 DescribeMigrationTask where
toJSON :: DescribeMigrationTask -> Value
toJSON DescribeMigrationTask' {Text
migrationTaskName :: Text
progressUpdateStream :: Text
$sel:migrationTaskName:DescribeMigrationTask' :: DescribeMigrationTask -> Text
$sel:progressUpdateStream:DescribeMigrationTask' :: DescribeMigrationTask -> 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
"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 DescribeMigrationTask where
toPath :: DescribeMigrationTask -> ByteString
toPath = ByteString -> DescribeMigrationTask -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeMigrationTask where
toQuery :: DescribeMigrationTask -> QueryString
toQuery = QueryString -> DescribeMigrationTask -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeMigrationTaskResponse = DescribeMigrationTaskResponse'
{
DescribeMigrationTaskResponse -> Maybe MigrationTask
migrationTask :: Prelude.Maybe MigrationTask,
DescribeMigrationTaskResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeMigrationTaskResponse
-> DescribeMigrationTaskResponse -> Bool
(DescribeMigrationTaskResponse
-> DescribeMigrationTaskResponse -> Bool)
-> (DescribeMigrationTaskResponse
-> DescribeMigrationTaskResponse -> Bool)
-> Eq DescribeMigrationTaskResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeMigrationTaskResponse
-> DescribeMigrationTaskResponse -> Bool
$c/= :: DescribeMigrationTaskResponse
-> DescribeMigrationTaskResponse -> Bool
== :: DescribeMigrationTaskResponse
-> DescribeMigrationTaskResponse -> Bool
$c== :: DescribeMigrationTaskResponse
-> DescribeMigrationTaskResponse -> Bool
Prelude.Eq, ReadPrec [DescribeMigrationTaskResponse]
ReadPrec DescribeMigrationTaskResponse
Int -> ReadS DescribeMigrationTaskResponse
ReadS [DescribeMigrationTaskResponse]
(Int -> ReadS DescribeMigrationTaskResponse)
-> ReadS [DescribeMigrationTaskResponse]
-> ReadPrec DescribeMigrationTaskResponse
-> ReadPrec [DescribeMigrationTaskResponse]
-> Read DescribeMigrationTaskResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeMigrationTaskResponse]
$creadListPrec :: ReadPrec [DescribeMigrationTaskResponse]
readPrec :: ReadPrec DescribeMigrationTaskResponse
$creadPrec :: ReadPrec DescribeMigrationTaskResponse
readList :: ReadS [DescribeMigrationTaskResponse]
$creadList :: ReadS [DescribeMigrationTaskResponse]
readsPrec :: Int -> ReadS DescribeMigrationTaskResponse
$creadsPrec :: Int -> ReadS DescribeMigrationTaskResponse
Prelude.Read, Int -> DescribeMigrationTaskResponse -> ShowS
[DescribeMigrationTaskResponse] -> ShowS
DescribeMigrationTaskResponse -> String
(Int -> DescribeMigrationTaskResponse -> ShowS)
-> (DescribeMigrationTaskResponse -> String)
-> ([DescribeMigrationTaskResponse] -> ShowS)
-> Show DescribeMigrationTaskResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeMigrationTaskResponse] -> ShowS
$cshowList :: [DescribeMigrationTaskResponse] -> ShowS
show :: DescribeMigrationTaskResponse -> String
$cshow :: DescribeMigrationTaskResponse -> String
showsPrec :: Int -> DescribeMigrationTaskResponse -> ShowS
$cshowsPrec :: Int -> DescribeMigrationTaskResponse -> ShowS
Prelude.Show, (forall x.
DescribeMigrationTaskResponse
-> Rep DescribeMigrationTaskResponse x)
-> (forall x.
Rep DescribeMigrationTaskResponse x
-> DescribeMigrationTaskResponse)
-> Generic DescribeMigrationTaskResponse
forall x.
Rep DescribeMigrationTaskResponse x
-> DescribeMigrationTaskResponse
forall x.
DescribeMigrationTaskResponse
-> Rep DescribeMigrationTaskResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeMigrationTaskResponse x
-> DescribeMigrationTaskResponse
$cfrom :: forall x.
DescribeMigrationTaskResponse
-> Rep DescribeMigrationTaskResponse x
Prelude.Generic)
newDescribeMigrationTaskResponse ::
Prelude.Int ->
DescribeMigrationTaskResponse
newDescribeMigrationTaskResponse :: Int -> DescribeMigrationTaskResponse
newDescribeMigrationTaskResponse Int
pHttpStatus_ =
DescribeMigrationTaskResponse' :: Maybe MigrationTask -> Int -> DescribeMigrationTaskResponse
DescribeMigrationTaskResponse'
{ $sel:migrationTask:DescribeMigrationTaskResponse' :: Maybe MigrationTask
migrationTask =
Maybe MigrationTask
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeMigrationTaskResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeMigrationTaskResponse_migrationTask :: Lens.Lens' DescribeMigrationTaskResponse (Prelude.Maybe MigrationTask)
describeMigrationTaskResponse_migrationTask :: (Maybe MigrationTask -> f (Maybe MigrationTask))
-> DescribeMigrationTaskResponse -> f DescribeMigrationTaskResponse
describeMigrationTaskResponse_migrationTask = (DescribeMigrationTaskResponse -> Maybe MigrationTask)
-> (DescribeMigrationTaskResponse
-> Maybe MigrationTask -> DescribeMigrationTaskResponse)
-> Lens
DescribeMigrationTaskResponse
DescribeMigrationTaskResponse
(Maybe MigrationTask)
(Maybe MigrationTask)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMigrationTaskResponse' {Maybe MigrationTask
migrationTask :: Maybe MigrationTask
$sel:migrationTask:DescribeMigrationTaskResponse' :: DescribeMigrationTaskResponse -> Maybe MigrationTask
migrationTask} -> Maybe MigrationTask
migrationTask) (\s :: DescribeMigrationTaskResponse
s@DescribeMigrationTaskResponse' {} Maybe MigrationTask
a -> DescribeMigrationTaskResponse
s {$sel:migrationTask:DescribeMigrationTaskResponse' :: Maybe MigrationTask
migrationTask = Maybe MigrationTask
a} :: DescribeMigrationTaskResponse)
describeMigrationTaskResponse_httpStatus :: Lens.Lens' DescribeMigrationTaskResponse Prelude.Int
describeMigrationTaskResponse_httpStatus :: (Int -> f Int)
-> DescribeMigrationTaskResponse -> f DescribeMigrationTaskResponse
describeMigrationTaskResponse_httpStatus = (DescribeMigrationTaskResponse -> Int)
-> (DescribeMigrationTaskResponse
-> Int -> DescribeMigrationTaskResponse)
-> Lens
DescribeMigrationTaskResponse DescribeMigrationTaskResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMigrationTaskResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeMigrationTaskResponse' :: DescribeMigrationTaskResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeMigrationTaskResponse
s@DescribeMigrationTaskResponse' {} Int
a -> DescribeMigrationTaskResponse
s {$sel:httpStatus:DescribeMigrationTaskResponse' :: Int
httpStatus = Int
a} :: DescribeMigrationTaskResponse)
instance Prelude.NFData DescribeMigrationTaskResponse