{-# 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-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 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.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:/ 'newGetFirewallDomainList' smart constructor.
data GetFirewallDomainList = GetFirewallDomainList'
  { -- | The ID of the domain list.
    GetFirewallDomainList -> Text
firewallDomainListId :: Prelude.Text
  }
  deriving (GetFirewallDomainList -> GetFirewallDomainList -> Bool
(GetFirewallDomainList -> GetFirewallDomainList -> Bool)
-> (GetFirewallDomainList -> GetFirewallDomainList -> Bool)
-> Eq GetFirewallDomainList
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]
(Int -> ReadS GetFirewallDomainList)
-> ReadS [GetFirewallDomainList]
-> ReadPrec GetFirewallDomainList
-> ReadPrec [GetFirewallDomainList]
-> Read 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
(Int -> GetFirewallDomainList -> ShowS)
-> (GetFirewallDomainList -> String)
-> ([GetFirewallDomainList] -> ShowS)
-> Show GetFirewallDomainList
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. GetFirewallDomainList -> Rep GetFirewallDomainList x)
-> (forall x. Rep GetFirewallDomainList x -> GetFirewallDomainList)
-> Generic GetFirewallDomainList
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' :: Text -> GetFirewallDomainList
GetFirewallDomainList'
    { $sel:firewallDomainListId:GetFirewallDomainList' :: Text
firewallDomainListId =
        Text
pFirewallDomainListId_
    }

-- | The ID of the domain list.
getFirewallDomainList_firewallDomainListId :: Lens.Lens' GetFirewallDomainList Prelude.Text
getFirewallDomainList_firewallDomainListId :: (Text -> f Text)
-> GetFirewallDomainList -> f GetFirewallDomainList
getFirewallDomainList_firewallDomainListId = (GetFirewallDomainList -> Text)
-> (GetFirewallDomainList -> Text -> GetFirewallDomainList)
-> Lens GetFirewallDomainList GetFirewallDomainList Text Text
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 :: GetFirewallDomainList -> Request GetFirewallDomainList
request = Service -> GetFirewallDomainList -> Request GetFirewallDomainList
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetFirewallDomainList
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetFirewallDomainList)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetFirewallDomainList))
-> Logger
-> Service
-> Proxy GetFirewallDomainList
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetFirewallDomainList)))
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 FirewallDomainList -> Int -> GetFirewallDomainListResponse
GetFirewallDomainListResponse'
            (Maybe FirewallDomainList -> Int -> GetFirewallDomainListResponse)
-> Either String (Maybe FirewallDomainList)
-> Either String (Int -> GetFirewallDomainListResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe FirewallDomainList)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"FirewallDomainList")
            Either String (Int -> GetFirewallDomainListResponse)
-> Either String Int -> Either String GetFirewallDomainListResponse
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 GetFirewallDomainList

instance Prelude.NFData GetFirewallDomainList

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

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

instance Core.ToQuery GetFirewallDomainList where
  toQuery :: GetFirewallDomainList -> QueryString
toQuery = QueryString -> GetFirewallDomainList -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(GetFirewallDomainListResponse
 -> GetFirewallDomainListResponse -> Bool)
-> (GetFirewallDomainListResponse
    -> GetFirewallDomainListResponse -> Bool)
-> Eq GetFirewallDomainListResponse
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]
(Int -> ReadS GetFirewallDomainListResponse)
-> ReadS [GetFirewallDomainListResponse]
-> ReadPrec GetFirewallDomainListResponse
-> ReadPrec [GetFirewallDomainListResponse]
-> Read 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
(Int -> GetFirewallDomainListResponse -> ShowS)
-> (GetFirewallDomainListResponse -> String)
-> ([GetFirewallDomainListResponse] -> ShowS)
-> Show GetFirewallDomainListResponse
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.
 GetFirewallDomainListResponse
 -> Rep GetFirewallDomainListResponse x)
-> (forall x.
    Rep GetFirewallDomainListResponse x
    -> GetFirewallDomainListResponse)
-> Generic GetFirewallDomainListResponse
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' :: Maybe FirewallDomainList -> Int -> GetFirewallDomainListResponse
GetFirewallDomainListResponse'
    { $sel:firewallDomainList:GetFirewallDomainListResponse' :: Maybe FirewallDomainList
firewallDomainList =
        Maybe 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 :: (Maybe FirewallDomainList -> f (Maybe FirewallDomainList))
-> GetFirewallDomainListResponse -> f GetFirewallDomainListResponse
getFirewallDomainListResponse_firewallDomainList = (GetFirewallDomainListResponse -> Maybe FirewallDomainList)
-> (GetFirewallDomainListResponse
    -> Maybe FirewallDomainList -> GetFirewallDomainListResponse)
-> Lens
     GetFirewallDomainListResponse
     GetFirewallDomainListResponse
     (Maybe FirewallDomainList)
     (Maybe 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 :: (Int -> f Int)
-> GetFirewallDomainListResponse -> f GetFirewallDomainListResponse
getFirewallDomainListResponse_httpStatus = (GetFirewallDomainListResponse -> Int)
-> (GetFirewallDomainListResponse
    -> Int -> GetFirewallDomainListResponse)
-> Lens
     GetFirewallDomainListResponse GetFirewallDomainListResponse Int Int
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