{-# 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.Route53.ListQueryLoggingConfigs
-- 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)
--
-- Lists the configurations for DNS query logging that are associated with
-- the current Amazon Web Services account or the configuration that is
-- associated with a specified hosted zone.
--
-- For more information about DNS query logs, see
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_CreateQueryLoggingConfig.html CreateQueryLoggingConfig>.
-- Additional information, including the format of DNS query logs, appears
-- in
-- <https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/query-logs.html Logging DNS Queries>
-- in the /Amazon Route 53 Developer Guide/.
--
-- This operation returns paginated results.
module Amazonka.Route53.ListQueryLoggingConfigs
  ( -- * Creating a Request
    ListQueryLoggingConfigs (..),
    newListQueryLoggingConfigs,

    -- * Request Lenses
    listQueryLoggingConfigs_hostedZoneId,
    listQueryLoggingConfigs_nextToken,
    listQueryLoggingConfigs_maxResults,

    -- * Destructuring the Response
    ListQueryLoggingConfigsResponse (..),
    newListQueryLoggingConfigsResponse,

    -- * Response Lenses
    listQueryLoggingConfigsResponse_nextToken,
    listQueryLoggingConfigsResponse_httpStatus,
    listQueryLoggingConfigsResponse_queryLoggingConfigs,
  )
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.Route53.Types

-- | /See:/ 'newListQueryLoggingConfigs' smart constructor.
data ListQueryLoggingConfigs = ListQueryLoggingConfigs'
  { -- | (Optional) If you want to list the query logging configuration that is
    -- associated with a hosted zone, specify the ID in @HostedZoneId@.
    --
    -- If you don\'t specify a hosted zone ID, @ListQueryLoggingConfigs@
    -- returns all of the configurations that are associated with the current
    -- Amazon Web Services account.
    ListQueryLoggingConfigs -> Maybe ResourceId
hostedZoneId :: Prelude.Maybe ResourceId,
    -- | (Optional) If the current Amazon Web Services account has more than
    -- @MaxResults@ query logging configurations, use @NextToken@ to get the
    -- second and subsequent pages of results.
    --
    -- For the first @ListQueryLoggingConfigs@ request, omit this value.
    --
    -- For the second and subsequent requests, get the value of @NextToken@
    -- from the previous response and specify that value for @NextToken@ in the
    -- request.
    ListQueryLoggingConfigs -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | (Optional) The maximum number of query logging configurations that you
    -- want Amazon Route 53 to return in response to the current request. If
    -- the current Amazon Web Services account has more than @MaxResults@
    -- configurations, use the value of
    -- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_ListQueryLoggingConfigs.html#API_ListQueryLoggingConfigs_RequestSyntax NextToken>
    -- in the response to get the next page of results.
    --
    -- If you don\'t specify a value for @MaxResults@, Route 53 returns up to
    -- 100 configurations.
    ListQueryLoggingConfigs -> Maybe Text
maxResults :: Prelude.Maybe Prelude.Text
  }
  deriving (ListQueryLoggingConfigs -> ListQueryLoggingConfigs -> Bool
(ListQueryLoggingConfigs -> ListQueryLoggingConfigs -> Bool)
-> (ListQueryLoggingConfigs -> ListQueryLoggingConfigs -> Bool)
-> Eq ListQueryLoggingConfigs
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListQueryLoggingConfigs -> ListQueryLoggingConfigs -> Bool
$c/= :: ListQueryLoggingConfigs -> ListQueryLoggingConfigs -> Bool
== :: ListQueryLoggingConfigs -> ListQueryLoggingConfigs -> Bool
$c== :: ListQueryLoggingConfigs -> ListQueryLoggingConfigs -> Bool
Prelude.Eq, ReadPrec [ListQueryLoggingConfigs]
ReadPrec ListQueryLoggingConfigs
Int -> ReadS ListQueryLoggingConfigs
ReadS [ListQueryLoggingConfigs]
(Int -> ReadS ListQueryLoggingConfigs)
-> ReadS [ListQueryLoggingConfigs]
-> ReadPrec ListQueryLoggingConfigs
-> ReadPrec [ListQueryLoggingConfigs]
-> Read ListQueryLoggingConfigs
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListQueryLoggingConfigs]
$creadListPrec :: ReadPrec [ListQueryLoggingConfigs]
readPrec :: ReadPrec ListQueryLoggingConfigs
$creadPrec :: ReadPrec ListQueryLoggingConfigs
readList :: ReadS [ListQueryLoggingConfigs]
$creadList :: ReadS [ListQueryLoggingConfigs]
readsPrec :: Int -> ReadS ListQueryLoggingConfigs
$creadsPrec :: Int -> ReadS ListQueryLoggingConfigs
Prelude.Read, Int -> ListQueryLoggingConfigs -> ShowS
[ListQueryLoggingConfigs] -> ShowS
ListQueryLoggingConfigs -> String
(Int -> ListQueryLoggingConfigs -> ShowS)
-> (ListQueryLoggingConfigs -> String)
-> ([ListQueryLoggingConfigs] -> ShowS)
-> Show ListQueryLoggingConfigs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListQueryLoggingConfigs] -> ShowS
$cshowList :: [ListQueryLoggingConfigs] -> ShowS
show :: ListQueryLoggingConfigs -> String
$cshow :: ListQueryLoggingConfigs -> String
showsPrec :: Int -> ListQueryLoggingConfigs -> ShowS
$cshowsPrec :: Int -> ListQueryLoggingConfigs -> ShowS
Prelude.Show, (forall x.
 ListQueryLoggingConfigs -> Rep ListQueryLoggingConfigs x)
