{-# 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.GetAutoTerminationPolicy
(
GetAutoTerminationPolicy (..),
newGetAutoTerminationPolicy,
getAutoTerminationPolicy_clusterId,
GetAutoTerminationPolicyResponse (..),
newGetAutoTerminationPolicyResponse,
getAutoTerminationPolicyResponse_autoTerminationPolicy,
getAutoTerminationPolicyResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EMR.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetAutoTerminationPolicy = GetAutoTerminationPolicy'
{
GetAutoTerminationPolicy -> Text
clusterId :: Prelude.Text
}
deriving (GetAutoTerminationPolicy -> GetAutoTerminationPolicy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAutoTerminationPolicy -> GetAutoTerminationPolicy -> Bool
$c/= :: GetAutoTerminationPolicy -> GetAutoTerminationPolicy -> Bool
== :: GetAutoTerminationPolicy -> GetAutoTerminationPolicy -> Bool
$c== :: GetAutoTerminationPolicy -> GetAutoTerminationPolicy -> Bool
Prelude.Eq, ReadPrec [GetAutoTerminationPolicy]
ReadPrec GetAutoTerminationPolicy
Int -> ReadS GetAutoTerminationPolicy
ReadS [GetAutoTerminationPolicy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAutoTerminationPolicy]
$creadListPrec :: ReadPrec [GetAutoTerminationPolicy]
readPrec :: ReadPrec GetAutoTerminationPolicy
$creadPrec :: ReadPrec GetAutoTerminationPolicy
readList :: ReadS [GetAutoTerminationPolicy]
$creadList :: ReadS [GetAutoTerminationPolicy]
readsPrec :: Int -> ReadS GetAutoTerminationPolicy
$creadsPrec :: Int -> ReadS GetAutoTerminationPolicy
Prelude.Read, Int -> GetAutoTerminationPolicy -> ShowS
[GetAutoTerminationPolicy] -> ShowS
GetAutoTerminationPolicy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAutoTerminationPolicy] -> ShowS
$cshowList :: [GetAutoTerminationPolicy] -> ShowS
show :: GetAutoTerminationPolicy -> String
$cshow :: GetAutoTerminationPolicy -> String
showsPrec :: Int -> GetAutoTerminationPolicy -> ShowS
$cshowsPrec :: Int -> GetAutoTerminationPolicy -> ShowS
Prelude.Show, forall x.
Rep GetAutoTerminationPolicy x -> GetAutoTerminationPolicy
forall x.
GetAutoTerminationPolicy -> Rep GetAutoTerminationPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetAutoTerminationPolicy x -> GetAutoTerminationPolicy
$cfrom :: forall x.
GetAutoTerminationPolicy -> Rep GetAutoTerminationPolicy x
Prelude.Generic)
newGetAutoTerminationPolicy ::
Prelude.Text ->
GetAutoTerminationPolicy
newGetAutoTerminationPolicy :: Text -> GetAutoTerminationPolicy
newGetAutoTerminationPolicy Text
pClusterId_ =
GetAutoTerminationPolicy' {$sel:clusterId:GetAutoTerminationPolicy' :: Text
clusterId = Text
pClusterId_}
getAutoTerminationPolicy_clusterId :: Lens.Lens' GetAutoTerminationPolicy Prelude.Text
getAutoTerminationPolicy_clusterId :: Lens' GetAutoTerminationPolicy Text
getAutoTerminationPolicy_clusterId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAutoTerminationPolicy' {Text
clusterId :: Text
$sel:clusterId:GetAutoTerminationPolicy' :: GetAutoTerminationPolicy -> Text
clusterId} -> Text
clusterId) (\s :: GetAutoTerminationPolicy
s@GetAutoTerminationPolicy' {} Text
a -> GetAutoTerminationPolicy
s {$sel:clusterId:GetAutoTerminationPolicy' :: Text
clusterId = Text
a} :: GetAutoTerminationPolicy)
instance Core.AWSRequest GetAutoTerminationPolicy where
type
AWSResponse GetAutoTerminationPolicy =
GetAutoTerminationPolicyResponse
request :: (Service -> Service)
-> GetAutoTerminationPolicy -> Request GetAutoTerminationPolicy
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 GetAutoTerminationPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetAutoTerminationPolicy)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe AutoTerminationPolicy
-> Int -> GetAutoTerminationPolicyResponse
GetAutoTerminationPolicyResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"AutoTerminationPolicy")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetAutoTerminationPolicy where
hashWithSalt :: Int -> GetAutoTerminationPolicy -> Int
hashWithSalt Int
_salt GetAutoTerminationPolicy' {Text
clusterId :: Text
$sel:clusterId:GetAutoTerminationPolicy' :: GetAutoTerminationPolicy -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
clusterId
instance Prelude.NFData GetAutoTerminationPolicy where
rnf :: GetAutoTerminationPolicy -> ()
rnf GetAutoTerminationPolicy' {Text
clusterId :: Text
$sel:clusterId:GetAutoTerminationPolicy' :: GetAutoTerminationPolicy -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
clusterId
instance Data.ToHeaders GetAutoTerminationPolicy where
toHeaders :: GetAutoTerminationPolicy -> ResponseHeaders
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 -> ResponseHeaders
Data.=# ( ByteString
"ElasticMapReduce.GetAutoTerminationPolicy" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON GetAutoTerminationPolicy where
toJSON :: GetAutoTerminationPolicy -> Value
toJSON GetAutoTerminationPolicy' {Text
clusterId :: Text
$sel:clusterId:GetAutoTerminationPolicy' :: GetAutoTerminationPolicy -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"ClusterId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
clusterId)]
)
instance Data.ToPath GetAutoTerminationPolicy where
toPath :: GetAutoTerminationPolicy -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetAutoTerminationPolicy where
toQuery :: GetAutoTerminationPolicy -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetAutoTerminationPolicyResponse = GetAutoTerminationPolicyResponse'
{
GetAutoTerminationPolicyResponse -> Maybe AutoTerminationPolicy
autoTerminationPolicy :: Prelude.Maybe AutoTerminationPolicy,
GetAutoTerminationPolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetAutoTerminationPolicyResponse
-> GetAutoTerminationPolicyResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAutoTerminationPolicyResponse
-> GetAutoTerminationPolicyResponse -> Bool
$c/= :: GetAutoTerminationPolicyResponse
-> GetAutoTerminationPolicyResponse -> Bool
== :: GetAutoTerminationPolicyResponse
-> GetAutoTerminationPolicyResponse -> Bool
$c== :: GetAutoTerminationPolicyResponse
-> GetAutoTerminationPolicyResponse -> Bool
Prelude.Eq, ReadPrec [GetAutoTerminationPolicyResponse]
ReadPrec GetAutoTerminationPolicyResponse
Int -> ReadS GetAutoTerminationPolicyResponse
ReadS [GetAutoTerminationPolicyResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAutoTerminationPolicyResponse]
$creadListPrec :: ReadPrec [GetAutoTerminationPolicyResponse]
readPrec :: ReadPrec GetAutoTerminationPolicyResponse
$creadPrec :: ReadPrec GetAutoTerminationPolicyResponse
readList :: ReadS [GetAutoTerminationPolicyResponse]
$creadList :: ReadS [GetAutoTerminationPolicyResponse]
readsPrec :: Int -> ReadS GetAutoTerminationPolicyResponse
$creadsPrec :: Int -> ReadS GetAutoTerminationPolicyResponse
Prelude.Read, Int -> GetAutoTerminationPolicyResponse -> ShowS
[GetAutoTerminationPolicyResponse] -> ShowS
GetAutoTerminationPolicyResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAutoTerminationPolicyResponse] -> ShowS
$cshowList :: [GetAutoTerminationPolicyResponse] -> ShowS
show :: GetAutoTerminationPolicyResponse -> String
$cshow :: GetAutoTerminationPolicyResponse -> String
showsPrec :: Int -> GetAutoTerminationPolicyResponse -> ShowS
$cshowsPrec :: Int -> GetAutoTerminationPolicyResponse -> ShowS
Prelude.Show, forall x.
Rep GetAutoTerminationPolicyResponse x
-> GetAutoTerminationPolicyResponse
forall x.
GetAutoTerminationPolicyResponse
-> Rep GetAutoTerminationPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetAutoTerminationPolicyResponse x
-> GetAutoTerminationPolicyResponse
$cfrom :: forall x.
GetAutoTerminationPolicyResponse
-> Rep GetAutoTerminationPolicyResponse x
Prelude.Generic)
newGetAutoTerminationPolicyResponse ::
Prelude.Int ->
GetAutoTerminationPolicyResponse
newGetAutoTerminationPolicyResponse :: Int -> GetAutoTerminationPolicyResponse
newGetAutoTerminationPolicyResponse Int
pHttpStatus_ =
GetAutoTerminationPolicyResponse'
{ $sel:autoTerminationPolicy:GetAutoTerminationPolicyResponse' :: Maybe AutoTerminationPolicy
autoTerminationPolicy =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetAutoTerminationPolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getAutoTerminationPolicyResponse_autoTerminationPolicy :: Lens.Lens' GetAutoTerminationPolicyResponse (Prelude.Maybe AutoTerminationPolicy)
getAutoTerminationPolicyResponse_autoTerminationPolicy :: Lens'
GetAutoTerminationPolicyResponse (Maybe AutoTerminationPolicy)
getAutoTerminationPolicyResponse_autoTerminationPolicy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAutoTerminationPolicyResponse' {Maybe AutoTerminationPolicy
autoTerminationPolicy :: Maybe AutoTerminationPolicy
$sel:autoTerminationPolicy:GetAutoTerminationPolicyResponse' :: GetAutoTerminationPolicyResponse -> Maybe AutoTerminationPolicy
autoTerminationPolicy} -> Maybe AutoTerminationPolicy
autoTerminationPolicy) (\s :: GetAutoTerminationPolicyResponse
s@GetAutoTerminationPolicyResponse' {} Maybe AutoTerminationPolicy
a -> GetAutoTerminationPolicyResponse
s {$sel:autoTerminationPolicy:GetAutoTerminationPolicyResponse' :: Maybe AutoTerminationPolicy
autoTerminationPolicy = Maybe AutoTerminationPolicy
a} :: GetAutoTerminationPolicyResponse)
getAutoTerminationPolicyResponse_httpStatus :: Lens.Lens' GetAutoTerminationPolicyResponse Prelude.Int
getAutoTerminationPolicyResponse_httpStatus :: Lens' GetAutoTerminationPolicyResponse Int
getAutoTerminationPolicyResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAutoTerminationPolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetAutoTerminationPolicyResponse' :: GetAutoTerminationPolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetAutoTerminationPolicyResponse
s@GetAutoTerminationPolicyResponse' {} Int
a -> GetAutoTerminationPolicyResponse
s {$sel:httpStatus:GetAutoTerminationPolicyResponse' :: Int
httpStatus = Int
a} :: GetAutoTerminationPolicyResponse)
instance
Prelude.NFData
GetAutoTerminationPolicyResponse
where
rnf :: GetAutoTerminationPolicyResponse -> ()
rnf GetAutoTerminationPolicyResponse' {Int
Maybe AutoTerminationPolicy
httpStatus :: Int
autoTerminationPolicy :: Maybe AutoTerminationPolicy
$sel:httpStatus:GetAutoTerminationPolicyResponse' :: GetAutoTerminationPolicyResponse -> Int
$sel:autoTerminationPolicy:GetAutoTerminationPolicyResponse' :: GetAutoTerminationPolicyResponse -> Maybe AutoTerminationPolicy
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe AutoTerminationPolicy
autoTerminationPolicy
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus