{-# 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.MGN.ChangeServerLifeCycleState
(
ChangeServerLifeCycleState (..),
newChangeServerLifeCycleState,
changeServerLifeCycleState_lifeCycle,
changeServerLifeCycleState_sourceServerID,
SourceServer (..),
newSourceServer,
sourceServer_sourceProperties,
sourceServer_arn,
sourceServer_launchedInstance,
sourceServer_lifeCycle,
sourceServer_isArchived,
sourceServer_dataReplicationInfo,
sourceServer_sourceServerID,
sourceServer_tags,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MGN.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ChangeServerLifeCycleState = ChangeServerLifeCycleState'
{
ChangeServerLifeCycleState
-> ChangeServerLifeCycleStateSourceServerLifecycle
lifeCycle :: ChangeServerLifeCycleStateSourceServerLifecycle,
ChangeServerLifeCycleState -> Text
sourceServerID :: Prelude.Text
}
deriving (ChangeServerLifeCycleState -> ChangeServerLifeCycleState -> Bool
(ChangeServerLifeCycleState -> ChangeServerLifeCycleState -> Bool)
-> (ChangeServerLifeCycleState
-> ChangeServerLifeCycleState -> Bool)
-> Eq ChangeServerLifeCycleState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChangeServerLifeCycleState -> ChangeServerLifeCycleState -> Bool
$c/= :: ChangeServerLifeCycleState -> ChangeServerLifeCycleState -> Bool
== :: ChangeServerLifeCycleState -> ChangeServerLifeCycleState -> Bool
$c== :: ChangeServerLifeCycleState -> ChangeServerLifeCycleState -> Bool
Prelude.Eq, ReadPrec [ChangeServerLifeCycleState]
ReadPrec ChangeServerLifeCycleState
Int -> ReadS ChangeServerLifeCycleState
ReadS [ChangeServerLifeCycleState]
(Int -> ReadS ChangeServerLifeCycleState)
-> ReadS [ChangeServerLifeCycleState]
-> ReadPrec ChangeServerLifeCycleState
-> ReadPrec [ChangeServerLifeCycleState]
-> Read ChangeServerLifeCycleState
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChangeServerLifeCycleState]
$creadListPrec :: ReadPrec [ChangeServerLifeCycleState]
readPrec :: ReadPrec ChangeServerLifeCycleState
$creadPrec :: ReadPrec ChangeServerLifeCycleState
readList :: ReadS [ChangeServerLifeCycleState]
$creadList :: ReadS [ChangeServerLifeCycleState]
readsPrec :: Int -> ReadS ChangeServerLifeCycleState
$creadsPrec :: Int -> ReadS ChangeServerLifeCycleState
Prelude.Read, Int -> ChangeServerLifeCycleState -> ShowS
[ChangeServerLifeCycleState] -> ShowS
ChangeServerLifeCycleState -> String
(Int -> ChangeServerLifeCycleState -> ShowS)
-> (ChangeServerLifeCycleState -> String)
-> ([ChangeServerLifeCycleState] -> ShowS)
-> Show ChangeServerLifeCycleState
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChangeServerLifeCycleState] -> ShowS
$cshowList :: [ChangeServerLifeCycleState] -> ShowS
show :: ChangeServerLifeCycleState -> String
$cshow :: ChangeServerLifeCycleState -> String
showsPrec :: Int -> ChangeServerLifeCycleState -> ShowS
$cshowsPrec :: Int -> ChangeServerLifeCycleState -> ShowS
Prelude.Show, (forall x.
ChangeServerLifeCycleState -> Rep ChangeServerLifeCycleState x)
-> (forall x.
Rep ChangeServerLifeCycleState x -> ChangeServerLifeCycleState)
-> Generic ChangeServerLifeCycleState
forall x.
Rep ChangeServerLifeCycleState x -> ChangeServerLifeCycleState
forall x.
ChangeServerLifeCycleState -> Rep ChangeServerLifeCycleState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ChangeServerLifeCycleState x -> ChangeServerLifeCycleState
$cfrom :: forall x.
ChangeServerLifeCycleState -> Rep ChangeServerLifeCycleState x
Prelude.Generic)
newChangeServerLifeCycleState ::
ChangeServerLifeCycleStateSourceServerLifecycle ->
Prelude.Text ->
ChangeServerLifeCycleState
newChangeServerLifeCycleState :: ChangeServerLifeCycleStateSourceServerLifecycle
-> Text -> ChangeServerLifeCycleState
newChangeServerLifeCycleState
ChangeServerLifeCycleStateSourceServerLifecycle
pLifeCycle_
Text
pSourceServerID_ =
ChangeServerLifeCycleState' :: ChangeServerLifeCycleStateSourceServerLifecycle
-> Text -> ChangeServerLifeCycleState
ChangeServerLifeCycleState'
{ $sel:lifeCycle:ChangeServerLifeCycleState' :: ChangeServerLifeCycleStateSourceServerLifecycle
lifeCycle =
ChangeServerLifeCycleStateSourceServerLifecycle
pLifeCycle_,
$sel:sourceServerID:ChangeServerLifeCycleState' :: Text
sourceServerID = Text
pSourceServerID_
}
changeServerLifeCycleState_lifeCycle :: Lens.Lens' ChangeServerLifeCycleState ChangeServerLifeCycleStateSourceServerLifecycle
changeServerLifeCycleState_lifeCycle :: (ChangeServerLifeCycleStateSourceServerLifecycle
-> f ChangeServerLifeCycleStateSourceServerLifecycle)
-> ChangeServerLifeCycleState -> f ChangeServerLifeCycleState
changeServerLifeCycleState_lifeCycle = (ChangeServerLifeCycleState
-> ChangeServerLifeCycleStateSourceServerLifecycle)
-> (ChangeServerLifeCycleState
-> ChangeServerLifeCycleStateSourceServerLifecycle
-> ChangeServerLifeCycleState)
-> Lens
ChangeServerLifeCycleState
ChangeServerLifeCycleState
ChangeServerLifeCycleStateSourceServerLifecycle
ChangeServerLifeCycleStateSourceServerLifecycle
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChangeServerLifeCycleState' {ChangeServerLifeCycleStateSourceServerLifecycle
lifeCycle :: ChangeServerLifeCycleStateSourceServerLifecycle
$sel:lifeCycle:ChangeServerLifeCycleState' :: ChangeServerLifeCycleState
-> ChangeServerLifeCycleStateSourceServerLifecycle
lifeCycle} -> ChangeServerLifeCycleStateSourceServerLifecycle
lifeCycle) (\s :: ChangeServerLifeCycleState
s@ChangeServerLifeCycleState' {} ChangeServerLifeCycleStateSourceServerLifecycle
a -> ChangeServerLifeCycleState
s {$sel:lifeCycle:ChangeServerLifeCycleState' :: ChangeServerLifeCycleStateSourceServerLifecycle
lifeCycle = ChangeServerLifeCycleStateSourceServerLifecycle
a} :: ChangeServerLifeCycleState)
changeServerLifeCycleState_sourceServerID :: Lens.Lens' ChangeServerLifeCycleState Prelude.Text
changeServerLifeCycleState_sourceServerID :: (Text -> f Text)
-> ChangeServerLifeCycleState -> f ChangeServerLifeCycleState
changeServerLifeCycleState_sourceServerID = (ChangeServerLifeCycleState -> Text)
-> (ChangeServerLifeCycleState
-> Text -> ChangeServerLifeCycleState)
-> Lens
ChangeServerLifeCycleState ChangeServerLifeCycleState Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChangeServerLifeCycleState' {Text
sourceServerID :: Text
$sel:sourceServerID:ChangeServerLifeCycleState' :: ChangeServerLifeCycleState -> Text
sourceServerID} -> Text
sourceServerID) (\s :: ChangeServerLifeCycleState
s@ChangeServerLifeCycleState' {} Text
a -> ChangeServerLifeCycleState
s {$sel:sourceServerID:ChangeServerLifeCycleState' :: Text
sourceServerID = Text
a} :: ChangeServerLifeCycleState)
instance Core.AWSRequest ChangeServerLifeCycleState where
type
AWSResponse ChangeServerLifeCycleState =
SourceServer
request :: ChangeServerLifeCycleState -> Request ChangeServerLifeCycleState
request = Service
-> ChangeServerLifeCycleState -> Request ChangeServerLifeCycleState
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ChangeServerLifeCycleState
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ChangeServerLifeCycleState)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ChangeServerLifeCycleState))
-> Logger
-> Service
-> Proxy ChangeServerLifeCycleState
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ChangeServerLifeCycleState)))
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 -> Object -> Either String SourceServer
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable ChangeServerLifeCycleState
instance Prelude.NFData ChangeServerLifeCycleState
instance Core.ToHeaders ChangeServerLifeCycleState where
toHeaders :: ChangeServerLifeCycleState -> ResponseHeaders
toHeaders =
ResponseHeaders -> ChangeServerLifeCycleState -> 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 ChangeServerLifeCycleState where
toJSON :: ChangeServerLifeCycleState -> Value
toJSON ChangeServerLifeCycleState' {Text
ChangeServerLifeCycleStateSourceServerLifecycle
sourceServerID :: Text
lifeCycle :: ChangeServerLifeCycleStateSourceServerLifecycle
$sel:sourceServerID:ChangeServerLifeCycleState' :: ChangeServerLifeCycleState -> Text
$sel:lifeCycle:ChangeServerLifeCycleState' :: ChangeServerLifeCycleState
-> ChangeServerLifeCycleStateSourceServerLifecycle
..} =
[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
"lifeCycle" Text -> ChangeServerLifeCycleStateSourceServerLifecycle -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ChangeServerLifeCycleStateSourceServerLifecycle
lifeCycle),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"sourceServerID" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
sourceServerID)
]
)
instance Core.ToPath ChangeServerLifeCycleState where
toPath :: ChangeServerLifeCycleState -> ByteString
toPath = ByteString -> ChangeServerLifeCycleState -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/ChangeServerLifeCycleState"
instance Core.ToQuery ChangeServerLifeCycleState where
toQuery :: ChangeServerLifeCycleState -> QueryString
toQuery = QueryString -> ChangeServerLifeCycleState -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty