{-# 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.GetQueryLoggingConfig
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets information about a specified configuration for DNS query logging.
--
-- For more information about DNS query logs, see
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_CreateQueryLoggingConfig.html CreateQueryLoggingConfig>
-- and
-- <https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/query-logs.html Logging DNS Queries>.
module Amazonka.Route53.GetQueryLoggingConfig
  ( -- * Creating a Request
    GetQueryLoggingConfig (..),
    newGetQueryLoggingConfig,

    -- * Request Lenses
    getQueryLoggingConfig_id,

    -- * Destructuring the Response
    GetQueryLoggingConfigResponse (..),
    newGetQueryLoggingConfigResponse,

    -- * Response Lenses
    getQueryLoggingConfigResponse_httpStatus,
    getQueryLoggingConfigResponse_queryLoggingConfig,
  )
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.Route53.Types

-- | /See:/ 'newGetQueryLoggingConfig' smart constructor.
data GetQueryLoggingConfig = GetQueryLoggingConfig'
  { -- | The ID of the configuration for DNS query logging that you want to get
    -- information about.
    GetQueryLoggingConfig -> Text
id :: Prelude.Text
  }
  deriving (GetQueryLoggingConfig -> GetQueryLoggingConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetQueryLoggingConfig -> GetQueryLoggingConfig -> Bool
$c/= :: GetQueryLoggingConfig -> GetQueryLoggingConfig -> Bool
== :: GetQueryLoggingConfig -> GetQueryLoggingConfig -> Bool
$c== :: GetQueryLoggingConfig -> GetQueryLoggingConfig -> Bool
Prelude.Eq, ReadPrec [GetQueryLoggingConfig]
ReadPrec GetQueryLoggingConfig
Int -> ReadS GetQueryLoggingConfig
ReadS [GetQueryLoggingConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetQueryLoggingConfig]
$creadListPrec :: ReadPrec [GetQueryLoggingConfig]
readPrec :: ReadPrec GetQueryLoggingConfig
$creadPrec :: ReadPrec GetQueryLoggingConfig
readList :: ReadS [GetQueryLoggingConfig]
$creadList :: ReadS [GetQueryLoggingConfig]
readsPrec :: Int -> ReadS GetQueryLoggingConfig
$creadsPrec :: Int -> ReadS GetQueryLoggingConfig
Prelude.Read, Int -> GetQueryLoggingConfig -> ShowS
[GetQueryLoggingConfig] -> ShowS
GetQueryLoggingConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetQueryLoggingConfig] -> ShowS
$cshowList :: [GetQueryLoggingConfig] -> ShowS
show :: GetQueryLoggingConfig -> String
$cshow :: GetQueryLoggingConfig -> String
showsPrec :: Int -> GetQueryLoggingConfig -> ShowS
$cshowsPrec :: Int -> GetQueryLoggingConfig -> ShowS
Prelude.Show, forall x. Rep GetQueryLoggingConfig x -> GetQueryLoggingConfig
forall x. GetQueryLoggingConfig -> Rep GetQueryLoggingConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetQueryLoggingConfig x -> GetQueryLoggingConfig
$cfrom :: forall x. GetQueryLoggingConfig -> Rep GetQueryLoggingConfig x
Prelude.Generic)

-- |
-- Create a value of 'GetQueryLoggingConfig' 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:
--
-- 'id', 'getQueryLoggingConfig_id' - The ID of the configuration for DNS query logging that you want to get
-- information about.
newGetQueryLoggingConfig ::
  -- | 'id'
  Prelude.Text ->
  GetQueryLoggingConfig
newGetQueryLoggingConfig :: Text -> GetQueryLoggingConfig
newGetQueryLoggingConfig Text
pId_ =
  GetQueryLoggingConfig' {$sel:id:GetQueryLoggingConfig' :: Text
id = Text
pId_}

-- | The ID of the configuration for DNS query logging that you want to get
-- information about.
getQueryLoggingConfig_id :: Lens.Lens' GetQueryLoggingConfig Prelude.Text
getQueryLoggingConfig_id :: Lens' GetQueryLoggingConfig Text
getQueryLoggingConfig_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetQueryLoggingConfig' {Text
id :: Text
$sel:id:GetQueryLoggingConfig' :: GetQueryLoggingConfig -> Text
id} -> Text
id) (\s :: GetQueryLoggingConfig
s@GetQueryLoggingConfig' {} Text
a -> GetQueryLoggingConfig
s {$sel:id:GetQueryLoggingConfig' :: Text
id = Text
a} :: GetQueryLoggingConfig)

instance Core.AWSRequest GetQueryLoggingConfig where
  type
    AWSResponse GetQueryLoggingConfig =
      GetQueryLoggingConfigResponse
  request :: (Service -> Service)
-> GetQueryLoggingConfig -> Request GetQueryLoggingConfig
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetQueryLoggingConfig
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetQueryLoggingConfig)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int -> QueryLoggingConfig -> GetQueryLoggingConfigResponse
GetQueryLoggingConfigResponse'
            forall (f :: * -> *) a b. Functor 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))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"QueryLoggingConfig")
      )

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

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

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

instance Data.ToPath GetQueryLoggingConfig where
  toPath :: GetQueryLoggingConfig -> ByteString
toPath GetQueryLoggingConfig' {Text
id :: Text
$sel:id:GetQueryLoggingConfig' :: GetQueryLoggingConfig -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/2013-04-01/queryloggingconfig/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
id]

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

