{-# 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.OpsWorks.StopInstance
(
StopInstance (..),
newStopInstance,
stopInstance_force,
stopInstance_instanceId,
StopInstanceResponse (..),
newStopInstanceResponse,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.OpsWorks.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data StopInstance = StopInstance'
{
StopInstance -> Maybe Bool
force :: Prelude.Maybe Prelude.Bool,
StopInstance -> Text
instanceId :: Prelude.Text
}
deriving (StopInstance -> StopInstance -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopInstance -> StopInstance -> Bool
$c/= :: StopInstance -> StopInstance -> Bool
== :: StopInstance -> StopInstance -> Bool
$c== :: StopInstance -> StopInstance -> Bool
Prelude.Eq, ReadPrec [StopInstance]
ReadPrec StopInstance
Int -> ReadS StopInstance
ReadS [StopInstance]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopInstance]
$creadListPrec :: ReadPrec [StopInstance]
readPrec :: ReadPrec StopInstance
$creadPrec :: ReadPrec StopInstance
readList :: ReadS [StopInstance]
$creadList :: ReadS [StopInstance]
readsPrec :: Int -> ReadS StopInstance
$creadsPrec :: Int -> ReadS StopInstance
Prelude.Read, Int -> StopInstance -> ShowS
[StopInstance] -> ShowS
StopInstance -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopInstance] -> ShowS
$cshowList :: [StopInstance] -> ShowS
show :: StopInstance -> String
$cshow :: StopInstance -> String
showsPrec :: Int -> StopInstance -> ShowS
$cshowsPrec :: Int -> StopInstance -> ShowS
Prelude.Show, forall x. Rep StopInstance x -> StopInstance
forall x. StopInstance -> Rep StopInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopInstance x -> StopInstance
$cfrom :: forall x. StopInstance -> Rep StopInstance x
Prelude.Generic)
newStopInstance ::
Prelude.Text ->
StopInstance
newStopInstance :: Text -> StopInstance
newStopInstance Text
pInstanceId_ =
StopInstance'
{ $sel:force:StopInstance' :: Maybe Bool
force = forall a. Maybe a
Prelude.Nothing,
$sel:instanceId:StopInstance' :: Text
instanceId = Text
pInstanceId_
}
stopInstance_force :: Lens.Lens' StopInstance (Prelude.Maybe Prelude.Bool)
stopInstance_force :: Lens' StopInstance (Maybe Bool)
stopInstance_force = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopInstance' {Maybe Bool
force :: Maybe Bool
$sel:force:StopInstance' :: StopInstance -> Maybe Bool
force} -> Maybe Bool
force) (\s :: StopInstance
s@StopInstance' {} Maybe Bool
a -> StopInstance
s {$sel:force:StopInstance' :: Maybe Bool
force = Maybe Bool
a} :: StopInstance)
stopInstance_instanceId :: Lens.Lens' StopInstance Prelude.Text
stopInstance_instanceId :: Lens' StopInstance Text
stopInstance_instanceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopInstance' {Text
instanceId :: Text
$sel:instanceId:StopInstance' :: StopInstance -> Text
instanceId} -> Text
instanceId) (\s :: StopInstance
s@StopInstance' {} Text
a -> StopInstance
s {$sel:instanceId:StopInstance' :: Text
instanceId = Text
a} :: StopInstance)
instance Core.AWSRequest StopInstance where
type AWSResponse StopInstance = StopInstanceResponse
request :: (Service -> Service) -> StopInstance -> Request StopInstance
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy StopInstance
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StopInstance)))
response = forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull StopInstanceResponse
StopInstanceResponse'
instance Prelude.Hashable StopInstance where
hashWithSalt :: Int -> StopInstance -> Int
hashWithSalt Int
_salt StopInstance' {Maybe Bool
Text
instanceId :: Text
force :: Maybe Bool
$sel:instanceId:StopInstance' :: StopInstance -> Text
$sel:force:StopInstance' :: StopInstance -> Maybe Bool
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
force
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
instanceId
instance Prelude.NFData StopInstance where
rnf :: StopInstance -> ()
rnf StopInstance' {Maybe Bool
Text
instanceId :: Text
force :: Maybe Bool
$sel:instanceId:StopInstance' :: StopInstance -> Text
$sel:force:StopInstance' :: StopInstance -> Maybe Bool
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
force
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
instanceId
instance Data.ToHeaders StopInstance where
toHeaders :: StopInstance -> [Header]
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"OpsWorks_20130218.StopInstance" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON StopInstance where
toJSON :: StopInstance -> Value
toJSON StopInstance' {Maybe Bool
Text
instanceId :: Text
force :: Maybe Bool
$sel:instanceId:StopInstance' :: StopInstance -> Text
$sel:force:StopInstance' :: StopInstance -> Maybe Bool
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Force" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
force,
forall a. a -> Maybe a
Prelude.Just (Key
"InstanceId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
instanceId)
]
)
instance Data.ToPath StopInstance where
toPath :: StopInstance -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery StopInstance where
toQuery :: StopInstance -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data StopInstanceResponse = StopInstanceResponse'
{
}
deriving (StopInstanceResponse -> StopInstanceResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopInstanceResponse -> StopInstanceResponse -> Bool
$c/= :: StopInstanceResponse -> StopInstanceResponse -> Bool
== :: StopInstanceResponse -> StopInstanceResponse -> Bool
$c== :: StopInstanceResponse -> StopInstanceResponse -> Bool
Prelude.Eq, ReadPrec [StopInstanceResponse]
ReadPrec StopInstanceResponse
Int -> ReadS StopInstanceResponse
ReadS [StopInstanceResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopInstanceResponse]
$creadListPrec :: ReadPrec [StopInstanceResponse]
readPrec :: ReadPrec StopInstanceResponse
$creadPrec :: ReadPrec StopInstanceResponse
readList :: ReadS [StopInstanceResponse]
$creadList :: ReadS [StopInstanceResponse]
readsPrec :: Int -> ReadS StopInstanceResponse
$creadsPrec :: Int -> ReadS StopInstanceResponse
Prelude.Read, Int -> StopInstanceResponse -> ShowS
[StopInstanceResponse] -> ShowS
StopInstanceResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopInstanceResponse] -> ShowS
$cshowList :: [StopInstanceResponse] -> ShowS
show :: StopInstanceResponse -> String
$cshow :: StopInstanceResponse -> String
showsPrec :: Int -> StopInstanceResponse -> ShowS
$cshowsPrec :: Int -> StopInstanceResponse -> ShowS
Prelude.Show, forall x. Rep StopInstanceResponse x -> StopInstanceResponse
forall x. StopInstanceResponse -> Rep StopInstanceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopInstanceResponse x -> StopInstanceResponse
$cfrom :: forall x. StopInstanceResponse -> Rep StopInstanceResponse x
Prelude.Generic)
newStopInstanceResponse ::
StopInstanceResponse
newStopInstanceResponse :: StopInstanceResponse
newStopInstanceResponse = StopInstanceResponse
StopInstanceResponse'
instance Prelude.NFData StopInstanceResponse where
rnf :: StopInstanceResponse -> ()
rnf StopInstanceResponse
_ = ()