{-# 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-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)
--
-- 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.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:/ '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
(GetQueryLoggingConfig -> GetQueryLoggingConfig -> Bool)
-> (GetQueryLoggingConfig -> GetQueryLoggingConfig -> Bool)
-> Eq GetQueryLoggingConfig
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]
(Int -> ReadS GetQueryLoggingConfig)
-> ReadS [GetQueryLoggingConfig]
-> ReadPrec GetQueryLoggingConfig
-> ReadPrec [GetQueryLoggingConfig]
-> Read 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
(Int -> GetQueryLoggingConfig -> ShowS)
-> (GetQueryLoggingConfig -> String)
-> ([GetQueryLoggingConfig] -> ShowS)
-> Show GetQueryLoggingConfig
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. GetQueryLoggingConfig -> Rep GetQueryLoggingConfig x)
-> (forall x. Rep GetQueryLoggingConfig x -> GetQueryLoggingConfig)
-> Generic GetQueryLoggingConfig
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' :: Text -> GetQueryLoggingConfig
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 :: (Text -> f Text)
-> GetQueryLoggingConfig -> f GetQueryLoggingConfig
getQueryLoggingConfig_id = (GetQueryLoggingConfig -> Text)
-> (GetQueryLoggingConfig -> Text -> GetQueryLoggingConfig)
-> Lens GetQueryLoggingConfig GetQueryLoggingConfig Text Text
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 :: GetQueryLoggingConfig -> Request GetQueryLoggingConfig
request = Service -> GetQueryLoggingConfig -> Request GetQueryLoggingConfig
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetQueryLoggingConfig
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetQueryLoggingConfig)))
response =
    (Int
 -> ResponseHeaders
 -> [Node]
 -> Either String (AWSResponse GetQueryLoggingConfig))
-> Logger
-> Service
-> Proxy GetQueryLoggingConfig
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetQueryLoggingConfig)))
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 ->
          Int -> QueryLoggingConfig -> GetQueryLoggingConfigResponse
GetQueryLoggingConfigResponse'
            (Int -> QueryLoggingConfig -> GetQueryLoggingConfigResponse)
-> Either String Int
-> Either
     String (QueryLoggingConfig -> GetQueryLoggingConfigResponse)
forall (f :: * -> *) a b. Functor 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 -> GetQueryLoggingConfigResponse)
-> Either String QueryLoggingConfig
-> Either String GetQueryLoggingConfigResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String QueryLoggingConfig
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"QueryLoggingConfig")
      )

instance Prelude.Hashable GetQueryLoggingConfig

instance Prelude.NFData GetQueryLoggingConfig

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

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

instance Core.ToQuery GetQueryLoggingConfig where
  toQuery :: GetQueryLoggingConfig -> QueryString
toQuery = QueryString -> GetQueryLoggingConfig -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(GetQueryLoggingConfigResponse
 -> GetQueryLoggingConfigResponse -> Bool)
-> (GetQueryLoggingConfigResponse
    -> GetQueryLoggingConfigResponse -> Bool)
-> Eq GetQueryLoggingConfigResponse
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]
(Int -> ReadS GetQueryLoggingConfigResponse)
-> ReadS [GetQueryLoggingConfigResponse]
-> ReadPrec GetQueryLoggingConfigResponse
-> ReadPrec [GetQueryLoggingConfigResponse]
-> Read 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
(Int -> GetQueryLoggingConfigResponse -> ShowS)
-> (GetQueryLoggingConfigResponse -> String)
-> ([GetQueryLoggingConfigResponse] -> ShowS)
-> Show GetQueryLoggingConfigResponse
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.
 GetQueryLoggingConfigResponse
 -> Rep GetQueryLoggingConfigResponse x)
-> (forall x.
    Rep GetQueryLoggingConfigResponse x
    -> GetQueryLoggingConfigResponse)
-> Generic GetQueryLoggingConfigResponse
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' :: Int -> QueryLoggingConfig -> GetQueryLoggingConfigResponse
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 :: (Int -> f Int)
-> GetQueryLoggingConfigResponse -> f GetQueryLoggingConfigResponse
getQueryLoggingConfigResponse_httpStatus = (GetQueryLoggingConfigResponse -> Int)
-> (GetQueryLoggingConfigResponse
    -> Int -> GetQueryLoggingConfigResponse)
-> Lens
     GetQueryLoggingConfigResponse GetQueryLoggingConfigResponse Int Int
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 :: (QueryLoggingConfig -> f QueryLoggingConfig)
-> GetQueryLoggingConfigResponse -> f GetQueryLoggingConfigResponse
getQueryLoggingConfigResponse_queryLoggingConfig = (GetQueryLoggingConfigResponse -> QueryLoggingConfig)
-> (GetQueryLoggingConfigResponse
    -> QueryLoggingConfig -> GetQueryLoggingConfigResponse)
-> Lens
     GetQueryLoggingConfigResponse
     GetQueryLoggingConfigResponse
     QueryLoggingConfig
     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