{-# 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-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)
--
-- 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.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:/ 'newGetFirewallRuleGroup' smart constructor.
data GetFirewallRuleGroup = GetFirewallRuleGroup'
  { -- | The unique identifier of the firewall rule group.
    GetFirewallRuleGroup -> Text
firewallRuleGroupId :: Prelude.Text
  }
  deriving (GetFirewallRuleGroup -> GetFirewallRuleGroup -> Bool
(GetFirewallRuleGroup -> GetFirewallRuleGroup -> Bool)
-> (GetFirewallRuleGroup -> GetFirewallRuleGroup -> Bool)
-> Eq GetFirewallRuleGroup
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]
(Int -> ReadS GetFirewallRuleGroup)
-> ReadS [GetFirewallRuleGroup]
-> ReadPrec GetFirewallRuleGroup
-> ReadPrec [GetFirewallRuleGroup]
-> Read 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
(Int -> GetFirewallRuleGroup -> ShowS)
-> (GetFirewallRuleGroup -> String)
-> ([GetFirewallRuleGroup] -> ShowS)
-> Show GetFirewallRuleGroup
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. GetFirewallRuleGroup -> Rep GetFirewallRuleGroup x)
-> (forall x. Rep GetFirewallRuleGroup x -> GetFirewallRuleGroup)
-> Generic GetFirewallRuleGroup
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' :: Text -> GetFirewallRuleGroup
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 :: (Text -> f Text) -> GetFirewallRuleGroup -> f GetFirewallRuleGroup
getFirewallRuleGroup_firewallRuleGroupId = (GetFirewallRuleGroup -> Text)
-> (GetFirewallRuleGroup -> Text -> GetFirewallRuleGroup)
-> Lens GetFirewallRuleGroup GetFirewallRuleGroup Text Text
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 :: GetFirewallRuleGroup -> Request GetFirewallRuleGroup
request = Service -> GetFirewallRuleGroup -> Request GetFirewallRuleGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetFirewallRuleGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetFirewallRuleGroup)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetFirewallRuleGroup))
-> Logger
-> Service
-> Proxy GetFirewallRuleGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetFirewallRuleGroup)))
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 -> GetFirewallRuleGroupResponse
GetFirewallRuleGroupResponse'
            (Maybe FirewallRuleGroup -> Int -> GetFirewallRuleGroupResponse)
-> Either String (Maybe FirewallRuleGroup)
-> Either String (Int -> GetFirewallRuleGroupResponse)
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 -> GetFirewallRuleGroupResponse)
-> Either String Int -> Either String GetFirewallRuleGroupResponse
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 GetFirewallRuleGroup

instance Prelude.NFData GetFirewallRuleGroup

instance Core.ToHeaders GetFirewallRuleGroup where
  toHeaders :: GetFirewallRuleGroup -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetFirewallRuleGroup -> 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.GetFirewallRuleGroup" ::
                          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 GetFirewallRuleGroup where
  toJSON :: GetFirewallRuleGroup -> Value
toJSON GetFirewallRuleGroup' {Text
firewallRuleGroupId :: Text
$sel:firewallRuleGroupId:GetFirewallRuleGroup' :: GetFirewallRuleGroup -> 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 GetFirewallRuleGroup where
  toPath :: GetFirewallRuleGroup -> ByteString
toPath = ByteString -> GetFirewallRuleGroup -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery GetFirewallRuleGroup where
  toQuery :: GetFirewallRuleGroup -> QueryString
toQuery = QueryString -> GetFirewallRuleGroup -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(GetFirewallRuleGroupResponse
 -> GetFirewallRuleGroupResponse -> Bool)
-> (GetFirewallRuleGroupResponse
    -> GetFirewallRuleGroupResponse -> Bool)
-> Eq GetFirewallRuleGroupResponse
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]
(Int -> ReadS GetFirewallRuleGroupResponse)
-> ReadS [GetFirewallRuleGroupResponse]
-> ReadPrec GetFirewallRuleGroupResponse
-> ReadPrec [GetFirewallRuleGroupResponse]
-> Read 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
(Int -> GetFirewallRuleGroupResponse -> ShowS)
-> (GetFirewallRuleGroupResponse -> String)
-> ([GetFirewallRuleGroupResponse] -> ShowS)
-> Show GetFirewallRuleGroupResponse
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.
 GetFirewallRuleGroupResponse -> Rep GetFirewallRuleGroupResponse x)
-> (forall x.
    Rep GetFirewallRuleGroupResponse x -> GetFirewallRuleGroupResponse)
-> Generic GetFirewallRuleGroupResponse
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' :: Maybe FirewallRuleGroup -> Int -> GetFirewallRuleGroupResponse
GetFirewallRuleGroupResponse'
    { $sel:firewallRuleGroup:GetFirewallRuleGroupResponse' :: Maybe FirewallRuleGroup
firewallRuleGroup =
        Maybe 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 :: (Maybe FirewallRuleGroup -> f (Maybe FirewallRuleGroup))
-> GetFirewallRuleGroupResponse -> f GetFirewallRuleGroupResponse
getFirewallRuleGroupResponse_firewallRuleGroup = (GetFirewallRuleGroupResponse -> Maybe FirewallRuleGroup)
-> (GetFirewallRuleGroupResponse
    -> Maybe FirewallRuleGroup -> GetFirewallRuleGroupResponse)
-> Lens
     GetFirewallRuleGroupResponse
     GetFirewallRuleGroupResponse
     (Maybe FirewallRuleGroup)
     (Maybe 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 :: (Int -> f Int)
-> GetFirewallRuleGroupResponse -> f GetFirewallRuleGroupResponse
getFirewallRuleGroupResponse_httpStatus = (GetFirewallRuleGroupResponse -> Int)
-> (GetFirewallRuleGroupResponse
    -> Int -> GetFirewallRuleGroupResponse)
-> Lens
     GetFirewallRuleGroupResponse GetFirewallRuleGroupResponse Int Int
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