-> (forall x.
    Rep ListQueryLoggingConfigs x -> ListQueryLoggingConfigs)
-> Generic ListQueryLoggingConfigs
forall x. Rep ListQueryLoggingConfigs x -> ListQueryLoggingConfigs
forall x. ListQueryLoggingConfigs -> Rep ListQueryLoggingConfigs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListQueryLoggingConfigs x -> ListQueryLoggingConfigs
$cfrom :: forall x. ListQueryLoggingConfigs -> Rep ListQueryLoggingConfigs x
Prelude.Generic)

-- |
-- Create a value of 'ListQueryLoggingConfigs' 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:
--
-- 'hostedZoneId', 'listQueryLoggingConfigs_hostedZoneId' - (Optional) If you want to list the query logging configuration that is
-- associated with a hosted zone, specify the ID in @HostedZoneId@.
--
-- If you don\'t specify a hosted zone ID, @ListQueryLoggingConfigs@
-- returns all of the configurations that are associated with the current
-- Amazon Web Services account.
--
-- 'nextToken', 'listQueryLoggingConfigs_nextToken' - (Optional) If the current Amazon Web Services account has more than
-- @MaxResults@ query logging configurations, use @NextToken@ to get the
-- second and subsequent pages of results.
--
-- For the first @ListQueryLoggingConfigs@ request, omit this value.
--
-- For the second and subsequent requests, get the value of @NextToken@
-- from the previous response and specify that value for @NextToken@ in the
-- request.
--
-- 'maxResults', 'listQueryLoggingConfigs_maxResults' - (Optional) The maximum number of query logging configurations that you
-- want Amazon Route 53 to return in response to the current request. If
-- the current Amazon Web Services account has more than @MaxResults@
-- configurations, use the value of
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_ListQueryLoggingConfigs.html#API_ListQueryLoggingConfigs_RequestSyntax NextToken>
-- in the response to get the next page of results.
--
-- If you don\'t specify a value for @MaxResults@, Route 53 returns up to
-- 100 configurations.
newListQueryLoggingConfigs ::
  ListQueryLoggingConfigs
newListQueryLoggingConfigs :: ListQueryLoggingConfigs
newListQueryLoggingConfigs =
  ListQueryLoggingConfigs' :: Maybe ResourceId
-> Maybe Text -> Maybe Text -> ListQueryLoggingConfigs
ListQueryLoggingConfigs'
    { $sel:hostedZoneId:ListQueryLoggingConfigs' :: Maybe ResourceId
hostedZoneId =
        Maybe ResourceId
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListQueryLoggingConfigs' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListQueryLoggingConfigs' :: Maybe Text
maxResults = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | (Optional) If you want to list the query logging configuration that is
-- associated with a hosted zone, specify the ID in @HostedZoneId@.
--
-- If you don\'t specify a hosted zone ID, @ListQueryLoggingConfigs@
-- returns all of the configurations that are associated with the current
-- Amazon Web Services account.
listQueryLoggingConfigs_hostedZoneId :: Lens.Lens' ListQueryLoggingConfigs (Prelude.Maybe ResourceId)
listQueryLoggingConfigs_hostedZoneId :: (Maybe ResourceId -> f (Maybe ResourceId))
-> ListQueryLoggingConfigs -> f ListQueryLoggingConfigs
listQueryLoggingConfigs_hostedZoneId = (ListQueryLoggingConfigs -> Maybe ResourceId)
-> (ListQueryLoggingConfigs
    -> Maybe ResourceId -> ListQueryLoggingConfigs)
-> Lens
     ListQueryLoggingConfigs
     ListQueryLoggingConfigs
     (Maybe ResourceId)
     (Maybe ResourceId)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListQueryLoggingConfigs' {Maybe ResourceId
hostedZoneId :: Maybe ResourceId
$sel:hostedZoneId:ListQueryLoggingConfigs' :: ListQueryLoggingConfigs -> Maybe ResourceId
hostedZoneId} -> Maybe ResourceId
hostedZoneId) (\s :: ListQueryLoggingConfigs
s@ListQueryLoggingConfigs' {} Maybe ResourceId
a -> ListQueryLoggingConfigs
s {$sel:hostedZoneId:ListQueryLoggingConfigs' :: Maybe ResourceId
hostedZoneId = Maybe ResourceId
a} :: ListQueryLoggingConfigs)

-- | (Optional) If the current Amazon Web Services account has more than
-- @MaxResults@ query logging configurations, use @NextToken@ to get the
-- second and subsequent pages of results.
--
-- For the first @ListQueryLoggingConfigs@ request, omit this value.
--
-- For the second and subsequent requests, get the value of @NextToken@
-- from the previous response and specify that value for @NextToken@ in the
-- request.
listQueryLoggingConfigs_nextToken :: Lens.Lens' ListQueryLoggingConfigs (Prelude.Maybe Prelude.Text)
listQueryLoggingConfigs_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListQueryLoggingConfigs -> f ListQueryLoggingConfigs
listQueryLoggingConfigs_nextToken = (ListQueryLoggingConfigs -> Maybe Text)
-> (ListQueryLoggingConfigs
    -> Maybe Text -> ListQueryLoggingConfigs)
-> Lens
     ListQueryLoggingConfigs
     ListQueryLoggingConfigs
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListQueryLoggingConfigs' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListQueryLoggingConfigs' :: ListQueryLoggingConfigs -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListQueryLoggingConfigs
s@ListQueryLoggingConfigs' {} Maybe Text
a -> ListQueryLoggingConfigs
s {$sel:nextToken:ListQueryLoggingConfigs' :: Maybe Text
nextToken = Maybe Text
a} :: ListQueryLoggingConfigs)

-- | (Optional) The maximum number of query logging configurations that you
-- want Amazon Route 53 to return in response to the current request. If
-- the current Amazon Web Services account has more than @MaxResults@
-- configurations, use the value of
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_ListQueryLoggingConfigs.html#API_ListQueryLoggingConfigs_RequestSyntax NextToken>
-- in the response to get the next page of results.
--
-- If you don\'t specify a value for @MaxResults@, Route 53 returns up to
-- 100 configurations.
listQueryLoggingConfigs_maxResults :: Lens.Lens' ListQueryLoggingConfigs (Prelude.Maybe Prelude.Text)
listQueryLoggingConfigs_maxResults :: (Maybe Text -> f (Maybe Text))
-> ListQueryLoggingConfigs -> f ListQueryLoggingConfigs
listQueryLoggingConfigs_maxResults = (ListQueryLoggingConfigs -> Maybe Text)
-> (ListQueryLoggingConfigs
    -> Maybe Text -> ListQueryLoggingConfigs)
-> Lens
     ListQueryLoggingConfigs
     ListQueryLoggingConfigs
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListQueryLoggingConfigs' {Maybe Text
maxResults :: Maybe Text
$sel:maxResults:ListQueryLoggingConfigs' :: ListQueryLoggingConfigs -> Maybe Text
maxResults} -> Maybe Text
maxResults) (\s :: ListQueryLoggingConfigs
s@ListQueryLoggingConfigs' {} Maybe Text
a -> ListQueryLoggingConfigs
s {$sel:maxResults:ListQueryLoggingConfigs' :: Maybe Text
maxResults = Maybe Text
a} :: ListQueryLoggingConfigs)

