{-# 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.NotifyApplicationState
(
NotifyApplicationState (..),
newNotifyApplicationState,
notifyApplicationState_updateDateTime,
notifyApplicationState_dryRun,
notifyApplicationState_applicationId,
notifyApplicationState_status,
NotifyApplicationStateResponse (..),
newNotifyApplicationStateResponse,
notifyApplicationStateResponse_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 NotifyApplicationState = NotifyApplicationState'
{
NotifyApplicationState -> Maybe POSIX
updateDateTime :: Prelude.Maybe Core.POSIX,
NotifyApplicationState -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
NotifyApplicationState -> Text
applicationId :: Prelude.Text,
NotifyApplicationState -> ApplicationStatus
status :: ApplicationStatus
}
deriving (NotifyApplicationState -> NotifyApplicationState -> Bool
(NotifyApplicationState -> NotifyApplicationState -> Bool)
-> (NotifyApplicationState -> NotifyApplicationState -> Bool)
-> Eq NotifyApplicationState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NotifyApplicationState -> NotifyApplicationState -> Bool
$c/= :: NotifyApplicationState -> NotifyApplicationState -> Bool
== :: NotifyApplicationState -> NotifyApplicationState -> Bool
$c== :: NotifyApplicationState -> NotifyApplicationState -> Bool
Prelude.Eq, ReadPrec [NotifyApplicationState]
ReadPrec NotifyApplicationState
Int -> ReadS NotifyApplicationState
ReadS [NotifyApplicationState]
(Int -> ReadS NotifyApplicationState)
-> ReadS [NotifyApplicationState]
-> ReadPrec NotifyApplicationState
-> ReadPrec [NotifyApplicationState]
-> Read NotifyApplicationState
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NotifyApplicationState]
$creadListPrec :: ReadPrec [NotifyApplicationState]
readPrec :: ReadPrec NotifyApplicationState
$creadPrec :: ReadPrec NotifyApplicationState
readList :: ReadS [NotifyApplicationState]
$creadList :: ReadS [NotifyApplicationState]
readsPrec :: Int -> ReadS NotifyApplicationState
$creadsPrec :: Int -> ReadS NotifyApplicationState
Prelude.Read, Int -> NotifyApplicationState -> ShowS
[NotifyApplicationState] -> ShowS
NotifyApplicationState -> String
(Int -> NotifyApplicationState -> ShowS)
-> (NotifyApplicationState -> String)
-> ([NotifyApplicationState] -> ShowS)
-> Show NotifyApplicationState
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NotifyApplicationState] -> ShowS
$cshowList :: [NotifyApplicationState] -> ShowS
show :: NotifyApplicationState -> String
$cshow :: NotifyApplicationState -> String
showsPrec :: Int -> NotifyApplicationState -> ShowS
$cshowsPrec :: Int -> NotifyApplicationState -> ShowS
Prelude.Show, (forall x. NotifyApplicationState -> Rep NotifyApplicationState x)
-> (forall x.
Rep NotifyApplicationState x -> NotifyApplicationState)
-> Generic NotifyApplicationState
forall x. Rep NotifyApplicationState x -> NotifyApplicationState
forall x. NotifyApplicationState -> Rep NotifyApplicationState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NotifyApplicationState x -> NotifyApplicationState
$cfrom :: forall x. NotifyApplicationState -> Rep NotifyApplicationState x
Prelude.Generic)
newNotifyApplicationState ::
Prelude.Text ->
ApplicationStatus ->
NotifyApplicationState
newNotifyApplicationState :: Text -> ApplicationStatus -> NotifyApplicationState
newNotifyApplicationState Text
pApplicationId_ ApplicationStatus
pStatus_ =
NotifyApplicationState' :: Maybe POSIX
-> Maybe Bool
-> Text
-> ApplicationStatus
-> NotifyApplicationState
NotifyApplicationState'
{ $sel:updateDateTime:NotifyApplicationState' :: Maybe POSIX
updateDateTime =
Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:dryRun:NotifyApplicationState' :: Maybe Bool
dryRun = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:applicationId:NotifyApplicationState' :: Text
applicationId = Text
pApplicationId_,
$sel:status:NotifyApplicationState' :: ApplicationStatus
status = ApplicationStatus
pStatus_
}
notifyApplicationState_updateDateTime :: Lens.Lens' NotifyApplicationState (Prelude.Maybe Prelude.UTCTime)
notifyApplicationState_updateDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> NotifyApplicationState -> f NotifyApplicationState
notifyApplicationState_updateDateTime = (NotifyApplicationState -> Maybe POSIX)
-> (NotifyApplicationState
-> Maybe POSIX -> NotifyApplicationState)
-> Lens
NotifyApplicationState
NotifyApplicationState
(Maybe POSIX)
(Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotifyApplicationState' {Maybe POSIX
updateDateTime :: Maybe POSIX
$sel:updateDateTime:NotifyApplicationState' :: NotifyApplicationState -> Maybe POSIX
updateDateTime} -> Maybe POSIX
updateDateTime) (\s :: NotifyApplicationState
s@NotifyApplicationState' {} Maybe POSIX
a -> NotifyApplicationState
s {$sel:updateDateTime:NotifyApplicationState' :: Maybe POSIX
updateDateTime = Maybe POSIX
a} :: NotifyApplicationState) ((Maybe POSIX -> f (Maybe POSIX))
-> NotifyApplicationState -> f NotifyApplicationState)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> NotifyApplicationState
-> f NotifyApplicationState
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
notifyApplicationState_dryRun :: Lens.Lens' NotifyApplicationState (Prelude.Maybe Prelude.Bool)
notifyApplicationState_dryRun :: (Maybe Bool -> f (Maybe Bool))
-> NotifyApplicationState -> f NotifyApplicationState
notifyApplicationState_dryRun = (NotifyApplicationState -> Maybe Bool)
-> (NotifyApplicationState -> Maybe Bool -> NotifyApplicationState)
-> Lens
NotifyApplicationState
NotifyApplicationState
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotifyApplicationState' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:NotifyApplicationState' :: NotifyApplicationState -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: NotifyApplicationState
s@NotifyApplicationState' {} Maybe Bool
a -> NotifyApplicationState
s {$sel:dryRun:NotifyApplicationState' :: Maybe Bool
dryRun = Maybe Bool
a} :: NotifyApplicationState)
notifyApplicationState_applicationId :: Lens.Lens' NotifyApplicationState Prelude.Text
notifyApplicationState_applicationId :: (Text -> f Text)
-> NotifyApplicationState -> f NotifyApplicationState
notifyApplicationState_applicationId = (NotifyApplicationState -> Text)
-> (NotifyApplicationState -> Text -> NotifyApplicationState)
-> Lens NotifyApplicationState NotifyApplicationState Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotifyApplicationState' {Text
applicationId :: Text
$sel:applicationId:NotifyApplicationState' :: NotifyApplicationState -> Text
applicationId} -> Text
applicationId) (\s :: NotifyApplicationState
s@NotifyApplicationState' {} Text
a -> NotifyApplicationState
s {$sel:applicationId:NotifyApplicationState' :: Text
applicationId = Text
a} :: NotifyApplicationState)
notifyApplicationState_status :: Lens.Lens' NotifyApplicationState ApplicationStatus
notifyApplicationState_status :: (ApplicationStatus -> f ApplicationStatus)
-> NotifyApplicationState -> f NotifyApplicationState
notifyApplicationState_status = (NotifyApplicationState -> ApplicationStatus)
-> (NotifyApplicationState
-> ApplicationStatus -> NotifyApplicationState)
-> Lens
NotifyApplicationState
NotifyApplicationState
ApplicationStatus
ApplicationStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotifyApplicationState' {ApplicationStatus
status :: ApplicationStatus
$sel:status:NotifyApplicationState' :: NotifyApplicationState -> ApplicationStatus
status} -> ApplicationStatus
status) (\s :: NotifyApplicationState
s@NotifyApplicationState' {} ApplicationStatus
a -> NotifyApplicationState
s {$sel:status:NotifyApplicationState' :: ApplicationStatus
status = ApplicationStatus
a} :: NotifyApplicationState)
instance Core.AWSRequest NotifyApplicationState where
type
AWSResponse NotifyApplicationState =
NotifyApplicationStateResponse
request :: NotifyApplicationState -> Request NotifyApplicationState
request = Service -> NotifyApplicationState -> Request NotifyApplicationState
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy NotifyApplicationState
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse NotifyApplicationState)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse NotifyApplicationState))
-> Logger
-> Service
-> Proxy NotifyApplicationState
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse NotifyApplicationState)))
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 -> NotifyApplicationStateResponse
NotifyApplicationStateResponse'
(Int -> NotifyApplicationStateResponse)
-> Either String Int
-> Either String NotifyApplicationStateResponse
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 NotifyApplicationState
instance Prelude.NFData NotifyApplicationState
instance Core.ToHeaders NotifyApplicationState where
toHeaders :: NotifyApplicationState -> ResponseHeaders
toHeaders =
ResponseHeaders -> NotifyApplicationState -> 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.NotifyApplicationState" ::
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 NotifyApplicationState where
toJSON :: NotifyApplicationState -> Value
toJSON NotifyApplicationState' {Maybe Bool
Maybe POSIX
Text
ApplicationStatus
status :: ApplicationStatus
applicationId :: Text
dryRun :: Maybe Bool
updateDateTime :: Maybe POSIX
$sel:status:NotifyApplicationState' :: NotifyApplicationState -> ApplicationStatus
$sel:applicationId:NotifyApplicationState' :: NotifyApplicationState -> Text
$sel:dryRun:NotifyApplicationState' :: NotifyApplicationState -> Maybe Bool
$sel:updateDateTime:NotifyApplicationState' :: NotifyApplicationState -> Maybe POSIX
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"UpdateDateTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
updateDateTime,
(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
"ApplicationId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
applicationId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Status" Text -> ApplicationStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ApplicationStatus
status)
]
)
instance Core.ToPath NotifyApplicationState where
toPath :: NotifyApplicationState -> ByteString
toPath = ByteString -> NotifyApplicationState -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery NotifyApplicationState where
toQuery :: NotifyApplicationState -> QueryString
toQuery = QueryString -> NotifyApplicationState -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data NotifyApplicationStateResponse = NotifyApplicationStateResponse'
{
NotifyApplicationStateResponse -> Int
httpStatus :: Prelude.Int
}
deriving (NotifyApplicationStateResponse
-> NotifyApplicationStateResponse -> Bool
(NotifyApplicationStateResponse
-> NotifyApplicationStateResponse -> Bool)
-> (NotifyApplicationStateResponse
-> NotifyApplicationStateResponse -> Bool)
-> Eq NotifyApplicationStateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NotifyApplicationStateResponse
-> NotifyApplicationStateResponse -> Bool
$c/= :: NotifyApplicationStateResponse
-> NotifyApplicationStateResponse -> Bool
== :: NotifyApplicationStateResponse
-> NotifyApplicationStateResponse -> Bool
$c== :: NotifyApplicationStateResponse
-> NotifyApplicationStateResponse -> Bool
Prelude.Eq, ReadPrec [NotifyApplicationStateResponse]
ReadPrec NotifyApplicationStateResponse
Int -> ReadS NotifyApplicationStateResponse
ReadS [NotifyApplicationStateResponse]
(Int -> ReadS NotifyApplicationStateResponse)
-> ReadS [NotifyApplicationStateResponse]
-> ReadPrec NotifyApplicationStateResponse
-> ReadPrec [NotifyApplicationStateResponse]
-> Read NotifyApplicationStateResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NotifyApplicationStateResponse]
$creadListPrec :: ReadPrec [NotifyApplicationStateResponse]
readPrec :: ReadPrec NotifyApplicationStateResponse
$creadPrec :: ReadPrec NotifyApplicationStateResponse
readList :: ReadS [NotifyApplicationStateResponse]
$creadList :: ReadS [NotifyApplicationStateResponse]
readsPrec :: Int -> ReadS NotifyApplicationStateResponse
$creadsPrec :: Int -> ReadS NotifyApplicationStateResponse
Prelude.Read, Int -> NotifyApplicationStateResponse -> ShowS
[NotifyApplicationStateResponse] -> ShowS
NotifyApplicationStateResponse -> String
(Int -> NotifyApplicationStateResponse -> ShowS)
-> (NotifyApplicationStateResponse -> String)
-> ([NotifyApplicationStateResponse] -> ShowS)
-> Show NotifyApplicationStateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NotifyApplicationStateResponse] -> ShowS
$cshowList :: [NotifyApplicationStateResponse] -> ShowS
show :: NotifyApplicationStateResponse -> String
$cshow :: NotifyApplicationStateResponse -> String
showsPrec :: Int -> NotifyApplicationStateResponse -> ShowS
$cshowsPrec :: Int -> NotifyApplicationStateResponse -> ShowS
Prelude.Show, (forall x.
NotifyApplicationStateResponse
-> Rep NotifyApplicationStateResponse x)
-> (forall x.
Rep NotifyApplicationStateResponse x
-> NotifyApplicationStateResponse)
-> Generic NotifyApplicationStateResponse
forall x.
Rep NotifyApplicationStateResponse x
-> NotifyApplicationStateResponse
forall x.
NotifyApplicationStateResponse
-> Rep NotifyApplicationStateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep NotifyApplicationStateResponse x
-> NotifyApplicationStateResponse
$cfrom :: forall x.
NotifyApplicationStateResponse
-> Rep NotifyApplicationStateResponse x
Prelude.Generic)
newNotifyApplicationStateResponse ::
Prelude.Int ->
NotifyApplicationStateResponse
newNotifyApplicationStateResponse :: Int -> NotifyApplicationStateResponse
newNotifyApplicationStateResponse Int
pHttpStatus_ =
NotifyApplicationStateResponse' :: Int -> NotifyApplicationStateResponse
NotifyApplicationStateResponse'
{ $sel:httpStatus:NotifyApplicationStateResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
notifyApplicationStateResponse_httpStatus :: Lens.Lens' NotifyApplicationStateResponse Prelude.Int
notifyApplicationStateResponse_httpStatus :: (Int -> f Int)
-> NotifyApplicationStateResponse
-> f NotifyApplicationStateResponse
notifyApplicationStateResponse_httpStatus = (NotifyApplicationStateResponse -> Int)
-> (NotifyApplicationStateResponse
-> Int -> NotifyApplicationStateResponse)
-> Lens
NotifyApplicationStateResponse
NotifyApplicationStateResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotifyApplicationStateResponse' {Int
httpStatus :: Int
$sel:httpStatus:NotifyApplicationStateResponse' :: NotifyApplicationStateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: NotifyApplicationStateResponse
s@NotifyApplicationStateResponse' {} Int
a -> NotifyApplicationStateResponse
s {$sel:httpStatus:NotifyApplicationStateResponse' :: Int
httpStatus = Int
a} :: NotifyApplicationStateResponse)
instance
Prelude.NFData
NotifyApplicationStateResponse