{-# 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.PutAutoTerminationPolicy
(
PutAutoTerminationPolicy (..),
newPutAutoTerminationPolicy,
putAutoTerminationPolicy_autoTerminationPolicy,
putAutoTerminationPolicy_clusterId,
PutAutoTerminationPolicyResponse (..),
newPutAutoTerminationPolicyResponse,
putAutoTerminationPolicyResponse_httpStatus,
)
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 PutAutoTerminationPolicy = PutAutoTerminationPolicy'
{
PutAutoTerminationPolicy -> Maybe AutoTerminationPolicy
autoTerminationPolicy :: Prelude.Maybe AutoTerminationPolicy,
PutAutoTerminationPolicy -> Text
clusterId :: Prelude.Text
}
deriving (PutAutoTerminationPolicy -> PutAutoTerminationPolicy -> Bool
(PutAutoTerminationPolicy -> PutAutoTerminationPolicy -> Bool)
-> (PutAutoTerminationPolicy -> PutAutoTerminationPolicy -> Bool)
-> Eq PutAutoTerminationPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutAutoTerminationPolicy -> PutAutoTerminationPolicy -> Bool
$c/= :: PutAutoTerminationPolicy -> PutAutoTerminationPolicy -> Bool
== :: PutAutoTerminationPolicy -> PutAutoTerminationPolicy -> Bool
$c== :: PutAutoTerminationPolicy -> PutAutoTerminationPolicy -> Bool
Prelude.Eq, ReadPrec [PutAutoTerminationPolicy]
ReadPrec PutAutoTerminationPolicy
Int -> ReadS PutAutoTerminationPolicy
ReadS [PutAutoTerminationPolicy]
(Int -> ReadS PutAutoTerminationPolicy)
-> ReadS [PutAutoTerminationPolicy]
-> ReadPrec PutAutoTerminationPolicy
-> ReadPrec [PutAutoTerminationPolicy]
-> Read PutAutoTerminationPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutAutoTerminationPolicy]
$creadListPrec :: ReadPrec [PutAutoTerminationPolicy]
readPrec :: ReadPrec PutAutoTerminationPolicy
$creadPrec :: ReadPrec PutAutoTerminationPolicy
readList :: ReadS [PutAutoTerminationPolicy]
$creadList :: ReadS [PutAutoTerminationPolicy]
readsPrec :: Int -> ReadS PutAutoTerminationPolicy
$creadsPrec :: Int -> ReadS PutAutoTerminationPolicy
Prelude.Read, Int -> PutAutoTerminationPolicy -> ShowS
[PutAutoTerminationPolicy] -> ShowS
PutAutoTerminationPolicy -> String
(Int -> PutAutoTerminationPolicy -> ShowS)
-> (PutAutoTerminationPolicy -> String)
-> ([PutAutoTerminationPolicy] -> ShowS)
-> Show PutAutoTerminationPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutAutoTerminationPolicy] -> ShowS
$cshowList :: [PutAutoTerminationPolicy] -> ShowS
show :: PutAutoTerminationPolicy -> String
$cshow :: PutAutoTerminationPolicy -> String
showsPrec :: Int -> PutAutoTerminationPolicy -> ShowS
$cshowsPrec :: Int -> PutAutoTerminationPolicy -> ShowS
Prelude.Show, (forall x.
PutAutoTerminationPolicy -> Rep PutAutoTerminationPolicy x)
-> (forall x.
Rep PutAutoTerminationPolicy x -> PutAutoTerminationPolicy)
-> Generic PutAutoTerminationPolicy
forall x.
Rep PutAutoTerminationPolicy x -> PutAutoTerminationPolicy
forall x.
PutAutoTerminationPolicy -> Rep PutAutoTerminationPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutAutoTerminationPolicy x -> PutAutoTerminationPolicy
$cfrom :: forall x.
PutAutoTerminationPolicy -> Rep PutAutoTerminationPolicy x
Prelude.Generic)
newPutAutoTerminationPolicy ::
Prelude.Text ->
PutAutoTerminationPolicy
newPutAutoTerminationPolicy :: Text -> PutAutoTerminationPolicy
newPutAutoTerminationPolicy Text
pClusterId_ =
PutAutoTerminationPolicy' :: Maybe AutoTerminationPolicy -> Text -> PutAutoTerminationPolicy
PutAutoTerminationPolicy'
{ $sel:autoTerminationPolicy:PutAutoTerminationPolicy' :: Maybe AutoTerminationPolicy
autoTerminationPolicy =
Maybe AutoTerminationPolicy
forall a. Maybe a
Prelude.Nothing,
$sel:clusterId:PutAutoTerminationPolicy' :: Text
clusterId = Text
pClusterId_
}
putAutoTerminationPolicy_autoTerminationPolicy :: Lens.Lens' PutAutoTerminationPolicy (Prelude.Maybe AutoTerminationPolicy)
putAutoTerminationPolicy_autoTerminationPolicy :: (Maybe AutoTerminationPolicy -> f (Maybe AutoTerminationPolicy))
-> PutAutoTerminationPolicy -> f PutAutoTerminationPolicy
putAutoTerminationPolicy_autoTerminationPolicy = (PutAutoTerminationPolicy -> Maybe AutoTerminationPolicy)
-> (PutAutoTerminationPolicy
-> Maybe AutoTerminationPolicy -> PutAutoTerminationPolicy)
-> Lens
PutAutoTerminationPolicy
PutAutoTerminationPolicy
(Maybe AutoTerminationPolicy)
(Maybe AutoTerminationPolicy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAutoTerminationPolicy' {Maybe AutoTerminationPolicy
autoTerminationPolicy :: Maybe AutoTerminationPolicy
$sel:autoTerminationPolicy:PutAutoTerminationPolicy' :: PutAutoTerminationPolicy -> Maybe AutoTerminationPolicy
autoTerminationPolicy} -> Maybe AutoTerminationPolicy
autoTerminationPolicy) (\s :: PutAutoTerminationPolicy
s@PutAutoTerminationPolicy' {} Maybe AutoTerminationPolicy
a -> PutAutoTerminationPolicy
s {$sel:autoTerminationPolicy:PutAutoTerminationPolicy' :: Maybe AutoTerminationPolicy
autoTerminationPolicy = Maybe AutoTerminationPolicy
a} :: PutAutoTerminationPolicy)
putAutoTerminationPolicy_clusterId :: Lens.Lens' PutAutoTerminationPolicy Prelude.Text
putAutoTerminationPolicy_clusterId :: (Text -> f Text)
-> PutAutoTerminationPolicy -> f PutAutoTerminationPolicy
putAutoTerminationPolicy_clusterId = (PutAutoTerminationPolicy -> Text)
-> (PutAutoTerminationPolicy -> Text -> PutAutoTerminationPolicy)
-> Lens PutAutoTerminationPolicy PutAutoTerminationPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAutoTerminationPolicy' {Text
clusterId :: Text
$sel:clusterId:PutAutoTerminationPolicy' :: PutAutoTerminationPolicy -> Text
clusterId} -> Text
clusterId) (\s :: PutAutoTerminationPolicy
s@PutAutoTerminationPolicy' {} Text
a -> PutAutoTerminationPolicy
s {$sel:clusterId:PutAutoTerminationPolicy' :: Text
clusterId = Text
a} :: PutAutoTerminationPolicy)
instance Core.AWSRequest PutAutoTerminationPolicy where
type
AWSResponse PutAutoTerminationPolicy =
PutAutoTerminationPolicyResponse
request :: PutAutoTerminationPolicy -> Request PutAutoTerminationPolicy
request = Service
-> PutAutoTerminationPolicy -> Request PutAutoTerminationPolicy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutAutoTerminationPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutAutoTerminationPolicy)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse PutAutoTerminationPolicy))
-> Logger
-> Service
-> Proxy PutAutoTerminationPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutAutoTerminationPolicy)))
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 -> PutAutoTerminationPolicyResponse
PutAutoTerminationPolicyResponse'
(Int -> PutAutoTerminationPolicyResponse)
-> Either String Int
-> Either String PutAutoTerminationPolicyResponse
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 PutAutoTerminationPolicy
instance Prelude.NFData PutAutoTerminationPolicy
instance Core.ToHeaders PutAutoTerminationPolicy where
toHeaders :: PutAutoTerminationPolicy -> ResponseHeaders
toHeaders =
ResponseHeaders -> PutAutoTerminationPolicy -> 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
"ElasticMapReduce.PutAutoTerminationPolicy" ::
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 PutAutoTerminationPolicy where
toJSON :: PutAutoTerminationPolicy -> Value
toJSON PutAutoTerminationPolicy' {Maybe AutoTerminationPolicy
Text
clusterId :: Text
autoTerminationPolicy :: Maybe AutoTerminationPolicy
$sel:clusterId:PutAutoTerminationPolicy' :: PutAutoTerminationPolicy -> Text
$sel:autoTerminationPolicy:PutAutoTerminationPolicy' :: PutAutoTerminationPolicy -> Maybe AutoTerminationPolicy
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"AutoTerminationPolicy" Text -> AutoTerminationPolicy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(AutoTerminationPolicy -> Pair)
-> Maybe AutoTerminationPolicy -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AutoTerminationPolicy
autoTerminationPolicy,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ClusterId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clusterId)
]
)
instance Core.ToPath PutAutoTerminationPolicy where
toPath :: PutAutoTerminationPolicy -> ByteString
toPath = ByteString -> PutAutoTerminationPolicy -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PutAutoTerminationPolicy where
toQuery :: PutAutoTerminationPolicy -> QueryString
toQuery = QueryString -> PutAutoTerminationPolicy -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutAutoTerminationPolicyResponse = PutAutoTerminationPolicyResponse'
{
PutAutoTerminationPolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutAutoTerminationPolicyResponse
-> PutAutoTerminationPolicyResponse -> Bool
(PutAutoTerminationPolicyResponse
-> PutAutoTerminationPolicyResponse -> Bool)
-> (PutAutoTerminationPolicyResponse
-> PutAutoTerminationPolicyResponse -> Bool)
-> Eq PutAutoTerminationPolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutAutoTerminationPolicyResponse
-> PutAutoTerminationPolicyResponse -> Bool
$c/= :: PutAutoTerminationPolicyResponse
-> PutAutoTerminationPolicyResponse -> Bool
== :: PutAutoTerminationPolicyResponse
-> PutAutoTerminationPolicyResponse -> Bool
$c== :: PutAutoTerminationPolicyResponse
-> PutAutoTerminationPolicyResponse -> Bool
Prelude.Eq, ReadPrec [PutAutoTerminationPolicyResponse]
ReadPrec PutAutoTerminationPolicyResponse
Int -> ReadS PutAutoTerminationPolicyResponse
ReadS [PutAutoTerminationPolicyResponse]
(Int -> ReadS PutAutoTerminationPolicyResponse)
-> ReadS [PutAutoTerminationPolicyResponse]
-> ReadPrec PutAutoTerminationPolicyResponse
-> ReadPrec [PutAutoTerminationPolicyResponse]
-> Read PutAutoTerminationPolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutAutoTerminationPolicyResponse]
$creadListPrec :: ReadPrec [PutAutoTerminationPolicyResponse]
readPrec :: ReadPrec PutAutoTerminationPolicyResponse
$creadPrec :: ReadPrec PutAutoTerminationPolicyResponse
readList :: ReadS [PutAutoTerminationPolicyResponse]
$creadList :: ReadS [PutAutoTerminationPolicyResponse]
readsPrec :: Int -> ReadS PutAutoTerminationPolicyResponse
$creadsPrec :: Int -> ReadS PutAutoTerminationPolicyResponse
Prelude.Read, Int -> PutAutoTerminationPolicyResponse -> ShowS
[PutAutoTerminationPolicyResponse] -> ShowS
PutAutoTerminationPolicyResponse -> String
(Int -> PutAutoTerminationPolicyResponse -> ShowS)
-> (PutAutoTerminationPolicyResponse -> String)
-> ([PutAutoTerminationPolicyResponse] -> ShowS)
-> Show PutAutoTerminationPolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutAutoTerminationPolicyResponse] -> ShowS
$cshowList :: [PutAutoTerminationPolicyResponse] -> ShowS
show :: PutAutoTerminationPolicyResponse -> String
$cshow :: PutAutoTerminationPolicyResponse -> String
showsPrec :: Int -> PutAutoTerminationPolicyResponse -> ShowS
$cshowsPrec :: Int -> PutAutoTerminationPolicyResponse -> ShowS
Prelude.Show, (forall x.
PutAutoTerminationPolicyResponse
-> Rep PutAutoTerminationPolicyResponse x)
-> (forall x.
Rep PutAutoTerminationPolicyResponse x
-> PutAutoTerminationPolicyResponse)
-> Generic PutAutoTerminationPolicyResponse
forall x.
Rep PutAutoTerminationPolicyResponse x
-> PutAutoTerminationPolicyResponse
forall x.
PutAutoTerminationPolicyResponse
-> Rep PutAutoTerminationPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutAutoTerminationPolicyResponse x
-> PutAutoTerminationPolicyResponse
$cfrom :: forall x.
PutAutoTerminationPolicyResponse
-> Rep PutAutoTerminationPolicyResponse x
Prelude.Generic)
newPutAutoTerminationPolicyResponse ::
Prelude.Int ->
PutAutoTerminationPolicyResponse
newPutAutoTerminationPolicyResponse :: Int -> PutAutoTerminationPolicyResponse
newPutAutoTerminationPolicyResponse Int
pHttpStatus_ =
PutAutoTerminationPolicyResponse' :: Int -> PutAutoTerminationPolicyResponse
PutAutoTerminationPolicyResponse'
{ $sel:httpStatus:PutAutoTerminationPolicyResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
putAutoTerminationPolicyResponse_httpStatus :: Lens.Lens' PutAutoTerminationPolicyResponse Prelude.Int
putAutoTerminationPolicyResponse_httpStatus :: (Int -> f Int)
-> PutAutoTerminationPolicyResponse
-> f PutAutoTerminationPolicyResponse
putAutoTerminationPolicyResponse_httpStatus = (PutAutoTerminationPolicyResponse -> Int)
-> (PutAutoTerminationPolicyResponse
-> Int -> PutAutoTerminationPolicyResponse)
-> Lens
PutAutoTerminationPolicyResponse
PutAutoTerminationPolicyResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAutoTerminationPolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutAutoTerminationPolicyResponse' :: PutAutoTerminationPolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutAutoTerminationPolicyResponse
s@PutAutoTerminationPolicyResponse' {} Int
a -> PutAutoTerminationPolicyResponse
s {$sel:httpStatus:PutAutoTerminationPolicyResponse' :: Int
httpStatus = Int
a} :: PutAutoTerminationPolicyResponse)
instance
Prelude.NFData
PutAutoTerminationPolicyResponse