{-# 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.GetFirewallRuleGroup
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves the specified firewall rule group.
module Amazonka.Route53Resolver.GetFirewallRuleGroup
  ( -- * Creating a Request
    GetFirewallRuleGroup (..),
    newGetFirewallRuleGroup,

    -- * Request Lenses
    getFirewallRuleGroup_firewallRuleGroupId,

    -- * Destructuring the Response
    GetFirewallRuleGroupResponse (..),
    newGetFirewallRuleGroupResponse,

    -- * Response Lenses
    getFirewallRuleGroupResponse_firewallRuleGroup,
    getFirewallRuleGroupResponse_httpStatus,
  )
where

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

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

-- |
-- Create a value of 'GetFirewallRuleGroup' 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', 'getFirewallRuleGroup_firewallRuleGroupId' - The unique identifier of the firewall rule group.
newGetFirewallRuleGroup ::
  -- | 'firewallRuleGroupId'
  Prelude.Text ->
  GetFirewallRuleGroup
newGetFirewallRuleGroup :: Text -> GetFirewallRuleGroup
newGetFirewallRuleGroup Text
pFirewallRuleGroupId_ =
  GetFirewallRuleGroup'
    { $sel:firewallRuleGroupId:GetFirewallRuleGroup' :: Text
firewallRuleGroupId =
        Text
pFirewallRuleGroupId_
    }

-- | The unique identifier of the firewall rule group.
getFirewallRuleGroup_firewallRuleGroupId :: Lens.Lens' GetFirewallRuleGroup Prelude.Text
getFirewallRuleGroup_firewallRuleGroupId :: Lens' GetFirewallRuleGroup Text
getFirewallRuleGroup_firewallRuleGroupId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFirewallRuleGroup' {Text
firewallRuleGroupId :: Text
$sel:firewallRuleGroupId:GetFirewallRuleGroup' :: GetFirewallRuleGroup -> Text
firewallRuleGroupId} -> Text
firewallRuleGroupId) (\s :: GetFirewallRuleGroup
s@GetFirewallRuleGroup' {} Text
a -> GetFirewallRuleGroup
s {$sel:firewallRuleGroupId:GetFirewallRuleGroup' :: Text
firewallRuleGroupId = Text
a} :: GetFirewallRuleGroup)

instance Core.AWSRequest GetFirewallRuleGroup where
  type
    AWSResponse GetFirewallRuleGroup =
      GetFirewallRuleGroupResponse
  request :: (Service -> Service)
-> GetFirewallRuleGroup -> Request GetFirewallRuleGroup
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetFirewallRuleGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetFirewallRuleGroup)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe FirewallRuleGroup -> Int -> GetFirewallRuleGroupResponse
GetFirewallRuleGroupResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"FirewallRuleGroup")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable GetFirewallRuleGroup where
  hashWithSalt :: Int -> GetFirewallRuleGroup -> Int
hashWithSalt Int
_salt GetFirewallRuleGroup' {Text
firewallRuleGroupId :: Text
$sel:firewallRuleGroupId:GetFirewallRuleGroup' :: GetFirewallRuleGroup -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
firewallRuleGroupId

instance Prelude.NFData GetFirewallRuleGroup where
  rnf :: GetFirewallRuleGroup -> ()
rnf GetFirewallRuleGroup' {Text
firewallRuleGroupId :: Text
$sel:firewallRuleGroupId:GetFirewallRuleGroup' :: GetFirewallRuleGroup -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
firewallRuleGroupId

instance Data.ToHeaders GetFirewallRuleGroup where
  toHeaders :: GetFirewallRuleGroup -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"Route53Resolver.GetFirewallRuleGroup" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON GetFirewallRuleGroup where
  toJSON :: GetFirewallRuleGroup -> Value
toJSON GetFirewallRuleGroup' {Text
firewallRuleGroupId :: Text
$sel:firewallRuleGroupId:GetFirewallRuleGroup' :: GetFirewallRuleGroup -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"FirewallRuleGroupId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
firewallRuleGroupId)
          ]
      )

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

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

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

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

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

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

instance Prelude.NFData GetFirewallRuleGroupResponse where
  rnf :: GetFirewallRuleGroupResponse -> ()
rnf GetFirewallRuleGroupResponse' {Int
Maybe FirewallRuleGroup
httpStatus :: Int
firewallRuleGroup :: Maybe FirewallRuleGroup
$sel:httpStatus:GetFirewallRuleGroupResponse' :: GetFirewallRuleGroupResponse -> Int
$sel:firewallRuleGroup:GetFirewallRuleGroupResponse' :: GetFirewallRuleGroupResponse -> Maybe FirewallRuleGroup
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe FirewallRuleGroup
firewallRuleGroup
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus