{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.EMR.RemoveManagedScalingPolicy
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Removes a managed scaling policy from a specified EMR cluster.
module Amazonka.EMR.RemoveManagedScalingPolicy
  ( -- * Creating a Request
    RemoveManagedScalingPolicy (..),
    newRemoveManagedScalingPolicy,

    -- * Request Lenses
    removeManagedScalingPolicy_clusterId,

    -- * Destructuring the Response
    RemoveManagedScalingPolicyResponse (..),
    newRemoveManagedScalingPolicyResponse,

    -- * Response Lenses
    removeManagedScalingPolicyResponse_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

-- | /See:/ 'newRemoveManagedScalingPolicy' smart constructor.
data RemoveManagedScalingPolicy = RemoveManagedScalingPolicy'
  { -- | Specifies the ID of the cluster from which the managed scaling policy
    -- will be removed.
    RemoveManagedScalingPolicy -> Text
clusterId :: Prelude.Text
  }
  deriving (RemoveManagedScalingPolicy -> RemoveManagedScalingPolicy -> Bool
(RemoveManagedScalingPolicy -> RemoveManagedScalingPolicy -> Bool)
-> (RemoveManagedScalingPolicy
    -> RemoveManagedScalingPolicy -> Bool)
-> Eq RemoveManagedScalingPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RemoveManagedScalingPolicy -> RemoveManagedScalingPolicy -> Bool
$c/= :: RemoveManagedScalingPolicy -> RemoveManagedScalingPolicy -> Bool
== :: RemoveManagedScalingPolicy -> RemoveManagedScalingPolicy -> Bool
$c== :: RemoveManagedScalingPolicy -> RemoveManagedScalingPolicy -> Bool
Prelude.Eq, ReadPrec [RemoveManagedScalingPolicy]
ReadPrec RemoveManagedScalingPolicy
Int -> ReadS RemoveManagedScalingPolicy
ReadS [RemoveManagedScalingPolicy]
(Int -> ReadS RemoveManagedScalingPolicy)
-> ReadS [RemoveManagedScalingPolicy]
-> ReadPrec RemoveManagedScalingPolicy
-> ReadPrec [RemoveManagedScalingPolicy]
-> Read RemoveManagedScalingPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RemoveManagedScalingPolicy]
$creadListPrec :: ReadPrec [RemoveManagedScalingPolicy]
readPrec :: ReadPrec RemoveManagedScalingPolicy
$creadPrec :: ReadPrec RemoveManagedScalingPolicy
readList :: ReadS [RemoveManagedScalingPolicy]
$creadList :: ReadS [RemoveManagedScalingPolicy]
readsPrec :: Int -> ReadS RemoveManagedScalingPolicy
$creadsPrec :: Int -> ReadS RemoveManagedScalingPolicy
Prelude.Read, Int -> RemoveManagedScalingPolicy -> ShowS
[RemoveManagedScalingPolicy] -> ShowS
RemoveManagedScalingPolicy -> String
(Int -> RemoveManagedScalingPolicy -> ShowS)
-> (RemoveManagedScalingPolicy -> String)
-> ([RemoveManagedScalingPolicy] -> ShowS)
-> Show RemoveManagedScalingPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RemoveManagedScalingPolicy] -> ShowS
$cshowList :: [RemoveManagedScalingPolicy] -> ShowS
show :: RemoveManagedScalingPolicy -> String
$cshow :: RemoveManagedScalingPolicy -> String
showsPrec :: Int -> RemoveManagedScalingPolicy -> ShowS
$cshowsPrec :: Int -> RemoveManagedScalingPolicy -> ShowS
Prelude.Show, (forall x.
 RemoveManagedScalingPolicy -> Rep RemoveManagedScalingPolicy x)
-> (forall x.
    Rep RemoveManagedScalingPolicy x -> RemoveManagedScalingPolicy)
-> Generic RemoveManagedScalingPolicy
forall x.
Rep RemoveManagedScalingPolicy x -> RemoveManagedScalingPolicy
forall x.
RemoveManagedScalingPolicy -> Rep RemoveManagedScalingPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RemoveManagedScalingPolicy x -> RemoveManagedScalingPolicy
$cfrom :: forall x.
RemoveManagedScalingPolicy -> Rep RemoveManagedScalingPolicy x
Prelude.Generic)

-- |
-- Create a value of 'RemoveManagedScalingPolicy' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'clusterId', 'removeManagedScalingPolicy_clusterId' - Specifies the ID of the cluster from which the managed scaling policy
-- will be removed.
newRemoveManagedScalingPolicy ::
  -- | 'clusterId'
  Prelude.Text ->
  RemoveManagedScalingPolicy
