{-# 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.DescribeApplicationState
(
DescribeApplicationState (..),
newDescribeApplicationState,
describeApplicationState_applicationId,
DescribeApplicationStateResponse (..),
newDescribeApplicationStateResponse,
describeApplicationStateResponse_lastUpdatedTime,
describeApplicationStateResponse_applicationStatus,
describeApplicationStateResponse_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 DescribeApplicationState = DescribeApplicationState'
{
DescribeApplicationState -> Text
applicationId :: Prelude.Text
}
deriving (DescribeApplicationState -> DescribeApplicationState -> Bool
(DescribeApplicationState -> DescribeApplicationState -> Bool)
-> (DescribeApplicationState -> DescribeApplicationState -> Bool)
-> Eq DescribeApplicationState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeApplicationState -> DescribeApplicationState -> Bool
$c/= :: DescribeApplicationState -> DescribeApplicationState -> Bool
== :: DescribeApplicationState -> DescribeApplicationState -> Bool
$c== :: DescribeApplicationState -> DescribeApplicationState -> Bool
Prelude.Eq, ReadPrec [DescribeApplicationState]
ReadPrec DescribeApplicationState
Int -> ReadS DescribeApplicationState
ReadS [DescribeApplicationState]
(Int -> ReadS DescribeApplicationState)
-> ReadS [DescribeApplicationState]
-> ReadPrec DescribeApplicationState
-> ReadPrec [DescribeApplicationState]
-> Read DescribeApplicationState
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeApplicationState]
$creadListPrec :: ReadPrec [DescribeApplicationState]
readPrec :: ReadPrec DescribeApplicationState
$creadPrec :: ReadPrec DescribeApplicationState
readList :: ReadS [DescribeApplicationState]
$creadList :: ReadS [DescribeApplicationState]
readsPrec :: Int -> ReadS DescribeApplicationState
$creadsPrec :: Int -> ReadS DescribeApplicationState
Prelude.Read, Int -> DescribeApplicationState -> ShowS
[DescribeApplicationState] -> ShowS
DescribeApplicationState -> String
(Int -> DescribeApplicationState -> ShowS)
-> (DescribeApplicationState -> String)
-> ([DescribeApplicationState] -> ShowS)
-> Show DescribeApplicationState
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeApplicationState] -> ShowS
$cshowList :: [DescribeApplicationState] -> ShowS
show :: DescribeApplicationState -> String
$cshow :: DescribeApplicationState -> String
showsPrec :: Int -> DescribeApplicationState -> ShowS
$cshowsPrec :: Int -> DescribeApplicationState -> ShowS
Prelude.Show, (forall x.
DescribeApplicationState -> Rep DescribeApplicationState x)
-> (forall x.
Rep DescribeApplicationState x -> DescribeApplicationState)
-> Generic DescribeApplicationState
forall x.
Rep DescribeApplicationState x -> DescribeApplicationState
forall x.
DescribeApplicationState -> Rep DescribeApplicationState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeApplicationState x -> DescribeApplicationState
$cfrom :: forall x.
DescribeApplicationState -> Rep DescribeApplicationState x
Prelude.Generic)
newDescribeApplicationState ::
Prelude.Text ->
DescribeApplicationState
newDescribeApplicationState :: Text -> DescribeApplicationState
newDescribeApplicationState Text
pApplicationId_ =
DescribeApplicationState' :: Text -> DescribeApplicationState
DescribeApplicationState'
{ $sel:applicationId:DescribeApplicationState' :: Text
applicationId =
Text
pApplicationId_
}
describeApplicationState_applicationId :: Lens.Lens' DescribeApplicationState Prelude.Text
describeApplicationState_applicationId :: (Text -> f Text)
-> DescribeApplicationState -> f DescribeApplicationState
describeApplicationState_applicationId = (DescribeApplicationState -> Text)
-> (DescribeApplicationState -> Text -> DescribeApplicationState)
-> Lens DescribeApplicationState DescribeApplicationState Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeApplicationState' {Text
applicationId :: Text
$sel:applicationId:DescribeApplicationState' :: DescribeApplicationState -> Text
applicationId} -> Text
applicationId) (\s :: DescribeApplicationState
s@DescribeApplicationState' {} Text
a -> DescribeApplicationState
s {$sel:applicationId:DescribeApplicationState' :: Text
applicationId = Text
a} :: DescribeApplicationState)
instance Core.AWSRequest DescribeApplicationState where
type
AWSResponse DescribeApplicationState =
DescribeApplicationStateResponse
request :: DescribeApplicationState -> Request DescribeApplicationState
request = Service
-> DescribeApplicationState -> Request DescribeApplicationState
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeApplicationState
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeApplicationState)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeApplicationState))
-> Logger
-> Service
-> Proxy DescribeApplicationState
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeApplicationState)))
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 POSIX
-> Maybe ApplicationStatus
-> Int
-> DescribeApplicationStateResponse
DescribeApplicationStateResponse'
(Maybe POSIX
-> Maybe ApplicationStatus
-> Int
-> DescribeApplicationStateResponse)
-> Either String (Maybe POSIX)
-> Either
String
(Maybe ApplicationStatus
-> Int -> DescribeApplicationStateResponse)
forall (f :: * -> *) a b. Functor 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
"LastUpdatedTime")
Either
String
(Maybe ApplicationStatus
-> Int -> DescribeApplicationStateResponse)
-> Either String (Maybe ApplicationStatus)
-> Either String (Int -> DescribeApplicationStateResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe ApplicationStatus)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ApplicationStatus")
Either String (Int -> DescribeApplicationStateResponse)
-> Either String Int
-> Either String DescribeApplicationStateResponse
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 DescribeApplicationState
instance Prelude.NFData DescribeApplicationState
instance Core.ToHeaders DescribeApplicationState where
toHeaders :: DescribeApplicationState -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeApplicationState -> 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.DescribeApplicationState" ::
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 DescribeApplicationState where
toJSON :: DescribeApplicationState -> Value
toJSON DescribeApplicationState' {Text
applicationId :: Text
$sel:applicationId:DescribeApplicationState' :: DescribeApplicationState -> 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
"ApplicationId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
applicationId)
]
)
instance Core.ToPath DescribeApplicationState where
toPath :: DescribeApplicationState -> ByteString
toPath = ByteString -> DescribeApplicationState -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeApplicationState where
toQuery :: DescribeApplicationState -> QueryString
toQuery = QueryString -> DescribeApplicationState -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeApplicationStateResponse = DescribeApplicationStateResponse'
{
DescribeApplicationStateResponse -> Maybe POSIX
lastUpdatedTime :: Prelude.Maybe Core.POSIX,
DescribeApplicationStateResponse -> Maybe ApplicationStatus
applicationStatus :: Prelude.Maybe ApplicationStatus,
DescribeApplicationStateResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeApplicationStateResponse
-> DescribeApplicationStateResponse -> Bool
(DescribeApplicationStateResponse
-> DescribeApplicationStateResponse -> Bool)
-> (DescribeApplicationStateResponse
-> DescribeApplicationStateResponse -> Bool)
-> Eq DescribeApplicationStateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeApplicationStateResponse
-> DescribeApplicationStateResponse -> Bool
$c/= :: DescribeApplicationStateResponse
-> DescribeApplicationStateResponse -> Bool
== :: DescribeApplicationStateResponse
-> DescribeApplicationStateResponse -> Bool
$c== :: DescribeApplicationStateResponse
-> DescribeApplicationStateResponse -> Bool
Prelude.Eq, ReadPrec [DescribeApplicationStateResponse]
ReadPrec DescribeApplicationStateResponse
Int -> ReadS DescribeApplicationStateResponse
ReadS [DescribeApplicationStateResponse]
(Int -> ReadS DescribeApplicationStateResponse)
-> ReadS [DescribeApplicationStateResponse]
-> ReadPrec DescribeApplicationStateResponse
-> ReadPrec [DescribeApplicationStateResponse]
-> Read DescribeApplicationStateResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeApplicationStateResponse]
$creadListPrec :: ReadPrec [DescribeApplicationStateResponse]
readPrec :: ReadPrec DescribeApplicationStateResponse
$creadPrec :: ReadPrec DescribeApplicationStateResponse
readList :: ReadS [DescribeApplicationStateResponse]
$creadList :: ReadS [DescribeApplicationStateResponse]
readsPrec :: Int -> ReadS DescribeApplicationStateResponse
$creadsPrec :: Int -> ReadS DescribeApplicationStateResponse
Prelude.Read, Int -> DescribeApplicationStateResponse -> ShowS
[DescribeApplicationStateResponse] -> ShowS
DescribeApplicationStateResponse -> String
(Int -> DescribeApplicationStateResponse -> ShowS)
-> (DescribeApplicationStateResponse -> String)
-> ([DescribeApplicationStateResponse] -> ShowS)
-> Show DescribeApplicationStateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeApplicationStateResponse] -> ShowS
$cshowList :: [DescribeApplicationStateResponse] -> ShowS
show :: DescribeApplicationStateResponse -> String
$cshow :: DescribeApplicationStateResponse -> String
showsPrec :: Int -> DescribeApplicationStateResponse -> ShowS
$cshowsPrec :: Int -> DescribeApplicationStateResponse -> ShowS
Prelude.Show, (forall x.
DescribeApplicationStateResponse
-> Rep DescribeApplicationStateResponse x)
-> (forall x.
Rep DescribeApplicationStateResponse x
-> DescribeApplicationStateResponse)
-> Generic DescribeApplicationStateResponse
forall x.
Rep DescribeApplicationStateResponse x
-> DescribeApplicationStateResponse
forall x.
DescribeApplicationStateResponse
-> Rep DescribeApplicationStateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeApplicationStateResponse x
-> DescribeApplicationStateResponse
$cfrom :: forall x.
DescribeApplicationStateResponse
-> Rep DescribeApplicationStateResponse x
Prelude.Generic)
newDescribeApplicationStateResponse ::
Prelude.Int ->
DescribeApplicationStateResponse
newDescribeApplicationStateResponse :: Int -> DescribeApplicationStateResponse
newDescribeApplicationStateResponse Int
pHttpStatus_ =
DescribeApplicationStateResponse' :: Maybe POSIX
-> Maybe ApplicationStatus
-> Int
-> DescribeApplicationStateResponse
DescribeApplicationStateResponse'
{ $sel:lastUpdatedTime:DescribeApplicationStateResponse' :: Maybe POSIX
lastUpdatedTime =
Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:applicationStatus:DescribeApplicationStateResponse' :: Maybe ApplicationStatus
applicationStatus = Maybe ApplicationStatus
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeApplicationStateResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeApplicationStateResponse_lastUpdatedTime :: Lens.Lens' DescribeApplicationStateResponse (Prelude.Maybe Prelude.UTCTime)
describeApplicationStateResponse_lastUpdatedTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DescribeApplicationStateResponse
-> f DescribeApplicationStateResponse
describeApplicationStateResponse_lastUpdatedTime = (DescribeApplicationStateResponse -> Maybe POSIX)
-> (DescribeApplicationStateResponse
-> Maybe POSIX -> DescribeApplicationStateResponse)
-> Lens
DescribeApplicationStateResponse
DescribeApplicationStateResponse
(Maybe POSIX)
(Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeApplicationStateResponse' {Maybe POSIX
lastUpdatedTime :: Maybe POSIX
$sel:lastUpdatedTime:DescribeApplicationStateResponse' :: DescribeApplicationStateResponse -> Maybe POSIX
lastUpdatedTime} -> Maybe POSIX
lastUpdatedTime) (\s :: DescribeApplicationStateResponse
s@DescribeApplicationStateResponse' {} Maybe POSIX
a -> DescribeApplicationStateResponse
s {$sel:lastUpdatedTime:DescribeApplicationStateResponse' :: Maybe POSIX
lastUpdatedTime = Maybe POSIX
a} :: DescribeApplicationStateResponse) ((Maybe POSIX -> f (Maybe POSIX))
-> DescribeApplicationStateResponse
-> f DescribeApplicationStateResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DescribeApplicationStateResponse
-> f DescribeApplicationStateResponse
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
describeApplicationStateResponse_applicationStatus :: Lens.Lens' DescribeApplicationStateResponse (Prelude.Maybe ApplicationStatus)
describeApplicationStateResponse_applicationStatus :: (Maybe ApplicationStatus -> f (Maybe ApplicationStatus))
-> DescribeApplicationStateResponse
-> f DescribeApplicationStateResponse
describeApplicationStateResponse_applicationStatus = (DescribeApplicationStateResponse -> Maybe ApplicationStatus)
-> (DescribeApplicationStateResponse
-> Maybe ApplicationStatus -> DescribeApplicationStateResponse)
-> Lens
DescribeApplicationStateResponse
DescribeApplicationStateResponse
(Maybe ApplicationStatus)
(Maybe ApplicationStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeApplicationStateResponse' {Maybe ApplicationStatus
applicationStatus :: Maybe ApplicationStatus
$sel:applicationStatus:DescribeApplicationStateResponse' :: DescribeApplicationStateResponse -> Maybe ApplicationStatus
applicationStatus} -> Maybe ApplicationStatus
applicationStatus) (\s :: DescribeApplicationStateResponse
s@DescribeApplicationStateResponse' {} Maybe ApplicationStatus
a -> DescribeApplicationStateResponse
s {$sel:applicationStatus:DescribeApplicationStateResponse' :: Maybe ApplicationStatus
applicationStatus = Maybe ApplicationStatus
a} :: DescribeApplicationStateResponse)
describeApplicationStateResponse_httpStatus :: Lens.Lens' DescribeApplicationStateResponse Prelude.Int
describeApplicationStateResponse_httpStatus :: (Int -> f Int)
-> DescribeApplicationStateResponse
-> f DescribeApplicationStateResponse
describeApplicationStateResponse_httpStatus = (DescribeApplicationStateResponse -> Int)
-> (DescribeApplicationStateResponse
-> Int -> DescribeApplicationStateResponse)
-> Lens
DescribeApplicationStateResponse
DescribeApplicationStateResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeApplicationStateResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeApplicationStateResponse' :: DescribeApplicationStateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeApplicationStateResponse
s@DescribeApplicationStateResponse' {} Int
a -> DescribeApplicationStateResponse
s {$sel:httpStatus:DescribeApplicationStateResponse' :: Int
httpStatus = Int
a} :: DescribeApplicationStateResponse)
instance
Prelude.NFData
DescribeApplicationStateResponse