instance Core.AWSPager ListQueryLoggingConfigs where
  page :: ListQueryLoggingConfigs
-> AWSResponse ListQueryLoggingConfigs
-> Maybe ListQueryLoggingConfigs
page ListQueryLoggingConfigs
rq AWSResponse ListQueryLoggingConfigs
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListQueryLoggingConfigs
ListQueryLoggingConfigsResponse
rs
            ListQueryLoggingConfigsResponse
-> Getting (First Text) ListQueryLoggingConfigsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListQueryLoggingConfigsResponse
-> Const (First Text) ListQueryLoggingConfigsResponse
Lens' ListQueryLoggingConfigsResponse (Maybe Text)
listQueryLoggingConfigsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListQueryLoggingConfigsResponse
 -> Const (First Text) ListQueryLoggingConfigsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListQueryLoggingConfigsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListQueryLoggingConfigs
forall a. Maybe a
Prelude.Nothing
    | [QueryLoggingConfig] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListQueryLoggingConfigs
ListQueryLoggingConfigsResponse
rs
            ListQueryLoggingConfigsResponse
-> Getting
     [QueryLoggingConfig]
     ListQueryLoggingConfigsResponse
     [QueryLoggingConfig]
-> [QueryLoggingConfig]
forall s a. s -> Getting a s a -> a
Lens.^. Getting
  [QueryLoggingConfig]
  ListQueryLoggingConfigsResponse
  [QueryLoggingConfig]
Lens' ListQueryLoggingConfigsResponse [QueryLoggingConfig]
listQueryLoggingConfigsResponse_queryLoggingConfigs
        ) =
      Maybe ListQueryLoggingConfigs
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListQueryLoggingConfigs -> Maybe ListQueryLoggingConfigs
forall a. a -> Maybe a
Prelude.Just (ListQueryLoggingConfigs -> Maybe ListQueryLoggingConfigs)
-> ListQueryLoggingConfigs -> Maybe ListQueryLoggingConfigs
forall a b. (a -> b) -> a -> b
Prelude.$
        ListQueryLoggingConfigs
rq
          ListQueryLoggingConfigs
-> (ListQueryLoggingConfigs -> ListQueryLoggingConfigs)
-> ListQueryLoggingConfigs
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListQueryLoggingConfigs -> Identity ListQueryLoggingConfigs
Lens
  ListQueryLoggingConfigs
  ListQueryLoggingConfigs
  (Maybe Text)
  (Maybe Text)
listQueryLoggingConfigs_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListQueryLoggingConfigs -> Identity ListQueryLoggingConfigs)
-> Maybe Text -> ListQueryLoggingConfigs -> ListQueryLoggingConfigs
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListQueryLoggingConfigs
ListQueryLoggingConfigsResponse
rs
          ListQueryLoggingConfigsResponse
-> Getting (First Text) ListQueryLoggingConfigsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListQueryLoggingConfigsResponse
-> Const (First Text) ListQueryLoggingConfigsResponse
Lens' ListQueryLoggingConfigsResponse (Maybe Text)
listQueryLoggingConfigsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListQueryLoggingConfigsResponse
 -> Const (First Text) ListQueryLoggingConfigsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListQueryLoggingConfigsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListQueryLoggingConfigs where
  type
    AWSResponse ListQueryLoggingConfigs =
      ListQueryLoggingConfigsResponse
  request :: ListQueryLoggingConfigs -> Request ListQueryLoggingConfigs
request = Service
-> ListQueryLoggingConfigs -> Request ListQueryLoggingConfigs
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ListQueryLoggingConfigs
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListQueryLoggingConfigs)))
response =
    (Int
 -> ResponseHeaders
 -> [Node]
 -> Either String (AWSResponse ListQueryLoggingConfigs))
-> Logger
-> Service
-> Proxy ListQueryLoggingConfigs
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListQueryLoggingConfigs)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Text
-> Int -> [QueryLoggingConfig] -> ListQueryLoggingConfigsResponse
ListQueryLoggingConfigsResponse'
            (Maybe Text
 -> Int -> [QueryLoggingConfig] -> ListQueryLoggingConfigsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Int -> [QueryLoggingConfig] -> ListQueryLoggingConfigsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"NextToken")
            Either
  String
  (Int -> [QueryLoggingConfig] -> ListQueryLoggingConfigsResponse)
