{-# 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.DeleteFirewallRule
-- 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.
module Amazonka.Route53Resolver.DeleteFirewallRule
  ( -- * Creating a Request
    DeleteFirewallRule (..),
    newDeleteFirewallRule,

    -- * Request Lenses
    deleteFirewallRule_firewallRuleGroupId,
    deleteFirewallRule_firewallDomainListId,

    -- * Destructuring the Response
    DeleteFirewallRuleResponse (..),
    newDeleteFirewallRuleResponse,

    -- * Response Lenses
    deleteFirewallRuleResponse_firewallRule,
    deleteFirewallRuleResponse_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:/ 'newDeleteFirewallRule' smart constructor.
data DeleteFirewallRule = DeleteFirewallRule'
  { -- | The unique identifier of the firewall rule group that you want to delete
    -- the rule from.
    DeleteFirewallRule -> Text
firewallRuleGroupId :: Prelude.Text,
    -- | The ID of the domain list that\'s used in the rule.
    DeleteFirewallRule -> Text
firewallDomainListId :: Prelude.Text
  }
  deriving (DeleteFirewallRule -> DeleteFirewallRule -> Bool
(DeleteFirewallRule -> DeleteFirewallRule -> Bool)
-> (DeleteFirewallRule -> DeleteFirewallRule -> Bool)
-> Eq DeleteFirewallRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteFirewallRule -> DeleteFirewallRule -> Bool
$c/= :: DeleteFirewallRule -> DeleteFirewallRule -> Bool
== :: DeleteFirewallRule -> DeleteFirewallRule -> Bool
$c== :: DeleteFirewallRule -> DeleteFirewallRule -> Bool
Prelude.Eq, ReadPrec [DeleteFirewallRule]
ReadPrec DeleteFirewallRule
Int -> ReadS DeleteFirewallRule
ReadS [DeleteFirewallRule]
(Int -> ReadS DeleteFirewallRule)
-> ReadS [DeleteFirewallRule]
-> ReadPrec DeleteFirewallRule
-> ReadPrec [DeleteFirewallRule]
-> Read DeleteFirewallRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteFirewallRule]
$creadListPrec :: ReadPrec [DeleteFirewallRule]
readPrec :: ReadPrec DeleteFirewallRule
$creadPrec :: ReadPrec DeleteFirewallRule
readList :: ReadS [DeleteFirewallRule]
$creadList :: ReadS [DeleteFirewallRule]
readsPrec :: Int -> ReadS DeleteFirewallRule
$creadsPrec :: Int -> ReadS DeleteFirewallRule
Prelude.Read, Int -> DeleteFirewallRule -> ShowS
[DeleteFirewallRule] -> ShowS
DeleteFirewallRule -> String
(Int -> DeleteFirewallRule -> ShowS)
-> (DeleteFirewallRule -> String)
-> ([DeleteFirewallRule] -> ShowS)
-> Show DeleteFirewallRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteFirewallRule] -> ShowS
$cshowList :: [DeleteFirewallRule] -> ShowS
show :: DeleteFirewallRule -> String
$cshow :: DeleteFirewallRule -> String
showsPrec :: Int -> DeleteFirewallRule -> ShowS
$cshowsPrec :: Int -> DeleteFirewallRule -> ShowS
Prelude.Show, (forall x. DeleteFirewallRule -> Rep DeleteFirewallRule x)
-> (forall x. Rep DeleteFirewallRule x -> DeleteFirewallRule)
-> Generic DeleteFirewallRule
forall x. Rep DeleteFirewallRule x -> DeleteFirewallRule
forall x. DeleteFirewallRule -> Rep DeleteFirewallRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteFirewallRule x -> DeleteFirewallRule
$cfrom :: forall x. DeleteFirewallRule -> Rep DeleteFirewallRule x
Prelude.Generic)

-- |
-- Create a value of 'DeleteFirewallRule' 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', 'deleteFirewallRule_firewallRuleGroupId' - The unique identifier of the firewall rule group that you want to delete
-- the rule from.
--
-- 'firewallDomainListId', 'deleteFirewallRule_firewallDomainListId' - The ID of the domain list that\'s used in the rule.
newDeleteFirewallRule ::
  -- | 'firewallRuleGroupId'
  Prelude.Text ->
  -- | 'firewallDomainListId'
  Prelude.Text ->
  DeleteFirewallRule
newDeleteFirewallRule :: Text -> Text -> DeleteFirewallRule
newDeleteFirewallRule
  Text
pFirewallRuleGroupId_
  Text
pFirewallDomainListId_ =
    DeleteFirewallRule' :: Text -> Text -> DeleteFirewallRule
DeleteFirewallRule'
      { $sel:firewallRuleGroupId:DeleteFirewallRule' :: Text
firewallRuleGroupId =
          Text
pFirewallRuleGroupId_,
        $sel:firewallDomainListId:DeleteFirewallRule' :: Text
firewallDomainListId = Text
pFirewallDomainListId_
      }

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

-- | The ID of the domain list that\'s used in the rule.
deleteFirewallRule_firewallDomainListId :: Lens.Lens' DeleteFirewallRule Prelude.Text
deleteFirewallRule_firewallDomainListId :: (Text -> f Text) -> DeleteFirewallRule -> f DeleteFirewallRule
deleteFirewallRule_firewallDomainListId = (DeleteFirewallRule -> Text)
-> (DeleteFirewallRule -> Text -> DeleteFirewallRule)
-> Lens DeleteFirewallRule DeleteFirewallRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFirewallRule' {Text
firewallDomainListId :: Text
$sel:firewallDomainListId:DeleteFirewallRule' :: DeleteFirewallRule -> Text
firewallDomainListId} -> Text
firewallDomainListId) (\s :: DeleteFirewallRule
s@DeleteFirewallRule' {} Text
a -> DeleteFirewallRule
s {$sel:firewallDomainListId:DeleteFirewallRule' :: Text
firewallDomainListId = Text
a} :: DeleteFirewallRule)

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

instance Prelude.NFData DeleteFirewallRule

instance Core.ToHeaders DeleteFirewallRule where
  toHeaders :: DeleteFirewallRule -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteFirewallRule -> 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.DeleteFirewallRule" ::
                          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 DeleteFirewallRule where
  toJSON :: DeleteFirewallRule -> Value
toJSON DeleteFirewallRule' {Text
firewallDomainListId :: Text
firewallRuleGroupId :: Text
$sel:firewallDomainListId:DeleteFirewallRule' :: DeleteFirewallRule -> Text
$sel:firewallRuleGroupId:DeleteFirewallRule' :: DeleteFirewallRule -> 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),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"FirewallDomainListId"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
firewallDomainListId
              )
          ]
      )

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

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

-- | /See:/ 'newDeleteFirewallRuleResponse' smart constructor.
data DeleteFirewallRuleResponse = DeleteFirewallRuleResponse'
  { -- | The specification for the firewall rule that you just deleted.
    DeleteFirewallRuleResponse -> Maybe FirewallRule
firewallRule :: Prelude.Maybe FirewallRule,
    -- | The response's http status code.
    DeleteFirewallRuleResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteFirewallRuleResponse -> DeleteFirewallRuleResponse -> Bool
(DeleteFirewallRuleResponse -> DeleteFirewallRuleResponse -> Bool)
-> (DeleteFirewallRuleResponse
    -> DeleteFirewallRuleResponse -> Bool)
-> Eq DeleteFirewallRuleResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteFirewallRuleResponse -> DeleteFirewallRuleResponse -> Bool
$c/= :: DeleteFirewallRuleResponse -> DeleteFirewallRuleResponse -> Bool
== :: DeleteFirewallRuleResponse -> DeleteFirewallRuleResponse -> Bool
$c== :: DeleteFirewallRuleResponse -> DeleteFirewallRuleResponse -> Bool
Prelude.Eq, ReadPrec [DeleteFirewallRuleResponse]
ReadPrec DeleteFirewallRuleResponse
Int -> ReadS DeleteFirewallRuleResponse
ReadS [DeleteFirewallRuleResponse]
(Int -> ReadS DeleteFirewallRuleResponse)
-> ReadS [DeleteFirewallRuleResponse]
-> ReadPrec DeleteFirewallRuleResponse
-> ReadPrec [DeleteFirewallRuleResponse]
-> Read DeleteFirewallRuleResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteFirewallRuleResponse]
$creadListPrec :: ReadPrec [DeleteFirewallRuleResponse]
readPrec :: ReadPrec DeleteFirewallRuleResponse
$creadPrec :: ReadPrec DeleteFirewallRuleResponse
readList :: ReadS [DeleteFirewallRuleResponse]
$creadList :: ReadS [DeleteFirewallRuleResponse]
readsPrec :: Int -> ReadS DeleteFirewallRuleResponse
$creadsPrec :: Int -> ReadS DeleteFirewallRuleResponse
Prelude.Read, Int -> DeleteFirewallRuleResponse -> ShowS
[DeleteFirewallRuleResponse] -> ShowS
DeleteFirewallRuleResponse -> String
(Int -> DeleteFirewallRuleResponse -> ShowS)
-> (DeleteFirewallRuleResponse -> String)
-> ([DeleteFirewallRuleResponse] -> ShowS)
-> Show DeleteFirewallRuleResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteFirewallRuleResponse] -> ShowS
$cshowList :: [DeleteFirewallRuleResponse] -> ShowS
show :: DeleteFirewallRuleResponse -> String
$cshow :: DeleteFirewallRuleResponse -> String
showsPrec :: Int -> DeleteFirewallRuleResponse -> ShowS
$cshowsPrec :: Int -> DeleteFirewallRuleResponse -> ShowS
Prelude.Show, (forall x.
 DeleteFirewallRuleResponse -> Rep DeleteFirewallRuleResponse x)
-> (forall x.
    Rep DeleteFirewallRuleResponse x -> DeleteFirewallRuleResponse)
-> Generic DeleteFirewallRuleResponse
forall x.
Rep DeleteFirewallRuleResponse x -> DeleteFirewallRuleResponse
forall x.
DeleteFirewallRuleResponse -> Rep DeleteFirewallRuleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteFirewallRuleResponse x -> DeleteFirewallRuleResponse
$cfrom :: forall x.
DeleteFirewallRuleResponse -> Rep DeleteFirewallRuleResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteFirewallRuleResponse' 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:
--
-- 'firewallRule', 'deleteFirewallRuleResponse_firewallRule' - The specification for the firewall rule that you just deleted.
--
-- 'httpStatus', 'deleteFirewallRuleResponse_httpStatus' - The response's http status code.
newDeleteFirewallRuleResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteFirewallRuleResponse
newDeleteFirewallRuleResponse :: Int -> DeleteFirewallRuleResponse
newDeleteFirewallRuleResponse Int
pHttpStatus_ =
  DeleteFirewallRuleResponse' :: Maybe FirewallRule -> Int -> DeleteFirewallRuleResponse
DeleteFirewallRuleResponse'
    { $sel:firewallRule:DeleteFirewallRuleResponse' :: Maybe FirewallRule
firewallRule =
        Maybe FirewallRule
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteFirewallRuleResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The specification for the firewall rule that you just deleted.
deleteFirewallRuleResponse_firewallRule :: Lens.Lens' DeleteFirewallRuleResponse (Prelude.Maybe FirewallRule)
deleteFirewallRuleResponse_firewallRule :: (Maybe FirewallRule -> f (Maybe FirewallRule))
-> DeleteFirewallRuleResponse -> f DeleteFirewallRuleResponse
deleteFirewallRuleResponse_firewallRule = (DeleteFirewallRuleResponse -> Maybe FirewallRule)
-> (DeleteFirewallRuleResponse
    -> Maybe FirewallRule -> DeleteFirewallRuleResponse)
-> Lens
     DeleteFirewallRuleResponse
     DeleteFirewallRuleResponse
     (Maybe FirewallRule)
     (Maybe FirewallRule)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFirewallRuleResponse' {Maybe FirewallRule
firewallRule :: Maybe FirewallRule
$sel:firewallRule:DeleteFirewallRuleResponse' :: DeleteFirewallRuleResponse -> Maybe FirewallRule
firewallRule} -> Maybe FirewallRule
firewallRule) (\s :: DeleteFirewallRuleResponse
s@DeleteFirewallRuleResponse' {} Maybe FirewallRule
a -> DeleteFirewallRuleResponse
s {$sel:firewallRule:DeleteFirewallRuleResponse' :: Maybe FirewallRule
firewallRule = Maybe FirewallRule
a} :: DeleteFirewallRuleResponse)

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

instance Prelude.NFData DeleteFirewallRuleResponse