{-# 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.DAX.DeleteParameterGroup
-- 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)
--
-- Deletes the specified parameter group. You cannot delete a parameter
-- group if it is associated with any DAX clusters.
module Amazonka.DAX.DeleteParameterGroup
  ( -- * Creating a Request
    DeleteParameterGroup (..),
    newDeleteParameterGroup,

    -- * Request Lenses
    deleteParameterGroup_parameterGroupName,

    -- * Destructuring the Response
    DeleteParameterGroupResponse (..),
    newDeleteParameterGroupResponse,

    -- * Response Lenses
    deleteParameterGroupResponse_deletionMessage,
    deleteParameterGroupResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DAX.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:/ 'newDeleteParameterGroup' smart constructor.
data DeleteParameterGroup = DeleteParameterGroup'
  { -- | The name of the parameter group to delete.
    DeleteParameterGroup -> Text
parameterGroupName :: Prelude.Text
  }
  deriving (DeleteParameterGroup -> DeleteParameterGroup -> Bool
(DeleteParameterGroup -> DeleteParameterGroup -> Bool)
-> (DeleteParameterGroup -> DeleteParameterGroup -> Bool)
-> Eq DeleteParameterGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteParameterGroup -> DeleteParameterGroup -> Bool
$c/= :: DeleteParameterGroup -> DeleteParameterGroup -> Bool
== :: DeleteParameterGroup -> DeleteParameterGroup -> Bool
$c== :: DeleteParameterGroup -> DeleteParameterGroup -> Bool
Prelude.Eq, ReadPrec [DeleteParameterGroup]
ReadPrec DeleteParameterGroup
Int -> ReadS DeleteParameterGroup
ReadS [DeleteParameterGroup]
(Int -> ReadS DeleteParameterGroup)
-> ReadS [DeleteParameterGroup]
-> ReadPrec DeleteParameterGroup
-> ReadPrec [DeleteParameterGroup]
-> Read DeleteParameterGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteParameterGroup]
$creadListPrec :: ReadPrec [DeleteParameterGroup]
readPrec :: ReadPrec DeleteParameterGroup
$creadPrec :: ReadPrec DeleteParameterGroup
readList :: ReadS [DeleteParameterGroup]
$creadList :: ReadS [DeleteParameterGroup]
readsPrec :: Int -> ReadS DeleteParameterGroup
$creadsPrec :: Int -> ReadS DeleteParameterGroup
Prelude.Read, Int -> DeleteParameterGroup -> ShowS
[DeleteParameterGroup] -> ShowS
DeleteParameterGroup -> String
(Int -> DeleteParameterGroup -> ShowS)
-> (DeleteParameterGroup -> String)
-> ([DeleteParameterGroup] -> ShowS)
-> Show DeleteParameterGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteParameterGroup] -> ShowS
$cshowList :: [DeleteParameterGroup] -> ShowS
show :: DeleteParameterGroup -> String
$cshow :: DeleteParameterGroup -> String
showsPrec :: Int -> DeleteParameterGroup -> ShowS
$cshowsPrec :: Int -> DeleteParameterGroup -> ShowS
Prelude.Show, (forall x. DeleteParameterGroup -> Rep DeleteParameterGroup x)
-> (forall x. Rep DeleteParameterGroup x -> DeleteParameterGroup)
-> Generic DeleteParameterGroup
forall x. Rep DeleteParameterGroup x -> DeleteParameterGroup
forall x. DeleteParameterGroup -> Rep DeleteParameterGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteParameterGroup x -> DeleteParameterGroup
$cfrom :: forall x. DeleteParameterGroup -> Rep DeleteParameterGroup x
Prelude.Generic)

-- |
-- Create a value of 'DeleteParameterGroup' 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:
--
-- 'parameterGroupName', 'deleteParameterGroup_parameterGroupName' - The name of the parameter group to delete.
newDeleteParameterGroup ::
  -- | 'parameterGroupName'
  Prelude.Text ->
  DeleteParameterGroup
newDeleteParameterGroup :: Text -> DeleteParameterGroup
newDeleteParameterGroup Text
pParameterGroupName_ =
  DeleteParameterGroup' :: Text -> DeleteParameterGroup
DeleteParameterGroup'
    { $sel:parameterGroupName:DeleteParameterGroup' :: Text
parameterGroupName =
        Text
pParameterGroupName_
    }

-- | The name of the parameter group to delete.
deleteParameterGroup_parameterGroupName :: Lens.Lens' DeleteParameterGroup Prelude.Text
deleteParameterGroup_parameterGroupName :: (Text -> f Text) -> DeleteParameterGroup -> f DeleteParameterGroup
deleteParameterGroup_parameterGroupName = (DeleteParameterGroup -> Text)
-> (DeleteParameterGroup -> Text -> DeleteParameterGroup)
-> Lens DeleteParameterGroup DeleteParameterGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteParameterGroup' {Text
parameterGroupName :: Text
$sel:parameterGroupName:DeleteParameterGroup' :: DeleteParameterGroup -> Text
parameterGroupName} -> Text
parameterGroupName) (\s :: DeleteParameterGroup
s@DeleteParameterGroup' {} Text
a -> DeleteParameterGroup
s {$sel:parameterGroupName:DeleteParameterGroup' :: Text
parameterGroupName = Text
a} :: DeleteParameterGroup)

instance Core.AWSRequest DeleteParameterGroup where
  type
    AWSResponse DeleteParameterGroup =
      DeleteParameterGroupResponse
  request :: DeleteParameterGroup -> Request DeleteParameterGroup
request = Service -> DeleteParameterGroup -> Request DeleteParameterGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteParameterGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteParameterGroup)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteParameterGroup))
-> Logger
-> Service
-> Proxy DeleteParameterGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteParameterGroup)))
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 Text -> Int -> DeleteParameterGroupResponse
DeleteParameterGroupResponse'
            (Maybe Text -> Int -> DeleteParameterGroupResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DeleteParameterGroupResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"DeletionMessage")
            Either String (Int -> DeleteParameterGroupResponse)
-> Either String Int -> Either String DeleteParameterGroupResponse
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 DeleteParameterGroup

instance Prelude.NFData DeleteParameterGroup

instance Core.ToHeaders DeleteParameterGroup where
  toHeaders :: DeleteParameterGroup -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteParameterGroup -> 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
"AmazonDAXV3.DeleteParameterGroup" ::
                          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 DeleteParameterGroup where
  toJSON :: DeleteParameterGroup -> Value
toJSON DeleteParameterGroup' {Text
parameterGroupName :: Text
$sel:parameterGroupName:DeleteParameterGroup' :: DeleteParameterGroup -> 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
"ParameterGroupName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
parameterGroupName)
          ]
      )

instance Core.ToPath DeleteParameterGroup where
  toPath :: DeleteParameterGroup -> ByteString