-> Either String Int
-> Either
     String ([QueryLoggingConfig] -> ListQueryLoggingConfigsResponse)
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))
            Either
  String ([QueryLoggingConfig] -> ListQueryLoggingConfigsResponse)
-> Either String [QueryLoggingConfig]
-> Either String ListQueryLoggingConfigsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"QueryLoggingConfigs"
                            Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                            Either String [Node]
-> ([Node] -> Either String [QueryLoggingConfig])
-> Either String [QueryLoggingConfig]
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= Text -> [Node] -> Either String [QueryLoggingConfig]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"QueryLoggingConfig"
                        )
      )

instance Prelude.Hashable ListQueryLoggingConfigs

instance Prelude.NFData ListQueryLoggingConfigs

instance Core.ToHeaders ListQueryLoggingConfigs where
  toHeaders :: ListQueryLoggingConfigs -> ResponseHeaders
toHeaders = ResponseHeaders -> ListQueryLoggingConfigs -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToPath ListQueryLoggingConfigs where
  toPath :: ListQueryLoggingConfigs -> ByteString
toPath =
    ByteString -> ListQueryLoggingConfigs -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/2013-04-01/queryloggingconfig"

instance Core.ToQuery ListQueryLoggingConfigs where
  toQuery :: ListQueryLoggingConfigs -> QueryString
toQuery ListQueryLoggingConfigs' {Maybe Text
Maybe ResourceId
maxResults :: Maybe Text
nextToken :: Maybe Text
hostedZoneId :: Maybe ResourceId
$sel:maxResults:ListQueryLoggingConfigs' :: ListQueryLoggingConfigs -> Maybe Text
$sel:nextToken:ListQueryLoggingConfigs' :: ListQueryLoggingConfigs -> Maybe Text
$sel:hostedZoneId:ListQueryLoggingConfigs' :: ListQueryLoggingConfigs -> Maybe ResourceId
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"hostedzoneid" ByteString -> Maybe ResourceId -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe ResourceId
hostedZoneId,
        ByteString
"nexttoken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"maxresults" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
maxResults
      ]

