{-# 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.DisassociateFirewallRuleGroup
-- 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)
--
-- Disassociates a FirewallRuleGroup from a VPC, to remove DNS filtering
-- from the VPC.
module Amazonka.Route53Resolver.DisassociateFirewallRuleGroup
  ( -- * Creating a Request
    DisassociateFirewallRuleGroup (..),
    newDisassociateFirewallRuleGroup,

    -- * Request Lenses
    disassociateFirewallRuleGroup_firewallRuleGroupAssociationId,

    -- * Destructuring the Response
    DisassociateFirewallRuleGroupResponse (..),
    newDisassociateFirewallRuleGroupResponse,

    -- * Response Lenses
    disassociateFirewallRuleGroupResponse_firewallRuleGroupAssociation,
    disassociateFirewallRuleGroupResponse_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:/ 'newDisassociateFirewallRuleGroup' smart constructor.
data DisassociateFirewallRuleGroup = DisassociateFirewallRuleGroup'
  { -- | The identifier of the FirewallRuleGroupAssociation.
    DisassociateFirewallRuleGroup -> Text
firewallRuleGroupAssociationId :: Prelude.Text
  }
  deriving (DisassociateFirewallRuleGroup
-> DisassociateFirewallRuleGroup -> Bool
(DisassociateFirewallRuleGroup
 -> DisassociateFirewallRuleGroup -> Bool)
-> (DisassociateFirewallRuleGroup
    -> DisassociateFirewallRuleGroup -> Bool)
-> Eq DisassociateFirewallRuleGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisassociateFirewallRuleGroup
-> DisassociateFirewallRuleGroup -> Bool
$c/= :: DisassociateFirewallRuleGroup
-> DisassociateFirewallRuleGroup -> Bool
== :: DisassociateFirewallRuleGroup
-> DisassociateFirewallRuleGroup -> Bool
$c== :: DisassociateFirewallRuleGroup
-> DisassociateFirewallRuleGroup -> Bool
Prelude.Eq, ReadPrec [DisassociateFirewallRuleGroup]
ReadPrec DisassociateFirewallRuleGroup
Int -> ReadS DisassociateFirewallRuleGroup
ReadS [DisassociateFirewallRuleGroup]
(Int -> ReadS DisassociateFirewallRuleGroup)
-> ReadS [DisassociateFirewallRuleGroup]
-> ReadPrec DisassociateFirewallRuleGroup
-> ReadPrec [DisassociateFirewallRuleGroup]
-> Read DisassociateFirewallRuleGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisassociateFirewallRuleGroup]
$creadListPrec :: ReadPrec [DisassociateFirewallRuleGroup]
readPrec :: ReadPrec DisassociateFirewallRuleGroup
$creadPrec :: ReadPrec DisassociateFirewallRuleGroup
readList :: ReadS [DisassociateFirewallRuleGroup]
$creadList :: ReadS [DisassociateFirewallRuleGroup]
readsPrec :: Int -> ReadS DisassociateFirewallRuleGroup
$creadsPrec :: Int -> ReadS DisassociateFirewallRuleGroup
Prelude.Read, Int -> DisassociateFirewallRuleGroup -> ShowS
[DisassociateFirewallRuleGroup] -> ShowS
DisassociateFirewallRuleGroup -> String
(Int -> DisassociateFirewallRuleGroup -> ShowS)
-> (DisassociateFirewallRuleGroup -> String)
-> ([DisassociateFirewallRuleGroup] -> ShowS)
-> Show DisassociateFirewallRuleGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisassociateFirewallRuleGroup] -> ShowS
$cshowList :: [DisassociateFirewallRuleGroup] -> ShowS
show :: DisassociateFirewallRuleGroup -> String
$cshow :: DisassociateFirewallRuleGroup -> String
showsPrec :: Int -> DisassociateFirewallRuleGroup -> ShowS
$cshowsPrec :: Int -> DisassociateFirewallRuleGroup -> ShowS
Prelude.Show, (forall x.
 DisassociateFirewallRuleGroup
 -> Rep DisassociateFirewallRuleGroup x)
-> (forall x.
    Rep DisassociateFirewallRuleGroup x
    -> DisassociateFirewallRuleGroup)
-> Generic DisassociateFirewallRuleGroup
forall x.
Rep DisassociateFirewallRuleGroup x
-> DisassociateFirewallRuleGroup
forall x.
DisassociateFirewallRuleGroup
-> Rep DisassociateFirewallRuleGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DisassociateFirewallRuleGroup x
-> DisassociateFirewallRuleGroup
$cfrom :: forall x.
DisassociateFirewallRuleGroup
-> Rep DisassociateFirewallRuleGroup x
Prelude.Generic)

-- |
-- Create a value of 'DisassociateFirewallRuleGroup' 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:
--
-- 'firewallRuleGroupAssociationId', 'disassociateFirewallRuleGroup_firewallRuleGroupAssociationId' - The identifier of the FirewallRuleGroupAssociation.
newDisassociateFirewallRuleGroup ::
  -- | 'firewallRuleGroupAssociationId'
  Prelude.Text ->
  DisassociateFirewallRuleGroup
newDisassociateFirewallRuleGroup :: Text -> DisassociateFirewallRuleGroup
newDisassociateFirewallRuleGroup
  Text
pFirewallRuleGroupAssociationId_ =
    DisassociateFirewallRuleGroup' :: Text -> DisassociateFirewallRuleGroup
DisassociateFirewallRuleGroup'
      { $sel:firewallRuleGroupAssociationId:DisassociateFirewallRuleGroup' :: Text
firewallRuleGroupAssociationId =
          Text
pFirewallRuleGroupAssociationId_
      }

-- | The identifier of the FirewallRuleGroupAssociation.
disassociateFirewallRuleGroup_firewallRuleGroupAssociationId :: Lens.Lens' DisassociateFirewallRuleGroup Prelude.Text
disassociateFirewallRuleGroup_firewallRuleGroupAssociationId :: (Text -> f Text)
-> DisassociateFirewallRuleGroup -> f DisassociateFirewallRuleGroup
disassociateFirewallRuleGroup_firewallRuleGroupAssociationId = (DisassociateFirewallRuleGroup -> Text)
-> (DisassociateFirewallRuleGroup
    -> Text -> DisassociateFirewallRuleGroup)
-> Lens
     DisassociateFirewallRuleGroup
     DisassociateFirewallRuleGroup
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateFirewallRuleGroup' {Text
firewallRuleGroupAssociationId :: Text
$sel:firewallRuleGroupAssociationId:DisassociateFirewallRuleGroup' :: DisassociateFirewallRuleGroup -> Text
firewallRuleGroupAssociationId} -> Text
firewallRuleGroupAssociationId) (\s :: DisassociateFirewallRuleGroup
s@DisassociateFirewallRuleGroup' {} Text
a -> DisassociateFirewallRuleGroup
s {$sel:firewallRuleGroupAssociationId:DisassociateFirewallRuleGroup' :: Text
firewallRuleGroupAssociationId = Text
a} :: DisassociateFirewallRuleGroup)

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

instance Prelude.NFData DisassociateFirewallRuleGroup

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

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

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

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

-- |
-- Create a value of 'DisassociateFirewallRuleGroupResponse' 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:
--
-- 'firewallRuleGroupAssociation', 'disassociateFirewallRuleGroupResponse_firewallRuleGroupAssociation' - The firewall rule group association that you just removed.
--
-- 'httpStatus', 'disassociateFirewallRuleGroupResponse_httpStatus' - The response's http status code.
newDisassociateFirewallRuleGroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DisassociateFirewallRuleGroupResponse
newDisassociateFirewallRuleGroupResponse :: Int -> DisassociateFirewallRuleGroupResponse
newDisassociateFirewallRuleGroupResponse Int
pHttpStatus_ =
  DisassociateFirewallRuleGroupResponse' :: Maybe FirewallRuleGroupAssociation
-> Int -> DisassociateFirewallRuleGroupResponse
DisassociateFirewallRuleGroupResponse'
    { $sel:firewallRuleGroupAssociation:DisassociateFirewallRuleGroupResponse' :: Maybe FirewallRuleGroupAssociation
firewallRuleGroupAssociation =
        Maybe FirewallRuleGroupAssociation
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DisassociateFirewallRuleGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The firewall rule group association that you just removed.
disassociateFirewallRuleGroupResponse_firewallRuleGroupAssociation :: Lens.Lens' DisassociateFirewallRuleGroupResponse (Prelude.Maybe FirewallRuleGroupAssociation)
disassociateFirewallRuleGroupResponse_firewallRuleGroupAssociation :: (Maybe FirewallRuleGroupAssociation
 -> f (Maybe FirewallRuleGroupAssociation))
-> DisassociateFirewallRuleGroupResponse
-> f DisassociateFirewallRuleGroupResponse
disassociateFirewallRuleGroupResponse_firewallRuleGroupAssociation = (DisassociateFirewallRuleGroupResponse
 -> Maybe FirewallRuleGroupAssociation)
-> (DisassociateFirewallRuleGroupResponse
    -> Maybe FirewallRuleGroupAssociation
    -> DisassociateFirewallRuleGroupResponse)
-> Lens
     DisassociateFirewallRuleGroupResponse
     DisassociateFirewallRuleGroupResponse
     (Maybe FirewallRuleGroupAssociation)
     (Maybe FirewallRuleGroupAssociation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateFirewallRuleGroupResponse' {Maybe FirewallRuleGroupAssociation
firewallRuleGroupAssociation :: Maybe FirewallRuleGroupAssociation
$sel:firewallRuleGroupAssociation:DisassociateFirewallRuleGroupResponse' :: DisassociateFirewallRuleGroupResponse
-> Maybe FirewallRuleGroupAssociation
firewallRuleGroupAssociation} -> Maybe FirewallRuleGroupAssociation
firewallRuleGroupAssociation) (\s :: DisassociateFirewallRuleGroupResponse
s@DisassociateFirewallRuleGroupResponse' {} Maybe FirewallRuleGroupAssociation
a -> DisassociateFirewallRuleGroupResponse
s {$sel:firewallRuleGroupAssociation:DisassociateFirewallRuleGroupResponse' :: Maybe FirewallRuleGroupAssociation
firewallRuleGroupAssociation = Maybe FirewallRuleGroupAssociation
a} :: DisassociateFirewallRuleGroupResponse)

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

instance
  Prelude.NFData
    DisassociateFirewallRuleGroupResponse