-- | /See:/ 'newGetQueryLoggingConfigResponse' smart constructor.
data GetQueryLoggingConfigResponse = GetQueryLoggingConfigResponse'
  { -- | The response's http status code.
    GetQueryLoggingConfigResponse -> Int
httpStatus :: Prelude.Int,
    -- | A complex type that contains information about the query logging
    -- configuration that you specified in a
    -- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetQueryLoggingConfig.html GetQueryLoggingConfig>
    -- request.
    GetQueryLoggingConfigResponse -> QueryLoggingConfig
queryLoggingConfig :: QueryLoggingConfig
  }
  deriving (GetQueryLoggingConfigResponse
-> GetQueryLoggingConfigResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetQueryLoggingConfigResponse
-> GetQueryLoggingConfigResponse -> Bool
$c/= :: GetQueryLoggingConfigResponse
-> GetQueryLoggingConfigResponse -> Bool
== :: GetQueryLoggingConfigResponse
-> GetQueryLoggingConfigResponse -> Bool
$c== :: GetQueryLoggingConfigResponse
-> GetQueryLoggingConfigResponse -> Bool
Prelude.Eq, ReadPrec [GetQueryLoggingConfigResponse]
ReadPrec GetQueryLoggingConfigResponse
Int -> ReadS GetQueryLoggingConfigResponse
ReadS [GetQueryLoggingConfigResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetQueryLoggingConfigResponse]
$creadListPrec :: ReadPrec [GetQueryLoggingConfigResponse]
readPrec :: ReadPrec GetQueryLoggingConfigResponse
$creadPrec :: ReadPrec GetQueryLoggingConfigResponse
readList :: ReadS [GetQueryLoggingConfigResponse]
$creadList :: ReadS [GetQueryLoggingConfigResponse]
readsPrec :: Int -> ReadS GetQueryLoggingConfigResponse
$creadsPrec :: Int -> ReadS GetQueryLoggingConfigResponse
Prelude.Read, Int -> GetQueryLoggingConfigResponse -> ShowS
[GetQueryLoggingConfigResponse] -> ShowS
GetQueryLoggingConfigResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetQueryLoggingConfigResponse] -> ShowS
$cshowList :: [GetQueryLoggingConfigResponse] -> ShowS
show :: GetQueryLoggingConfigResponse -> String
$cshow :: GetQueryLoggingConfigResponse -> String
showsPrec :: Int -> GetQueryLoggingConfigResponse -> ShowS
$cshowsPrec :: Int -> GetQueryLoggingConfigResponse -> ShowS
Prelude.Show, forall x.
Rep GetQueryLoggingConfigResponse x
-> GetQueryLoggingConfigResponse
forall x.
GetQueryLoggingConfigResponse
-> Rep GetQueryLoggingConfigResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetQueryLoggingConfigResponse x
-> GetQueryLoggingConfigResponse
$cfrom :: forall x.
GetQueryLoggingConfigResponse
-> Rep GetQueryLoggingConfigResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetQueryLoggingConfigResponse' 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:
--
-- 'httpStatus', 'getQueryLoggingConfigResponse_httpStatus' - The response's http status code.
--
-- 'queryLoggingConfig', 'getQueryLoggingConfigResponse_queryLoggingConfig' - A complex type that contains information about the query logging
-- configuration that you specified in a
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetQueryLoggingConfig.html GetQueryLoggingConfig>
-- request.
newGetQueryLoggingConfigResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'queryLoggingConfig'
  QueryLoggingConfig ->
  GetQueryLoggingConfigResponse
newGetQueryLoggingConfigResponse :: Int -> QueryLoggingConfig -> GetQueryLoggingConfigResponse
newGetQueryLoggingConfigResponse
  Int
pHttpStatus_
  QueryLoggingConfig
pQueryLoggingConfig_ =
    GetQueryLoggingConfigResponse'
      { $sel:httpStatus:GetQueryLoggingConfigResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:queryLoggingConfig:GetQueryLoggingConfigResponse' :: QueryLoggingConfig
queryLoggingConfig = QueryLoggingConfig
pQueryLoggingConfig_
      }

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

-- | A complex type that contains information about the query logging
-- configuration that you specified in a
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetQueryLoggingConfig.html GetQueryLoggingConfig>
-- request.
getQueryLoggingConfigResponse_queryLoggingConfig :: Lens.Lens' GetQueryLoggingConfigResponse QueryLoggingConfig
getQueryLoggingConfigResponse_queryLoggingConfig :: Lens' GetQueryLoggingConfigResponse QueryLoggingConfig
getQueryLoggingConfigResponse_queryLoggingConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetQueryLoggingConfigResponse' {QueryLoggingConfig
queryLoggingConfig :: QueryLoggingConfig
$sel:queryLoggingConfig:GetQueryLoggingConfigResponse' :: GetQueryLoggingConfigResponse -> QueryLoggingConfig
queryLoggingConfig} -> QueryLoggingConfig
queryLoggingConfig) (\s :: GetQueryLoggingConfigResponse
s@GetQueryLoggingConfigResponse' {} QueryLoggingConfig
a -> GetQueryLoggingConfigResponse
s {$sel:queryLoggingConfig:GetQueryLoggingConfigResponse' :: QueryLoggingConfig
queryLoggingConfig = QueryLoggingConfig
a} :: GetQueryLoggingConfigResponse)

instance Prelude.NFData GetQueryLoggingConfigResponse where
  rnf :: GetQueryLoggingConfigResponse -> ()
rnf GetQueryLoggingConfigResponse' {Int
QueryLoggingConfig
queryLoggingConfig :: QueryLoggingConfig
httpStatus :: Int
$sel:queryLoggingConfig:GetQueryLoggingConfigResponse' :: GetQueryLoggingConfigResponse -> QueryLoggingConfig
$sel:httpStatus:GetQueryLoggingConfigResponse' :: GetQueryLoggingConfigResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf QueryLoggingConfig
queryLoggingConfig