{-# 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.GetFirewallDomainList
-- 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 domain list.
module Amazonka.Route53Resolver.GetFirewallDomainList
  ( -- * Creating a Request
    GetFirewallDomainList (..),
    newGetFirewallDomainList,

    -- * Request Lenses
    getFirewallDomainList_firewallDomainListId,

    -- * Destructuring the Response
    GetFirewallDomainListResponse (..),
    newGetFirewallDomainListResponse,

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

-- |
-- Create a value of 'GetFirewallDomainList' 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:
--
-- 'firewallDomainListId', 'getFirewallDomainList_firewallDomainListId' - The ID of the domain list.
newGetFirewallDomainList ::
  -- | 'firewallDomainListId'
  Prelude.Text ->
  GetFirewallDomainList
newGetFirewallDomainList :: Text -> GetFirewallDomainList
newGetFirewallDomainList Text
pFirewallDomainListId_ =
  GetFirewallDomainList'
    { $sel:firewallDomainListId:GetFirewallDomainList' :: Text
firewallDomainListId =
        Text
pFirewallDomainListId_
    }

-- | The ID of the domain list.
getFirewallDomainList_firewallDomainListId :: Lens.Lens' GetFirewallDomainList Prelude.Text
getFirewallDomainList_firewallDomainListId :: Lens' GetFirewallDomainList Text
getFirewallDomainList_firewallDomainListId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFirewallDomainList' {Text
firewallDomainListId :: Text
$sel:firewallDomainListId:GetFirewallDomainList' :: GetFirewallDomainList -> Text
firewallDomainListId} -> Text
firewallDomainListId) (\s :: GetFirewallDomainList
s@GetFirewallDomainList' {} Text
a -> GetFirewallDomainList
s {$sel:firewallDomainListId:GetFirewallDomainList' :: Text
firewallDomainListId = Text
a} :: GetFirewallDomainList)

instance Core.AWSRequest GetFirewallDomainList where
  type
    AWSResponse GetFirewallDomainList =
      GetFirewallDomainListResponse
  request :: (Service -> Service)
-> GetFirewallDomainList -> Request GetFirewallDomainList
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 GetFirewallDomainList
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetFirewallDomainList)))
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 FirewallDomainList -> Int -> GetFirewallDomainListResponse
GetFirewallDomainListResponse'
            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
"FirewallDomainList")
            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 GetFirewallDomainList where
  hashWithSalt :: Int -> GetFirewallDomainList -> Int
hashWithSalt Int
_salt GetFirewallDomainList' {Text
firewallDomainListId :: Text
$sel:firewallDomainListId:GetFirewallDomainList' :: GetFirewallDomainList -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
firewallDomainListId

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

instance Data.ToHeaders GetFirewallDomainList where
  toHeaders :: GetFirewallDomainList -> 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.GetFirewallDomainList" ::
                          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 GetFirewallDomainList where
  toJSON :: GetFirewallDomainList -> Value
toJSON GetFirewallDomainList' {Text
firewallDomainListId :: Text
$sel:firewallDomainListId:GetFirewallDomainList' :: GetFirewallDomainList -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              ( Key
"FirewallDomainListId"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
firewallDomainListId
              )
          ]
      )

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

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

-- | /See:/ 'newGetFirewallDomainListResponse' smart constructor.
data GetFirewallDomainListResponse = GetFirewallDomainListResponse'
  { -- | The domain list that you requested.
    GetFirewallDomainListResponse -> Maybe FirewallDomainList
firewallDomainList :: Prelude.Maybe FirewallDomainList,
    -- | The response's http status code.
    GetFirewallDomainListResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetFirewallDomainListResponse
-> GetFirewallDomainListResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetFirewallDomainListResponse
-> GetFirewallDomainListResponse -> Bool
$c/= :: GetFirewallDomainListResponse
-> GetFirewallDomainListResponse -> Bool
== :: GetFirewallDomainListResponse
-> GetFirewallDomainListResponse -> Bool
$c== :: GetFirewallDomainListResponse
-> GetFirewallDomainListResponse -> Bool
Prelude.Eq, ReadPrec [GetFirewallDomainListResponse]
ReadPrec GetFirewallDomainListResponse
Int -> ReadS GetFirewallDomainListResponse
ReadS [GetFirewallDomainListResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetFirewallDomainListResponse]
$creadListPrec :: ReadPrec [GetFirewallDomainListResponse]
readPrec :: ReadPrec GetFirewallDomainListResponse
$creadPrec :: ReadPrec GetFirewallDomainListResponse
readList :: ReadS [GetFirewallDomainListResponse]
$creadList :: ReadS [GetFirewallDomainListResponse]
readsPrec :: Int -> ReadS GetFirewallDomainListResponse
$creadsPrec :: Int -> ReadS GetFirewallDomainListResponse
Prelude.Read, Int -> GetFirewallDomainListResponse -> ShowS
[GetFirewallDomainListResponse] -> ShowS
GetFirewallDomainListResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetFirewallDomainListResponse] -> ShowS
$cshowList :: [GetFirewallDomainListResponse] -> ShowS
show :: GetFirewallDomainListResponse -> String
$cshow :: GetFirewallDomainListResponse -> String
showsPrec :: Int -> GetFirewallDomainListResponse -> ShowS
$cshowsPrec :: Int -> GetFirewallDomainListResponse -> ShowS
Prelude.Show, forall x.
Rep GetFirewallDomainListResponse x
-> GetFirewallDomainListResponse
forall x.
GetFirewallDomainListResponse
-> Rep GetFirewallDomainListResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetFirewallDomainListResponse x
-> GetFirewallDomainListResponse
$cfrom :: forall x.
GetFirewallDomainListResponse
-> Rep GetFirewallDomainListResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetFirewallDomainListResponse' 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:
--
-- 'firewallDomainList', 'getFirewallDomainListResponse_firewallDomainList' - The domain list that you requested.
--
-- 'httpStatus', 'getFirewallDomainListResponse_httpStatus' - The response's http status code.
newGetFirewallDomainListResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetFirewallDomainListResponse
newGetFirewallDomainListResponse :: Int -> GetFirewallDomainListResponse
newGetFirewallDomainListResponse Int
pHttpStatus_ =
  GetFirewallDomainListResponse'
    { $sel:firewallDomainList:GetFirewallDomainListResponse' :: Maybe FirewallDomainList
firewallDomainList =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetFirewallDomainListResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The domain list that you requested.
getFirewallDomainListResponse_firewallDomainList :: Lens.Lens' GetFirewallDomainListResponse (Prelude.Maybe FirewallDomainList)
getFirewallDomainListResponse_firewallDomainList :: Lens' GetFirewallDomainListResponse (Maybe FirewallDomainList)
getFirewallDomainListResponse_firewallDomainList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFirewallDomainListResponse' {Maybe FirewallDomainList
firewallDomainList :: Maybe FirewallDomainList
$sel:firewallDomainList:GetFirewallDomainListResponse' :: GetFirewallDomainListResponse -> Maybe FirewallDomainList
firewallDomainList} -> Maybe FirewallDomainList
firewallDomainList) (\s :: GetFirewallDomainListResponse
s@GetFirewallDomainListResponse' {} Maybe FirewallDomainList
a -> GetFirewallDomainListResponse
s {$sel:firewallDomainList:GetFirewallDomainListResponse' :: Maybe FirewallDomainList
firewallDomainList = Maybe FirewallDomainList
a} :: GetFirewallDomainListResponse)

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

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