{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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 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

-- | /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
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]
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
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.
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'
    { $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 :: Lens' RemoveManagedScalingPolicy Text
removeManagedScalingPolicy_clusterId = 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 :: (Service -> Service)
-> RemoveManagedScalingPolicy -> Request RemoveManagedScalingPolicy
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 RemoveManagedScalingPolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RemoveManagedScalingPolicy)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> RemoveManagedScalingPolicyResponse
RemoveManagedScalingPolicyResponse'
            forall (f :: * -> *) a b. Functor 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 RemoveManagedScalingPolicy where
  hashWithSalt :: Int -> RemoveManagedScalingPolicy -> Int
hashWithSalt Int
_salt RemoveManagedScalingPolicy' {Text
clusterId :: Text
$sel:clusterId:RemoveManagedScalingPolicy' :: RemoveManagedScalingPolicy -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
clusterId

instance Prelude.NFData RemoveManagedScalingPolicy where
  rnf :: RemoveManagedScalingPolicy -> ()
rnf RemoveManagedScalingPolicy' {Text
clusterId :: Text
$sel:clusterId:RemoveManagedScalingPolicy' :: RemoveManagedScalingPolicy -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
clusterId

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

instance Data.ToQuery RemoveManagedScalingPolicy where
  toQuery :: RemoveManagedScalingPolicy -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
    { $sel:httpStatus:RemoveManagedScalingPolicyResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
removeManagedScalingPolicyResponse_httpStatus :: Lens.Lens' RemoveManagedScalingPolicyResponse Prelude.Int
removeManagedScalingPolicyResponse_httpStatus :: Lens' RemoveManagedScalingPolicyResponse Int
removeManagedScalingPolicyResponse_httpStatus = 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
  where
  rnf :: RemoveManagedScalingPolicyResponse -> ()
rnf RemoveManagedScalingPolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:RemoveManagedScalingPolicyResponse' :: RemoveManagedScalingPolicyResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus