{-# 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.Route53Resolver.DeleteFirewallRuleGroup
-- 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 firewall rule group.
module Amazonka.Route53Resolver.DeleteFirewallRuleGroup
  ( -- * Creating a Request
    DeleteFirewallRuleGroup (..),
    newDeleteFirewallRuleGroup,

    -- * Request Lenses
    deleteFirewallRuleGroup_firewallRuleGroupId,

    -- * Destructuring the Response
    DeleteFirewallRuleGroupResponse (..),
    newDeleteFirewallRuleGroupResponse,

    -- * Response Lenses
    deleteFirewallRuleGroupResponse_firewallRuleGroup,
    deleteFirewallRuleGroupResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Route53Resolver.Types

-- | /See:/ 'newDeleteFirewallRuleGroup' smart constructor.
data DeleteFirewallRuleGroup = DeleteFirewallRuleGroup'
  { -- | The unique identifier of the firewall rule group that you want to
    -- delete.
    DeleteFirewallRuleGroup -> Text
firewallRuleGroupId :: Prelude.Text
  }
  deriving (DeleteFirewallRuleGroup -> DeleteFirewallRuleGroup -> Bool
(DeleteFirewallRuleGroup -> DeleteFirewallRuleGroup -> Bool)
-> (DeleteFirewallRuleGroup -> DeleteFirewallRuleGroup -> Bool)
-> Eq DeleteFirewallRuleGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteFirewallRuleGroup -> DeleteFirewallRuleGroup -> Bool
$c/= :: DeleteFirewallRuleGroup -> DeleteFirewallRuleGroup -> Bool
== :: DeleteFirewallRuleGroup -> DeleteFirewallRuleGroup -> Bool
$c== :: DeleteFirewallRuleGroup -> DeleteFirewallRuleGroup -> Bool
Prelude.Eq, ReadPrec [DeleteFirewallRuleGroup]
ReadPrec DeleteFirewallRuleGroup
Int -> ReadS DeleteFirewallRuleGroup
ReadS [DeleteFirewallRuleGroup]
(Int -> ReadS DeleteFirewallRuleGroup)
-> ReadS [DeleteFirewallRuleGroup]
-> ReadPrec DeleteFirewallRuleGroup
-> ReadPrec [DeleteFirewallRuleGroup]
-> Read DeleteFirewallRuleGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteFirewallRuleGroup]
$creadListPrec :: ReadPrec [DeleteFirewallRuleGroup]
readPrec :: ReadPrec DeleteFirewallRuleGroup
$creadPrec :: ReadPrec DeleteFirewallRuleGroup
readList :: ReadS [DeleteFirewallRuleGroup]
$creadList :: ReadS [DeleteFirewallRuleGroup]
readsPrec :: Int -> ReadS DeleteFirewallRuleGroup
$creadsPrec :: Int -> ReadS DeleteFirewallRuleGroup
Prelude.Read, Int -> DeleteFirewallRuleGroup -> ShowS
[DeleteFirewallRuleGroup] -> ShowS
DeleteFirewallRuleGroup -> String
(Int -> DeleteFirewallRuleGroup -> ShowS)
-> (DeleteFirewallRuleGroup -> String)
-> ([DeleteFirewallRuleGroup] -> ShowS)
-> Show DeleteFirewallRuleGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteFirewallRuleGroup] -> ShowS
$cshowList :: [DeleteFirewallRuleGroup] -> ShowS
show :: DeleteFirewallRuleGroup -> String
$cshow :: DeleteFirewallRuleGroup -> String
showsPrec :: Int -> DeleteFirewallRuleGroup -> ShowS
$cshowsPrec :: Int -> DeleteFirewallRuleGroup -> ShowS
Prelude.Show, (forall x.
 DeleteFirewallRuleGroup -> Rep DeleteFirewallRuleGroup x)
-> (forall x.
    Rep DeleteFirewallRuleGroup x -> DeleteFirewallRuleGroup)
-> Generic DeleteFirewallRuleGroup
forall x. Rep DeleteFirewallRuleGroup x -> DeleteFirewallRuleGroup
forall x. DeleteFirewallRuleGroup -> Rep DeleteFirewallRuleGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteFirewallRuleGroup x -> DeleteFirewallRuleGroup
$cfrom :: forall x. DeleteFirewallRuleGroup -> Rep DeleteFirewallRuleGroup x
Prelude.Generic)

-- |
-- Create a value of 'DeleteFirewallRuleGroup' 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:
--
-- 'firewallRuleGroupId', 'deleteFirewallRuleGroup_firewallRuleGroupId' - The unique identifier of the firewall rule group that you want to
-- delete.
newDeleteFirewallRuleGroup ::
  -- | 'firewallRuleGroupId'
  Prelude.Text ->
  DeleteFirewallRuleGroup