-- | /See:/ 'newListQueryLoggingConfigsResponse' smart constructor.
data ListQueryLoggingConfigsResponse = ListQueryLoggingConfigsResponse'
  { -- | If a response includes the last of the query logging configurations that
    -- are associated with the current Amazon Web Services account, @NextToken@
    -- doesn\'t appear in the response.
    --
    -- If a response doesn\'t include the last of the configurations, you can
    -- get more configurations by submitting another
    -- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_ListQueryLoggingConfigs.html ListQueryLoggingConfigs>
    -- request. Get the value of @NextToken@ that Amazon Route 53 returned in
    -- the previous response and include it in @NextToken@ in the next request.
    ListQueryLoggingConfigsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListQueryLoggingConfigsResponse -> Int
httpStatus :: Prelude.Int,
    -- | An array that contains one
    -- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_QueryLoggingConfig.html QueryLoggingConfig>
    -- element for each configuration for DNS query logging that is associated
    -- with the current Amazon Web Services account.
    ListQueryLoggingConfigsResponse -> [QueryLoggingConfig]
queryLoggingConfigs :: [QueryLoggingConfig]
  }
  deriving (ListQueryLoggingConfigsResponse
-> ListQueryLoggingConfigsResponse -> Bool
(ListQueryLoggingConfigsResponse
 -> ListQueryLoggingConfigsResponse -> Bool)
-> (ListQueryLoggingConfigsResponse
    -> ListQueryLoggingConfigsResponse -> Bool)
-> Eq ListQueryLoggingConfigsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListQueryLoggingConfigsResponse
-> ListQueryLoggingConfigsResponse -> Bool
$c/= :: ListQueryLoggingConfigsResponse
-> ListQueryLoggingConfigsResponse -> Bool
== :: ListQueryLoggingConfigsResponse
-> ListQueryLoggingConfigsResponse -> Bool
$c== :: ListQueryLoggingConfigsResponse
-> ListQueryLoggingConfigsResponse -> Bool
Prelude.Eq, ReadPrec [ListQueryLoggingConfigsResponse]
ReadPrec ListQueryLoggingConfigsResponse
Int -> ReadS ListQueryLoggingConfigsResponse
ReadS [ListQueryLoggingConfigsResponse]
(Int -> ReadS ListQueryLoggingConfigsResponse)
-> ReadS [ListQueryLoggingConfigsResponse]
-> ReadPrec ListQueryLoggingConfigsResponse
-> ReadPrec [ListQueryLoggingConfigsResponse]
-> Read ListQueryLoggingConfigsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListQueryLoggingConfigsResponse]
$creadListPrec :: ReadPrec [ListQueryLoggingConfigsResponse]
readPrec :: ReadPrec ListQueryLoggingConfigsResponse
$creadPrec :: ReadPrec ListQueryLoggingConfigsResponse
readList :: ReadS [ListQueryLoggingConfigsResponse]
$creadList :: ReadS [ListQueryLoggingConfigsResponse]
readsPrec :: Int -> ReadS ListQueryLoggingConfigsResponse
$creadsPrec :: Int -> ReadS ListQueryLoggingConfigsResponse
Prelude.Read, Int -> ListQueryLoggingConfigsResponse -> ShowS
[ListQueryLoggingConfigsResponse] -> ShowS
ListQueryLoggingConfigsResponse -> String
(Int -> ListQueryLoggingConfigsResponse -> ShowS)
-> (ListQueryLoggingConfigsResponse -> String)
-> ([ListQueryLoggingConfigsResponse] -> ShowS)
-> Show ListQueryLoggingConfigsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListQueryLoggingConfigsResponse] -> ShowS
$cshowList :: [ListQueryLoggingConfigsResponse] -> ShowS
show :: ListQueryLoggingConfigsResponse -> String
$cshow :: ListQueryLoggingConfigsResponse -> String
showsPrec :: Int -> ListQueryLoggingConfigsResponse -> ShowS
$cshowsPrec :: Int -> ListQueryLoggingConfigsResponse -> ShowS
Prelude.Show, (forall x.
 ListQueryLoggingConfigsResponse
 -> Rep ListQueryLoggingConfigsResponse x)
-> (forall x.
    Rep ListQueryLoggingConfigsResponse x
    -> ListQueryLoggingConfigsResponse)
-> Generic ListQueryLoggingConfigsResponse
forall x.
Rep ListQueryLoggingConfigsResponse x
-> ListQueryLoggingConfigsResponse
forall x.
ListQueryLoggingConfigsResponse
-> Rep ListQueryLoggingConfigsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListQueryLoggingConfigsResponse x
-> ListQueryLoggingConfigsResponse
$cfrom :: forall x.
ListQueryLoggingConfigsResponse
-> Rep ListQueryLoggingConfigsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListQueryLoggingConfigsResponse' 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:
--
-- 'nextToken', 'listQueryLoggingConfigsResponse_nextToken' - If a response includes the last of the query logging configurations that
-- are associated with the current Amazon Web Services account, @NextToken@
-- doesn\'t appear in the response.
--
-- If a response doesn\'t include the last of the configurations, you can
-- get more configurations by submitting another
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_ListQueryLoggingConfigs.html ListQueryLoggingConfigs>
-- request. Get the value of @NextToken@ that Amazon Route 53 returned in
-- the previous response and include it in @NextToken@ in the next request.
--
-- 'httpStatus', 'listQueryLoggingConfigsResponse_httpStatus' - The response's http status code.
--
-- 'queryLoggingConfigs', 'listQueryLoggingConfigsResponse_queryLoggingConfigs' - An array that contains one
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_QueryLoggingConfig.html QueryLoggingConfig>
-- element for each configuration for DNS query logging that is associated
-- with the current Amazon Web Services account.
newListQueryLoggingConfigsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListQueryLoggingConfigsResponse
newListQueryLoggingConfigsResponse :: Int -> ListQueryLoggingConfigsResponse
newListQueryLoggingConfigsResponse Int
pHttpStatus_ =
  ListQueryLoggingConfigsResponse' :: Maybe Text
