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