newDeleteFirewallRuleGroup :: Text -> DeleteFirewallRuleGroup
newDeleteFirewallRuleGroup Text
pFirewallRuleGroupId_ =
  DeleteFirewallRuleGroup' :: Text -> DeleteFirewallRuleGroup
DeleteFirewallRuleGroup'
    { $sel:firewallRuleGroupId:DeleteFirewallRuleGroup' :: Text
firewallRuleGroupId =
        Text
pFirewallRuleGroupId_
    }

-- | The unique identifier of the firewall rule group that you want to
-- delete.
deleteFirewallRuleGroup_firewallRuleGroupId :: Lens.Lens' DeleteFirewallRuleGroup Prelude.Text
deleteFirewallRuleGroup_firewallRuleGroupId :: (Text -> f Text)
-> DeleteFirewallRuleGroup -> f DeleteFirewallRuleGroup
deleteFirewallRuleGroup_firewallRuleGroupId = (DeleteFirewallRuleGroup -> Text)
-> (DeleteFirewallRuleGroup -> Text -> DeleteFirewallRuleGroup)
-> Lens DeleteFirewallRuleGroup DeleteFirewallRuleGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFirewallRuleGroup' {Text
firewallRuleGroupId :: Text
$sel:firewallRuleGroupId:DeleteFirewallRuleGroup' :: DeleteFirewallRuleGroup -> Text
firewallRuleGroupId} -> Text
firewallRuleGroupId) (\s :: DeleteFirewallRuleGroup
s@DeleteFirewallRuleGroup' {} Text
a -> DeleteFirewallRuleGroup
s {$sel:firewallRuleGroupId:DeleteFirewallRuleGroup' :: Text
firewallRuleGroupId = Text
a} :: DeleteFirewallRuleGroup)

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

instance Prelude.NFData DeleteFirewallRuleGroup

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

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

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

-- | /See:/ 'newDeleteFirewallRuleGroupResponse' smart constructor.
data DeleteFirewallRuleGroupResponse = DeleteFirewallRuleGroupResponse'
  { -- | A collection of rules used to filter DNS network traffic.
    DeleteFirewallRuleGroupResponse -> Maybe FirewallRuleGroup
firewallRuleGroup :: Prelude.Maybe FirewallRuleGroup,
    -- | The response's http status code.
    DeleteFirewallRuleGroupResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteFirewallRuleGroupResponse
-> DeleteFirewallRuleGroupResponse -> Bool
(DeleteFirewallRuleGroupResponse
 -> DeleteFirewallRuleGroupResponse -> Bool)
-> (DeleteFirewallRuleGroupResponse
    -> DeleteFirewallRuleGroupResponse -> Bool)
-> Eq DeleteFirewallRuleGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteFirewallRuleGroupResponse
-> DeleteFirewallRuleGroupResponse -> Bool
$c/= :: DeleteFirewallRuleGroupResponse
-> DeleteFirewallRuleGroupResponse -> Bool
== :: DeleteFirewallRuleGroupResponse
-> DeleteFirewallRuleGroupResponse -> Bool
$c== :: DeleteFirewallRuleGroupResponse
-> DeleteFirewallRuleGroupResponse -> Bool
Prelude.Eq, ReadPrec [DeleteFirewallRuleGroupResponse]
ReadPrec DeleteFirewallRuleGroupResponse
Int -> ReadS DeleteFirewallRuleGroupResponse
ReadS [DeleteFirewallRuleGroupResponse]
(Int -> ReadS DeleteFirewallRuleGroupResponse)
-> ReadS [DeleteFirewallRuleGroupResponse]
-> ReadPrec DeleteFirewallRuleGroupResponse
-> ReadPrec [DeleteFirewallRuleGroupResponse]
-> Read DeleteFirewallRuleGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteFirewallRuleGroupResponse]
$creadListPrec :: ReadPrec [DeleteFirewallRuleGroupResponse]
readPrec :: ReadPrec DeleteFirewallRuleGroupResponse
$creadPrec :: ReadPrec DeleteFirewallRuleGroupResponse
readList :: ReadS [DeleteFirewallRuleGroupResponse]
$creadList :: ReadS [DeleteFirewallRuleGroupResponse]
readsPrec :: Int -> ReadS DeleteFirewallRuleGroupResponse
$creadsPrec :: Int -> ReadS DeleteFirewallRuleGroupResponse
Prelude.Read, Int -> DeleteFirewallRuleGroupResponse -> ShowS
[DeleteFirewallRuleGroupResponse] -> ShowS
DeleteFirewallRuleGroupResponse -> String
(Int -> DeleteFirewallRuleGroupResponse -> ShowS)
-> (DeleteFirewallRuleGroupResponse -> String)
-> ([DeleteFirewallRuleGroupResponse] -> ShowS)
-> Show DeleteFirewallRuleGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteFirewallRuleGroupResponse] -> ShowS
$cshowList :: [DeleteFirewallRuleGroupResponse] -> ShowS
show :: DeleteFirewallRuleGroupResponse -> String
$cshow :: DeleteFirewallRuleGroupResponse -> String
showsPrec :: Int -> DeleteFirewallRuleGroupResponse -> ShowS
$cshowsPrec :: Int -> DeleteFirewallRuleGroupResponse -> ShowS
Prelude.Show, (forall x.
 DeleteFirewallRuleGroupResponse
 -> Rep DeleteFirewallRuleGroupResponse x)
