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