toPath = ByteString -> DeleteParameterGroup -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newDeleteParameterGroupResponse' smart constructor.
data DeleteParameterGroupResponse = DeleteParameterGroupResponse'
  { -- | A user-specified message for this action (i.e., a reason for deleting
    -- the parameter group).
    DeleteParameterGroupResponse -> Maybe Text
deletionMessage :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DeleteParameterGroupResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteParameterGroupResponse
-> DeleteParameterGroupResponse -> Bool
(DeleteParameterGroupResponse
 -> DeleteParameterGroupResponse -> Bool)
-> (DeleteParameterGroupResponse
    -> DeleteParameterGroupResponse -> Bool)
-> Eq DeleteParameterGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteParameterGroupResponse
-> DeleteParameterGroupResponse -> Bool
$c/= :: DeleteParameterGroupResponse
-> DeleteParameterGroupResponse -> Bool
== :: DeleteParameterGroupResponse
-> DeleteParameterGroupResponse -> Bool
$c== :: DeleteParameterGroupResponse
-> DeleteParameterGroupResponse -> Bool
Prelude.Eq, ReadPrec [DeleteParameterGroupResponse]
ReadPrec DeleteParameterGroupResponse
Int -> ReadS DeleteParameterGroupResponse
ReadS [DeleteParameterGroupResponse]
(Int -> ReadS DeleteParameterGroupResponse)
-> ReadS [DeleteParameterGroupResponse]
-> ReadPrec DeleteParameterGroupResponse
-> ReadPrec [DeleteParameterGroupResponse]
-> Read DeleteParameterGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteParameterGroupResponse]
$creadListPrec :: ReadPrec [DeleteParameterGroupResponse]
readPrec :: ReadPrec DeleteParameterGroupResponse
$creadPrec :: ReadPrec DeleteParameterGroupResponse
readList :: ReadS [DeleteParameterGroupResponse]
$creadList :: ReadS [DeleteParameterGroupResponse]
readsPrec :: Int -> ReadS DeleteParameterGroupResponse
$creadsPrec :: Int -> ReadS DeleteParameterGroupResponse
Prelude.Read, Int -> DeleteParameterGroupResponse -> ShowS
[DeleteParameterGroupResponse] -> ShowS
DeleteParameterGroupResponse -> String
(Int -> DeleteParameterGroupResponse -> ShowS)
-> (DeleteParameterGroupResponse -> String)
-> ([DeleteParameterGroupResponse] -> ShowS)
-> Show DeleteParameterGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteParameterGroupResponse] -> ShowS
$cshowList :: [DeleteParameterGroupResponse] -> ShowS
show :: DeleteParameterGroupResponse -> String
$cshow :: DeleteParameterGroupResponse -> String
showsPrec :: Int -> DeleteParameterGroupResponse -> ShowS
$cshowsPrec :: Int -> DeleteParameterGroupResponse -> ShowS
Prelude.Show, (forall x.
 DeleteParameterGroupResponse -> Rep DeleteParameterGroupResponse x)
-> (forall x.
    Rep DeleteParameterGroupResponse x -> DeleteParameterGroupResponse)
-> Generic DeleteParameterGroupResponse
forall x.
Rep DeleteParameterGroupResponse x -> DeleteParameterGroupResponse
forall x.
DeleteParameterGroupResponse -> Rep DeleteParameterGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteParameterGroupResponse x -> DeleteParameterGroupResponse
$cfrom :: forall x.
DeleteParameterGroupResponse -> Rep DeleteParameterGroupResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteParameterGroupResponse' 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:
--
-- 'deletionMessage', 'deleteParameterGroupResponse_deletionMessage' - A user-specified message for this action (i.e., a reason for deleting
-- the parameter group).
--
-- 'httpStatus', 'deleteParameterGroupResponse_httpStatus' - The response's http status code.
newDeleteParameterGroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteParameterGroupResponse
newDeleteParameterGroupResponse :: Int -> DeleteParameterGroupResponse
newDeleteParameterGroupResponse Int
pHttpStatus_ =
  DeleteParameterGroupResponse' :: Maybe Text -> Int -> DeleteParameterGroupResponse
DeleteParameterGroupResponse'
    { $sel:deletionMessage:DeleteParameterGroupResponse' :: Maybe Text
deletionMessage =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteParameterGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A user-specified message for this action (i.e., a reason for deleting
-- the parameter group).
deleteParameterGroupResponse_deletionMessage :: Lens.Lens' DeleteParameterGroupResponse (Prelude.Maybe Prelude.Text)
deleteParameterGroupResponse_deletionMessage :: (Maybe Text -> f (Maybe Text))
-> DeleteParameterGroupResponse -> f DeleteParameterGroupResponse
deleteParameterGroupResponse_deletionMessage = (DeleteParameterGroupResponse -> Maybe Text)
-> (DeleteParameterGroupResponse
    -> Maybe Text -> DeleteParameterGroupResponse)
-> Lens
     DeleteParameterGroupResponse
     DeleteParameterGroupResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteParameterGroupResponse' {Maybe Text
deletionMessage :: Maybe Text
$sel:deletionMessage:DeleteParameterGroupResponse' :: DeleteParameterGroupResponse -> Maybe Text
deletionMessage} -> Maybe Text
deletionMessage) (\s :: DeleteParameterGroupResponse
s@DeleteParameterGroupResponse' {} Maybe Text
a -> DeleteParameterGroupResponse
s {$sel:deletionMessage:DeleteParameterGroupResponse' :: Maybe Text
deletionMessage = Maybe Text
a} :: DeleteParameterGroupResponse)

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

instance Prelude.NFData DeleteParameterGroupResponse