{-# 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.RemoveAutoTerminationPolicy
-- 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 an auto-termination policy from an Amazon EMR cluster.
module Amazonka.EMR.RemoveAutoTerminationPolicy
  ( -- * Creating a Request
    RemoveAutoTerminationPolicy (..),
    newRemoveAutoTerminationPolicy,

    -- * Request Lenses
    removeAutoTerminationPolicy_clusterId,

    -- * Destructuring the Response
    RemoveAutoTerminationPolicyResponse (..),
    newRemoveAutoTerminationPolicyResponse,

    -- * Response Lenses
    removeAutoTerminationPolicyResponse_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:/ 'newRemoveAutoTerminationPolicy' smart constructor.
data RemoveAutoTerminationPolicy = RemoveAutoTerminationPolicy'
  { -- | Specifies the ID of the Amazon EMR cluster from which the
    -- auto-termination policy will be removed.
    RemoveAutoTerminationPolicy -> Text
clusterId :: Prelude.Text
  }
  deriving (RemoveAutoTerminationPolicy -> RemoveAutoTerminationPolicy -> Bool
(RemoveAutoTerminationPolicy
 -> RemoveAutoTerminationPolicy -> Bool)
-> (RemoveAutoTerminationPolicy
    -> RemoveAutoTerminationPolicy -> Bool)
-> Eq RemoveAutoTerminationPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RemoveAutoTerminationPolicy -> RemoveAutoTerminationPolicy -> Bool
$c/= :: RemoveAutoTerminationPolicy -> RemoveAutoTerminationPolicy -> Bool
== :: RemoveAutoTerminationPolicy -> RemoveAutoTerminationPolicy -> Bool
$c== :: RemoveAutoTerminationPolicy -> RemoveAutoTerminationPolicy -> Bool
Prelude.Eq, ReadPrec [RemoveAutoTerminationPolicy]
ReadPrec RemoveAutoTerminationPolicy
Int -> ReadS RemoveAutoTerminationPolicy
ReadS [RemoveAutoTerminationPolicy]
(Int -> ReadS RemoveAutoTerminationPolicy)
-> ReadS [RemoveAutoTerminationPolicy]
-> ReadPrec RemoveAutoTerminationPolicy
-> ReadPrec [RemoveAutoTerminationPolicy]
-> Read RemoveAutoTerminationPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RemoveAutoTerminationPolicy]
$creadListPrec :: ReadPrec [RemoveAutoTerminationPolicy]
readPrec :: ReadPrec RemoveAutoTerminationPolicy
$creadPrec :: ReadPrec RemoveAutoTerminationPolicy
readList :: ReadS [RemoveAutoTerminationPolicy]
$creadList :: ReadS [RemoveAutoTerminationPolicy]
readsPrec :: Int -> ReadS RemoveAutoTerminationPolicy
$creadsPrec :: Int -> ReadS RemoveAutoTerminationPolicy
Prelude.Read, Int -> RemoveAutoTerminationPolicy -> ShowS
[RemoveAutoTerminationPolicy] -> ShowS
RemoveAutoTerminationPolicy -> String
(Int -> RemoveAutoTerminationPolicy -> ShowS)
-> (RemoveAutoTerminationPolicy -> String)
-> ([RemoveAutoTerminationPolicy] -> ShowS)
-> Show RemoveAutoTerminationPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RemoveAutoTerminationPolicy] -> ShowS
$cshowList :: [RemoveAutoTerminationPolicy] -> ShowS
show :: RemoveAutoTerminationPolicy -> String
$cshow :: RemoveAutoTerminationPolicy -> String
showsPrec :: Int -> RemoveAutoTerminationPolicy -> ShowS
$cshowsPrec :: Int -> RemoveAutoTerminationPolicy -> ShowS
Prelude.Show, (forall x.
 RemoveAutoTerminationPolicy -> Rep RemoveAutoTerminationPolicy x)
-> (forall x.
    Rep RemoveAutoTerminationPolicy x -> RemoveAutoTerminationPolicy)
-> Generic RemoveAutoTerminationPolicy
forall x.
Rep RemoveAutoTerminationPolicy x -> RemoveAutoTerminationPolicy
forall x.
RemoveAutoTerminationPolicy -> Rep RemoveAutoTerminationPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RemoveAutoTerminationPolicy x -> RemoveAutoTerminationPolicy
$cfrom :: forall x.
RemoveAutoTerminationPolicy -> Rep RemoveAutoTerminationPolicy x
Prelude.Generic)

-- |
-- Create a value of 'RemoveAutoTerminationPolicy' 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', 'removeAutoTerminationPolicy_clusterId' - Specifies the ID of the Amazon EMR cluster from which the
-- auto-termination policy will be removed.
newRemoveAutoTerminationPolicy ::
  -- | 'clusterId'
  Prelude.Text ->
  RemoveAutoTerminationPolicy
newRemoveAutoTerminationPolicy :: Text -> RemoveAutoTerminationPolicy
newRemoveAutoTerminationPolicy Text
pClusterId_ =
  RemoveAutoTerminationPolicy' :: Text -> RemoveAutoTerminationPolicy
RemoveAutoTerminationPolicy'
    { $sel:clusterId:RemoveAutoTerminationPolicy' :: Text
clusterId =
        Text
pClusterId_
    }

-- | Specifies the ID of the Amazon EMR cluster from which the
-- auto-termination policy will be removed.
removeAutoTerminationPolicy_clusterId :: Lens.Lens' RemoveAutoTerminationPolicy Prelude.Text
removeAutoTerminationPolicy_clusterId :: (Text -> f Text)
-> RemoveAutoTerminationPolicy -> f RemoveAutoTerminationPolicy
removeAutoTerminationPolicy_clusterId = (RemoveAutoTerminationPolicy -> Text)
-> (RemoveAutoTerminationPolicy
    -> Text -> RemoveAutoTerminationPolicy)
-> Lens
     RemoveAutoTerminationPolicy RemoveAutoTerminationPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveAutoTerminationPolicy' {Text
clusterId :: Text
$sel:clusterId:RemoveAutoTerminationPolicy' :: RemoveAutoTerminationPolicy -> Text
clusterId} -> Text
clusterId) (\s :: RemoveAutoTerminationPolicy
s@RemoveAutoTerminationPolicy' {} Text
a -> RemoveAutoTerminationPolicy
s {$sel:clusterId:RemoveAutoTerminationPolicy' :: Text
clusterId = Text
a} :: RemoveAutoTerminationPolicy)

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

instance Prelude.NFData RemoveAutoTerminationPolicy

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

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

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

-- |
-- Create a value of 'RemoveAutoTerminationPolicyResponse' 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', 'removeAutoTerminationPolicyResponse_httpStatus' - The response's http status code.
newRemoveAutoTerminationPolicyResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  RemoveAutoTerminationPolicyResponse
newRemoveAutoTerminationPolicyResponse :: Int -> RemoveAutoTerminationPolicyResponse
newRemoveAutoTerminationPolicyResponse Int
pHttpStatus_ =
  RemoveAutoTerminationPolicyResponse' :: Int -> RemoveAutoTerminationPolicyResponse
RemoveAutoTerminationPolicyResponse'
    { $sel:httpStatus:RemoveAutoTerminationPolicyResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance
  Prelude.NFData
    RemoveAutoTerminationPolicyResponse