newRemoveManagedScalingPolicy :: Text -> RemoveManagedScalingPolicy
newRemoveManagedScalingPolicy Text
pClusterId_ =
  RemoveManagedScalingPolicy' :: Text -> RemoveManagedScalingPolicy
RemoveManagedScalingPolicy'
    { $sel:clusterId:RemoveManagedScalingPolicy' :: Text
clusterId =
        Text
pClusterId_
    }

-- | Specifies the ID of the cluster from which the managed scaling policy
-- will be removed.
removeManagedScalingPolicy_clusterId :: Lens.Lens' RemoveManagedScalingPolicy Prelude.Text
removeManagedScalingPolicy_clusterId :: (Text -> f Text)
-> RemoveManagedScalingPolicy -> f RemoveManagedScalingPolicy
removeManagedScalingPolicy_clusterId = (RemoveManagedScalingPolicy -> Text)
-> (RemoveManagedScalingPolicy
    -> Text -> RemoveManagedScalingPolicy)
-> Lens
     RemoveManagedScalingPolicy RemoveManagedScalingPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveManagedScalingPolicy' {Text
clusterId :: Text
$sel:clusterId:RemoveManagedScalingPolicy' :: RemoveManagedScalingPolicy -> Text
clusterId} -> Text
clusterId) (\s :: RemoveManagedScalingPolicy
s@RemoveManagedScalingPolicy' {} Text
a -> RemoveManagedScalingPolicy
s {$sel:clusterId:RemoveManagedScalingPolicy' :: Text
clusterId = Text
a} :: RemoveManagedScalingPolicy)

instance Core.AWSRequest RemoveManagedScalingPolicy where
  type
    AWSResponse RemoveManagedScalingPolicy =
      RemoveManagedScalingPolicyResponse
  request :: RemoveManagedScalingPolicy -> Request RemoveManagedScalingPolicy
request = Service
-> RemoveManagedScalingPolicy -> Request RemoveManagedScalingPolicy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy RemoveManagedScalingPolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RemoveManagedScalingPolicy)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse RemoveManagedScalingPolicy))
-> Logger
-> Service
-> Proxy RemoveManagedScalingPolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RemoveManagedScalingPolicy)))
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 -> RemoveManagedScalingPolicyResponse
RemoveManagedScalingPolicyResponse'
            (Int -> RemoveManagedScalingPolicyResponse)
-> Either String Int
-> Either String RemoveManagedScalingPolicyResponse
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 RemoveManagedScalingPolicy

instance Prelude.NFData RemoveManagedScalingPolicy

instance Core.ToHeaders RemoveManagedScalingPolicy where
  toHeaders :: RemoveManagedScalingPolicy -> ResponseHeaders
toHeaders =
    ResponseHeaders -> RemoveManagedScalingPolicy -> 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.RemoveManagedScalingPolicy" ::
                          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 RemoveManagedScalingPolicy where
  toJSON :: RemoveManagedScalingPolicy -> Value
toJSON RemoveManagedScalingPolicy' {Text
clusterId :: Text
$sel:clusterId:RemoveManagedScalingPolicy' :: RemoveManagedScalingPolicy -> 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 RemoveManagedScalingPolicy where
  toPath :: RemoveManagedScalingPolicy -> ByteString
toPath = ByteString -> RemoveManagedScalingPolicy -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery RemoveManagedScalingPolicy where
  toQuery :: RemoveManagedScalingPolicy -> QueryString