-> (forall x.
    Rep DeleteFirewallRuleGroupResponse x
    -> DeleteFirewallRuleGroupResponse)
-> Generic DeleteFirewallRuleGroupResponse
forall x.
Rep DeleteFirewallRuleGroupResponse x
-> DeleteFirewallRuleGroupResponse
forall x.
DeleteFirewallRuleGroupResponse
-> Rep DeleteFirewallRuleGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteFirewallRuleGroupResponse x
-> DeleteFirewallRuleGroupResponse
$cfrom :: forall x.
DeleteFirewallRuleGroupResponse
-> Rep DeleteFirewallRuleGroupResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteFirewallRuleGroupResponse' 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:
--
-- 'firewallRuleGroup', 'deleteFirewallRuleGroupResponse_firewallRuleGroup' - A collection of rules used to filter DNS network traffic.
--
-- 'httpStatus', 'deleteFirewallRuleGroupResponse_httpStatus' - The response's http status code.
newDeleteFirewallRuleGroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteFirewallRuleGroupResponse
newDeleteFirewallRuleGroupResponse :: Int -> DeleteFirewallRuleGroupResponse
newDeleteFirewallRuleGroupResponse Int
pHttpStatus_ =
  DeleteFirewallRuleGroupResponse' :: Maybe FirewallRuleGroup -> Int -> DeleteFirewallRuleGroupResponse
DeleteFirewallRuleGroupResponse'
    { $sel:firewallRuleGroup:DeleteFirewallRuleGroupResponse' :: Maybe FirewallRuleGroup
firewallRuleGroup =
        Maybe FirewallRuleGroup
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteFirewallRuleGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A collection of rules used to filter DNS network traffic.
deleteFirewallRuleGroupResponse_firewallRuleGroup :: Lens.Lens' DeleteFirewallRuleGroupResponse (Prelude.Maybe FirewallRuleGroup)
deleteFirewallRuleGroupResponse_firewallRuleGroup :: (Maybe FirewallRuleGroup -> f (Maybe FirewallRuleGroup))
-> DeleteFirewallRuleGroupResponse
-> f DeleteFirewallRuleGroupResponse
deleteFirewallRuleGroupResponse_firewallRuleGroup = (DeleteFirewallRuleGroupResponse -> Maybe FirewallRuleGroup)
-> (DeleteFirewallRuleGroupResponse
    -> Maybe FirewallRuleGroup -> DeleteFirewallRuleGroupResponse)
-> Lens
     DeleteFirewallRuleGroupResponse
     DeleteFirewallRuleGroupResponse
     (Maybe FirewallRuleGroup)
     (Maybe FirewallRuleGroup)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFirewallRuleGroupResponse' {Maybe FirewallRuleGroup
firewallRuleGroup :: Maybe FirewallRuleGroup
$sel:firewallRuleGroup:DeleteFirewallRuleGroupResponse' :: DeleteFirewallRuleGroupResponse -> Maybe FirewallRuleGroup
firewallRuleGroup} -> Maybe FirewallRuleGroup
firewallRuleGroup) (\s :: DeleteFirewallRuleGroupResponse
s@DeleteFirewallRuleGroupResponse' {} Maybe FirewallRuleGroup
a -> DeleteFirewallRuleGroupResponse
s {$sel:firewallRuleGroup:DeleteFirewallRuleGroupResponse' :: Maybe FirewallRuleGroup
firewallRuleGroup = Maybe FirewallRuleGroup
a} :: DeleteFirewallRuleGroupResponse)

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

instance
  Prelude.NFData
    DeleteFirewallRuleGroupResponse