{-# 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.EMR.SetTerminationProtection
(
SetTerminationProtection (..),
newSetTerminationProtection,
setTerminationProtection_jobFlowIds,
setTerminationProtection_terminationProtected,
SetTerminationProtectionResponse (..),
newSetTerminationProtectionResponse,
)
where
import qualified Amazonka.Core as Core
import Amazonka.EMR.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data SetTerminationProtection = SetTerminationProtection'
{
SetTerminationProtection -> [Text]
jobFlowIds :: [Prelude.Text],
SetTerminationProtection -> Bool
terminationProtected :: Prelude.Bool
}
deriving (SetTerminationProtection -> SetTerminationProtection -> Bool
(SetTerminationProtection -> SetTerminationProtection -> Bool)
-> (SetTerminationProtection -> SetTerminationProtection -> Bool)
-> Eq SetTerminationProtection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetTerminationProtection -> SetTerminationProtection -> Bool
$c/= :: SetTerminationProtection -> SetTerminationProtection -> Bool
== :: SetTerminationProtection -> SetTerminationProtection -> Bool
$c== :: SetTerminationProtection -> SetTerminationProtection -> Bool
Prelude.Eq, ReadPrec [SetTerminationProtection]
ReadPrec SetTerminationProtection
Int -> ReadS SetTerminationProtection
ReadS [SetTerminationProtection]
(Int -> ReadS SetTerminationProtection)
-> ReadS [SetTerminationProtection]
-> ReadPrec SetTerminationProtection
-> ReadPrec [SetTerminationProtection]
-> Read SetTerminationProtection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SetTerminationProtection]
$creadListPrec :: ReadPrec [SetTerminationProtection]
readPrec :: ReadPrec SetTerminationProtection
$creadPrec :: ReadPrec SetTerminationProtection
readList :: ReadS [SetTerminationProtection]
$creadList :: ReadS [SetTerminationProtection]
readsPrec :: Int -> ReadS SetTerminationProtection
$creadsPrec :: Int -> ReadS SetTerminationProtection
Prelude.Read, Int -> SetTerminationProtection -> ShowS
[SetTerminationProtection] -> ShowS
SetTerminationProtection -> String
(Int -> SetTerminationProtection -> ShowS)
-> (SetTerminationProtection -> String)
-> ([SetTerminationProtection] -> ShowS)
-> Show SetTerminationProtection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetTerminationProtection] -> ShowS
$cshowList :: [SetTerminationProtection] -> ShowS
show :: SetTerminationProtection -> String
$cshow :: SetTerminationProtection -> String
showsPrec :: Int -> SetTerminationProtection -> ShowS
$cshowsPrec :: Int -> SetTerminationProtection -> ShowS
Prelude.Show, (forall x.
SetTerminationProtection -> Rep SetTerminationProtection x)
-> (forall x.
Rep SetTerminationProtection x -> SetTerminationProtection)
-> Generic SetTerminationProtection
forall x.
Rep SetTerminationProtection x -> SetTerminationProtection
forall x.
SetTerminationProtection -> Rep SetTerminationProtection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SetTerminationProtection x -> SetTerminationProtection
$cfrom :: forall x.
SetTerminationProtection -> Rep SetTerminationProtection x
Prelude.Generic)
newSetTerminationProtection ::
Prelude.Bool ->
SetTerminationProtection
newSetTerminationProtection :: Bool -> SetTerminationProtection
newSetTerminationProtection Bool
pTerminationProtected_ =
SetTerminationProtection' :: [Text] -> Bool -> SetTerminationProtection
SetTerminationProtection'
{ $sel:jobFlowIds:SetTerminationProtection' :: [Text]
jobFlowIds =
[Text]
forall a. Monoid a => a
Prelude.mempty,
$sel:terminationProtected:SetTerminationProtection' :: Bool
terminationProtected = Bool
pTerminationProtected_
}
setTerminationProtection_jobFlowIds :: Lens.Lens' SetTerminationProtection [Prelude.Text]
setTerminationProtection_jobFlowIds :: ([Text] -> f [Text])
-> SetTerminationProtection -> f SetTerminationProtection
setTerminationProtection_jobFlowIds = (SetTerminationProtection -> [Text])
-> (SetTerminationProtection -> [Text] -> SetTerminationProtection)
-> Lens
SetTerminationProtection SetTerminationProtection [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetTerminationProtection' {[Text]
jobFlowIds :: [Text]
$sel:jobFlowIds:SetTerminationProtection' :: SetTerminationProtection -> [Text]
jobFlowIds} -> [Text]
jobFlowIds) (\s :: SetTerminationProtection
s@SetTerminationProtection' {} [Text]
a -> SetTerminationProtection
s {$sel:jobFlowIds:SetTerminationProtection' :: [Text]
jobFlowIds = [Text]
a} :: SetTerminationProtection) (([Text] -> f [Text])
-> SetTerminationProtection -> f SetTerminationProtection)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> SetTerminationProtection
-> f SetTerminationProtection
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
setTerminationProtection_terminationProtected :: Lens.Lens' SetTerminationProtection Prelude.Bool
setTerminationProtection_terminationProtected :: (Bool -> f Bool)
-> SetTerminationProtection -> f SetTerminationProtection
setTerminationProtection_terminationProtected = (SetTerminationProtection -> Bool)
-> (SetTerminationProtection -> Bool -> SetTerminationProtection)
-> Lens SetTerminationProtection SetTerminationProtection Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetTerminationProtection' {Bool
terminationProtected :: Bool
$sel:terminationProtected:SetTerminationProtection' :: SetTerminationProtection -> Bool
terminationProtected} -> Bool
terminationProtected) (\s :: SetTerminationProtection
s@SetTerminationProtection' {} Bool
a -> SetTerminationProtection
s {$sel:terminationProtected:SetTerminationProtection' :: Bool
terminationProtected = Bool
a} :: SetTerminationProtection)
instance Core.AWSRequest SetTerminationProtection where
type
AWSResponse SetTerminationProtection =
SetTerminationProtectionResponse
request :: SetTerminationProtection -> Request SetTerminationProtection
request = Service
-> SetTerminationProtection -> Request SetTerminationProtection
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy SetTerminationProtection
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse SetTerminationProtection)))
response =
AWSResponse SetTerminationProtection
-> Logger
-> Service
-> Proxy SetTerminationProtection
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse SetTerminationProtection)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
AWSResponse SetTerminationProtection
SetTerminationProtectionResponse
SetTerminationProtectionResponse'
instance Prelude.Hashable SetTerminationProtection
instance Prelude.NFData SetTerminationProtection
instance Core.ToHeaders SetTerminationProtection where
toHeaders :: SetTerminationProtection -> [Header]
toHeaders =
[Header] -> SetTerminationProtection -> [Header]
forall a b. a -> b -> a
Prelude.const
( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"ElasticMapReduce.SetTerminationProtection" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON SetTerminationProtection where
toJSON :: SetTerminationProtection -> Value
toJSON SetTerminationProtection' {Bool
[Text]
terminationProtected :: Bool
jobFlowIds :: [Text]
$sel:terminationProtected:SetTerminationProtection' :: SetTerminationProtection -> Bool
$sel:jobFlowIds:SetTerminationProtection' :: SetTerminationProtection -> [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
"JobFlowIds" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
jobFlowIds),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"TerminationProtected"
Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Bool
terminationProtected
)
]
)
instance Core.ToPath SetTerminationProtection where
toPath :: SetTerminationProtection -> ByteString
toPath = ByteString -> SetTerminationProtection -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery SetTerminationProtection where
toQuery :: SetTerminationProtection -> QueryString
toQuery = QueryString -> SetTerminationProtection -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data SetTerminationProtectionResponse = SetTerminationProtectionResponse'
{
}
deriving (SetTerminationProtectionResponse
-> SetTerminationProtectionResponse -> Bool
(SetTerminationProtectionResponse
-> SetTerminationProtectionResponse -> Bool)
-> (SetTerminationProtectionResponse
-> SetTerminationProtectionResponse -> Bool)
-> Eq SetTerminationProtectionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetTerminationProtectionResponse
-> SetTerminationProtectionResponse -> Bool
$c/= :: SetTerminationProtectionResponse
-> SetTerminationProtectionResponse -> Bool
== :: SetTerminationProtectionResponse
-> SetTerminationProtectionResponse -> Bool
$c== :: SetTerminationProtectionResponse
-> SetTerminationProtectionResponse -> Bool
Prelude.Eq, ReadPrec [SetTerminationProtectionResponse]
ReadPrec SetTerminationProtectionResponse
Int -> ReadS SetTerminationProtectionResponse
ReadS [SetTerminationProtectionResponse]
(Int -> ReadS SetTerminationProtectionResponse)
-> ReadS [SetTerminationProtectionResponse]
-> ReadPrec SetTerminationProtectionResponse
-> ReadPrec [SetTerminationProtectionResponse]
-> Read SetTerminationProtectionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SetTerminationProtectionResponse]
$creadListPrec :: ReadPrec [SetTerminationProtectionResponse]
readPrec :: ReadPrec SetTerminationProtectionResponse
$creadPrec :: ReadPrec SetTerminationProtectionResponse
readList :: ReadS [SetTerminationProtectionResponse]
$creadList :: ReadS [SetTerminationProtectionResponse]
readsPrec :: Int -> ReadS SetTerminationProtectionResponse
$creadsPrec :: Int -> ReadS SetTerminationProtectionResponse
Prelude.Read, Int -> SetTerminationProtectionResponse -> ShowS
[SetTerminationProtectionResponse] -> ShowS
SetTerminationProtectionResponse -> String
(Int -> SetTerminationProtectionResponse -> ShowS)
-> (SetTerminationProtectionResponse -> String)
-> ([SetTerminationProtectionResponse] -> ShowS)
-> Show SetTerminationProtectionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetTerminationProtectionResponse] -> ShowS
$cshowList :: [SetTerminationProtectionResponse] -> ShowS
show :: SetTerminationProtectionResponse -> String
$cshow :: SetTerminationProtectionResponse -> String
showsPrec :: Int -> SetTerminationProtectionResponse -> ShowS
$cshowsPrec :: Int -> SetTerminationProtectionResponse -> ShowS
Prelude.Show, (forall x.
SetTerminationProtectionResponse
-> Rep SetTerminationProtectionResponse x)
-> (forall x.
Rep SetTerminationProtectionResponse x
-> SetTerminationProtectionResponse)
-> Generic SetTerminationProtectionResponse
forall x.
Rep SetTerminationProtectionResponse x
-> SetTerminationProtectionResponse
forall x.
SetTerminationProtectionResponse
-> Rep SetTerminationProtectionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SetTerminationProtectionResponse x
-> SetTerminationProtectionResponse
$cfrom :: forall x.
SetTerminationProtectionResponse
-> Rep SetTerminationProtectionResponse x
Prelude.Generic)
newSetTerminationProtectionResponse ::
SetTerminationProtectionResponse
newSetTerminationProtectionResponse :: SetTerminationProtectionResponse
newSetTerminationProtectionResponse =
SetTerminationProtectionResponse
SetTerminationProtectionResponse'
instance
Prelude.NFData
SetTerminationProtectionResponse