toQuery = QueryString -> RemoveManagedScalingPolicy -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newRemoveManagedScalingPolicyResponse' smart constructor.
data RemoveManagedScalingPolicyResponse = RemoveManagedScalingPolicyResponse'
  { -- | The response's http status code.
    RemoveManagedScalingPolicyResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (RemoveManagedScalingPolicyResponse
-> RemoveManagedScalingPolicyResponse -> Bool
(RemoveManagedScalingPolicyResponse
 -> RemoveManagedScalingPolicyResponse -> Bool)
-> (RemoveManagedScalingPolicyResponse
    -> RemoveManagedScalingPolicyResponse -> Bool)
-> Eq RemoveManagedScalingPolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RemoveManagedScalingPolicyResponse
-> RemoveManagedScalingPolicyResponse -> Bool
$c/= :: RemoveManagedScalingPolicyResponse
-> RemoveManagedScalingPolicyResponse -> Bool
== :: RemoveManagedScalingPolicyResponse
-> RemoveManagedScalingPolicyResponse -> Bool
$c== :: RemoveManagedScalingPolicyResponse
-> RemoveManagedScalingPolicyResponse -> Bool
Prelude.Eq, ReadPrec [RemoveManagedScalingPolicyResponse]
ReadPrec RemoveManagedScalingPolicyResponse
Int -> ReadS RemoveManagedScalingPolicyResponse
ReadS [RemoveManagedScalingPolicyResponse]
(Int -> ReadS RemoveManagedScalingPolicyResponse)
-> ReadS [RemoveManagedScalingPolicyResponse]
-> ReadPrec RemoveManagedScalingPolicyResponse
-> ReadPrec [RemoveManagedScalingPolicyResponse]
-> Read RemoveManagedScalingPolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RemoveManagedScalingPolicyResponse]
$creadListPrec :: ReadPrec [RemoveManagedScalingPolicyResponse]
readPrec :: ReadPrec RemoveManagedScalingPolicyResponse
$creadPrec :: ReadPrec RemoveManagedScalingPolicyResponse
readList :: ReadS [RemoveManagedScalingPolicyResponse]
$creadList :: ReadS [RemoveManagedScalingPolicyResponse]
readsPrec :: Int -> ReadS RemoveManagedScalingPolicyResponse
$creadsPrec :: Int -> ReadS RemoveManagedScalingPolicyResponse
Prelude.Read, Int -> RemoveManagedScalingPolicyResponse -> ShowS
[RemoveManagedScalingPolicyResponse] -> ShowS
RemoveManagedScalingPolicyResponse -> String
(Int -> RemoveManagedScalingPolicyResponse -> ShowS)
-> (RemoveManagedScalingPolicyResponse -> String)
-> ([RemoveManagedScalingPolicyResponse] -> ShowS)
-> Show RemoveManagedScalingPolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RemoveManagedScalingPolicyResponse] -> ShowS
$cshowList :: [RemoveManagedScalingPolicyResponse] -> ShowS
show :: RemoveManagedScalingPolicyResponse -> String
$cshow :: RemoveManagedScalingPolicyResponse -> String
showsPrec :: Int -> RemoveManagedScalingPolicyResponse -> ShowS
$cshowsPrec :: Int -> RemoveManagedScalingPolicyResponse -> ShowS
Prelude.Show, (forall x.
 RemoveManagedScalingPolicyResponse
 -> Rep RemoveManagedScalingPolicyResponse x)
-> (forall x.
    Rep RemoveManagedScalingPolicyResponse x
    -> RemoveManagedScalingPolicyResponse)
-> Generic RemoveManagedScalingPolicyResponse
forall x.
Rep RemoveManagedScalingPolicyResponse x
-> RemoveManagedScalingPolicyResponse
forall x.
RemoveManagedScalingPolicyResponse
-> Rep RemoveManagedScalingPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RemoveManagedScalingPolicyResponse x
-> RemoveManagedScalingPolicyResponse
$cfrom :: forall x.
RemoveManagedScalingPolicyResponse
-> Rep RemoveManagedScalingPolicyResponse x
Prelude.Generic)

-- |
-- Create a value of 'RemoveManagedScalingPolicyResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'httpStatus', 'removeManagedScalingPolicyResponse_httpStatus' - The response's http status code.
newRemoveManagedScalingPolicyResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  RemoveManagedScalingPolicyResponse
newRemoveManagedScalingPolicyResponse :: Int -> RemoveManagedScalingPolicyResponse
newRemoveManagedScalingPolicyResponse Int
pHttpStatus_ =
  RemoveManagedScalingPolicyResponse' :: Int -> RemoveManagedScalingPolicyResponse
RemoveManagedScalingPolicyResponse'
    { $sel:httpStatus:RemoveManagedScalingPolicyResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
removeManagedScalingPolicyResponse_httpStatus :: Lens.Lens' RemoveManagedScalingPolicyResponse Prelude.Int
removeManagedScalingPolicyResponse_httpStatus :: (Int -> f Int)
-> RemoveManagedScalingPolicyResponse
-> f RemoveManagedScalingPolicyResponse
removeManagedScalingPolicyResponse_httpStatus = (RemoveManagedScalingPolicyResponse -> Int)
-> (RemoveManagedScalingPolicyResponse
    -> Int -> RemoveManagedScalingPolicyResponse)
-> Lens
     RemoveManagedScalingPolicyResponse
     RemoveManagedScalingPolicyResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveManagedScalingPolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:RemoveManagedScalingPolicyResponse' :: RemoveManagedScalingPolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RemoveManagedScalingPolicyResponse
s@RemoveManagedScalingPolicyResponse' {} Int
a -> RemoveManagedScalingPolicyResponse
s {$sel:httpStatus:RemoveManagedScalingPolicyResponse' :: Int
httpStatus = Int
a} :: RemoveManagedScalingPolicyResponse)

instance
  Prelude.NFData
    RemoveManagedScalingPolicyResponse