-> Int -> [QueryLoggingConfig] -> ListQueryLoggingConfigsResponse
ListQueryLoggingConfigsResponse'
    { $sel:nextToken:ListQueryLoggingConfigsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListQueryLoggingConfigsResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:queryLoggingConfigs:ListQueryLoggingConfigsResponse' :: [QueryLoggingConfig]
queryLoggingConfigs = [QueryLoggingConfig]
forall a. Monoid a => a
Prelude.mempty
    }

-- | If a response includes the last of the query logging configurations that
-- are associated with the current Amazon Web Services account, @NextToken@
-- doesn\'t appear in the response.
--
-- If a response doesn\'t include the last of the configurations, you can
-- get more configurations by submitting another
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_ListQueryLoggingConfigs.html ListQueryLoggingConfigs>
-- request. Get the value of @NextToken@ that Amazon Route 53 returned in
-- the previous response and include it in @NextToken@ in the next request.
listQueryLoggingConfigsResponse_nextToken :: Lens.Lens' ListQueryLoggingConfigsResponse (Prelude.Maybe Prelude.Text)
listQueryLoggingConfigsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListQueryLoggingConfigsResponse
-> f ListQueryLoggingConfigsResponse
listQueryLoggingConfigsResponse_nextToken = (ListQueryLoggingConfigsResponse -> Maybe Text)
-> (ListQueryLoggingConfigsResponse
    -> Maybe Text -> ListQueryLoggingConfigsResponse)
-> Lens' ListQueryLoggingConfigsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListQueryLoggingConfigsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListQueryLoggingConfigsResponse' :: ListQueryLoggingConfigsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListQueryLoggingConfigsResponse
s@ListQueryLoggingConfigsResponse' {} Maybe Text
a -> ListQueryLoggingConfigsResponse
s {$sel:nextToken:ListQueryLoggingConfigsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListQueryLoggingConfigsResponse)

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

-- | An array that contains one
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_QueryLoggingConfig.html QueryLoggingConfig>
-- element for each configuration for DNS query logging that is associated
-- with the current Amazon Web Services account.
listQueryLoggingConfigsResponse_queryLoggingConfigs :: Lens.Lens' ListQueryLoggingConfigsResponse [QueryLoggingConfig]
listQueryLoggingConfigsResponse_queryLoggingConfigs :: ([QueryLoggingConfig] -> f [QueryLoggingConfig])
-> ListQueryLoggingConfigsResponse
-> f ListQueryLoggingConfigsResponse
listQueryLoggingConfigsResponse_queryLoggingConfigs = (ListQueryLoggingConfigsResponse -> [QueryLoggingConfig])
-> (ListQueryLoggingConfigsResponse
    -> [QueryLoggingConfig] -> ListQueryLoggingConfigsResponse)
-> Lens' ListQueryLoggingConfigsResponse [QueryLoggingConfig]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListQueryLoggingConfigsResponse' {[QueryLoggingConfig]
queryLoggingConfigs :: [QueryLoggingConfig]
$sel:queryLoggingConfigs:ListQueryLoggingConfigsResponse' :: ListQueryLoggingConfigsResponse -> [QueryLoggingConfig]
queryLoggingConfigs} -> [QueryLoggingConfig]
queryLoggingConfigs) (\s :: ListQueryLoggingConfigsResponse
s@ListQueryLoggingConfigsResponse' {} [QueryLoggingConfig]
a -> ListQueryLoggingConfigsResponse
s {$sel:queryLoggingConfigs:ListQueryLoggingConfigsResponse' :: [QueryLoggingConfig]
queryLoggingConfigs = [QueryLoggingConfig]
a} :: ListQueryLoggingConfigsResponse) (([QueryLoggingConfig] -> f [QueryLoggingConfig])
 -> ListQueryLoggingConfigsResponse
 -> f ListQueryLoggingConfigsResponse)
-> (([QueryLoggingConfig] -> f [QueryLoggingConfig])
    -> [QueryLoggingConfig] -> f [QueryLoggingConfig])
-> ([QueryLoggingConfig] -> f [QueryLoggingConfig])
-> ListQueryLoggingConfigsResponse
-> f ListQueryLoggingConfigsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([QueryLoggingConfig] -> f [QueryLoggingConfig])
-> [QueryLoggingConfig] -> f [QueryLoggingConfig]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Prelude.NFData
    ListQueryLoggingConfigsResponse