{-# 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.GetResolverQueryLogConfig
-- 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 Resolver query logging configuration,
-- such as the number of VPCs that the configuration is logging queries for
-- and the location that logs are sent to.
module Amazonka.Route53Resolver.GetResolverQueryLogConfig
  ( -- * Creating a Request
    GetResolverQueryLogConfig (..),
    newGetResolverQueryLogConfig,

    -- * Request Lenses
    getResolverQueryLogConfig_resolverQueryLogConfigId,

    -- * Destructuring the Response
    GetResolverQueryLogConfigResponse (..),
    newGetResolverQueryLogConfigResponse,

    -- * Response Lenses
    getResolverQueryLogConfigResponse_resolverQueryLogConfig,
    getResolverQueryLogConfigResponse_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:/ 'newGetResolverQueryLogConfig' smart constructor.
data GetResolverQueryLogConfig = GetResolverQueryLogConfig'
  { -- | The ID of the Resolver query logging configuration that you want to get
    -- information about.
    GetResolverQueryLogConfig -> Text
resolverQueryLogConfigId :: Prelude.Text
  }
  deriving (GetResolverQueryLogConfig -> GetResolverQueryLogConfig -> Bool
(GetResolverQueryLogConfig -> GetResolverQueryLogConfig -> Bool)
-> (GetResolverQueryLogConfig -> GetResolverQueryLogConfig -> Bool)
-> Eq GetResolverQueryLogConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetResolverQueryLogConfig -> GetResolverQueryLogConfig -> Bool
$c/= :: GetResolverQueryLogConfig -> GetResolverQueryLogConfig -> Bool
== :: GetResolverQueryLogConfig -> GetResolverQueryLogConfig -> Bool
$c== :: GetResolverQueryLogConfig -> GetResolverQueryLogConfig -> Bool
Prelude.Eq, ReadPrec [GetResolverQueryLogConfig]
ReadPrec GetResolverQueryLogConfig
Int -> ReadS GetResolverQueryLogConfig
ReadS [GetResolverQueryLogConfig]
(Int -> ReadS GetResolverQueryLogConfig)
-> ReadS [GetResolverQueryLogConfig]
-> ReadPrec GetResolverQueryLogConfig
-> ReadPrec [GetResolverQueryLogConfig]
-> Read GetResolverQueryLogConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetResolverQueryLogConfig]
$creadListPrec :: ReadPrec [GetResolverQueryLogConfig]
readPrec :: ReadPrec GetResolverQueryLogConfig
$creadPrec :: ReadPrec GetResolverQueryLogConfig
readList :: ReadS [GetResolverQueryLogConfig]
$creadList :: ReadS [GetResolverQueryLogConfig]
readsPrec :: Int -> ReadS GetResolverQueryLogConfig
$creadsPrec :: Int -> ReadS GetResolverQueryLogConfig
Prelude.Read, Int -> GetResolverQueryLogConfig -> ShowS
[GetResolverQueryLogConfig] -> ShowS
GetResolverQueryLogConfig -> String
(Int -> GetResolverQueryLogConfig -> ShowS)
-> (GetResolverQueryLogConfig -> String)
-> ([GetResolverQueryLogConfig] -> ShowS)
-> Show GetResolverQueryLogConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetResolverQueryLogConfig] -> ShowS
$cshowList :: [GetResolverQueryLogConfig] -> ShowS
show :: GetResolverQueryLogConfig -> String
$cshow :: GetResolverQueryLogConfig -> String
showsPrec :: Int -> GetResolverQueryLogConfig -> ShowS
$cshowsPrec :: Int -> GetResolverQueryLogConfig -> ShowS
Prelude.Show, (forall x.
 GetResolverQueryLogConfig -> Rep GetResolverQueryLogConfig x)
-> (forall x.
    Rep GetResolverQueryLogConfig x -> GetResolverQueryLogConfig)
-> Generic GetResolverQueryLogConfig
forall x.
Rep GetResolverQueryLogConfig x -> GetResolverQueryLogConfig
forall x.
GetResolverQueryLogConfig -> Rep GetResolverQueryLogConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetResolverQueryLogConfig x -> GetResolverQueryLogConfig
$cfrom :: forall x.
GetResolverQueryLogConfig -> Rep GetResolverQueryLogConfig x
Prelude.Generic)

-- |
-- Create a value of 'GetResolverQueryLogConfig' 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:
--
-- 'resolverQueryLogConfigId', 'getResolverQueryLogConfig_resolverQueryLogConfigId' - The ID of the Resolver query logging configuration that you want to get
-- information about.
newGetResolverQueryLogConfig ::
  -- | 'resolverQueryLogConfigId'
  Prelude.Text ->
  GetResolverQueryLogConfig
newGetResolverQueryLogConfig :: Text -> GetResolverQueryLogConfig
newGetResolverQueryLogConfig
  Text
pResolverQueryLogConfigId_ =
    GetResolverQueryLogConfig' :: Text -> GetResolverQueryLogConfig
GetResolverQueryLogConfig'
      { $sel:resolverQueryLogConfigId:GetResolverQueryLogConfig' :: Text
resolverQueryLogConfigId =
          Text
pResolverQueryLogConfigId_
      }

-- | The ID of the Resolver query logging configuration that you want to get
-- information about.
getResolverQueryLogConfig_resolverQueryLogConfigId :: Lens.Lens' GetResolverQueryLogConfig Prelude.Text
getResolverQueryLogConfig_resolverQueryLogConfigId :: (Text -> f Text)
-> GetResolverQueryLogConfig -> f GetResolverQueryLogConfig
getResolverQueryLogConfig_resolverQueryLogConfigId = (GetResolverQueryLogConfig -> Text)
-> (GetResolverQueryLogConfig -> Text -> GetResolverQueryLogConfig)
-> Lens
     GetResolverQueryLogConfig GetResolverQueryLogConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResolverQueryLogConfig' {Text
resolverQueryLogConfigId :: Text
$sel:resolverQueryLogConfigId:GetResolverQueryLogConfig' :: GetResolverQueryLogConfig -> Text
resolverQueryLogConfigId} -> Text
resolverQueryLogConfigId) (\s :: GetResolverQueryLogConfig
s@GetResolverQueryLogConfig' {} Text
a -> GetResolverQueryLogConfig
s {$sel:resolverQueryLogConfigId:GetResolverQueryLogConfig' :: Text
resolverQueryLogConfigId = Text
a} :: GetResolverQueryLogConfig)

instance Core.AWSRequest GetResolverQueryLogConfig where
  type
    AWSResponse GetResolverQueryLogConfig =
      GetResolverQueryLogConfigResponse
  request :: GetResolverQueryLogConfig -> Request GetResolverQueryLogConfig
request = Service
-> GetResolverQueryLogConfig -> Request GetResolverQueryLogConfig
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetResolverQueryLogConfig
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetResolverQueryLogConfig)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetResolverQueryLogConfig))
-> Logger
-> Service
-> Proxy GetResolverQueryLogConfig
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetResolverQueryLogConfig)))
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 ResolverQueryLogConfig
-> Int -> GetResolverQueryLogConfigResponse
GetResolverQueryLogConfigResponse'
            (Maybe ResolverQueryLogConfig
 -> Int -> GetResolverQueryLogConfigResponse)
-> Either String (Maybe ResolverQueryLogConfig)
-> Either String (Int -> GetResolverQueryLogConfigResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ResolverQueryLogConfig)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ResolverQueryLogConfig")
            Either String (Int -> GetResolverQueryLogConfigResponse)
-> Either String Int
-> Either String GetResolverQueryLogConfigResponse
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 GetResolverQueryLogConfig

instance Prelude.NFData GetResolverQueryLogConfig

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

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

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

-- | /See:/ 'newGetResolverQueryLogConfigResponse' smart constructor.
data GetResolverQueryLogConfigResponse = GetResolverQueryLogConfigResponse'
  { -- | Information about the Resolver query logging configuration that you
    -- specified in a @GetQueryLogConfig@ request.
    GetResolverQueryLogConfigResponse -> Maybe ResolverQueryLogConfig
resolverQueryLogConfig :: Prelude.Maybe ResolverQueryLogConfig,
    -- | The response's http status code.
    GetResolverQueryLogConfigResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetResolverQueryLogConfigResponse
-> GetResolverQueryLogConfigResponse -> Bool
(GetResolverQueryLogConfigResponse
 -> GetResolverQueryLogConfigResponse -> Bool)
-> (GetResolverQueryLogConfigResponse
    -> GetResolverQueryLogConfigResponse -> Bool)
-> Eq GetResolverQueryLogConfigResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetResolverQueryLogConfigResponse
-> GetResolverQueryLogConfigResponse -> Bool
$c/= :: GetResolverQueryLogConfigResponse
-> GetResolverQueryLogConfigResponse -> Bool
== :: GetResolverQueryLogConfigResponse
-> GetResolverQueryLogConfigResponse -> Bool
$c== :: GetResolverQueryLogConfigResponse
-> GetResolverQueryLogConfigResponse -> Bool
Prelude.Eq, ReadPrec [GetResolverQueryLogConfigResponse]
ReadPrec GetResolverQueryLogConfigResponse
Int -> ReadS GetResolverQueryLogConfigResponse
ReadS [GetResolverQueryLogConfigResponse]
(Int -> ReadS GetResolverQueryLogConfigResponse)
-> ReadS [GetResolverQueryLogConfigResponse]
-> ReadPrec GetResolverQueryLogConfigResponse
-> ReadPrec [GetResolverQueryLogConfigResponse]
-> Read GetResolverQueryLogConfigResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetResolverQueryLogConfigResponse]
$creadListPrec :: ReadPrec [GetResolverQueryLogConfigResponse]
readPrec :: ReadPrec GetResolverQueryLogConfigResponse
$creadPrec :: ReadPrec GetResolverQueryLogConfigResponse
readList :: ReadS [GetResolverQueryLogConfigResponse]
$creadList :: ReadS [GetResolverQueryLogConfigResponse]
readsPrec :: Int -> ReadS GetResolverQueryLogConfigResponse
$creadsPrec :: Int -> ReadS GetResolverQueryLogConfigResponse
Prelude.Read, Int -> GetResolverQueryLogConfigResponse -> ShowS
[GetResolverQueryLogConfigResponse] -> ShowS
GetResolverQueryLogConfigResponse -> String
(Int -> GetResolverQueryLogConfigResponse -> ShowS)
-> (GetResolverQueryLogConfigResponse -> String)
-> ([GetResolverQueryLogConfigResponse] -> ShowS)
-> Show GetResolverQueryLogConfigResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetResolverQueryLogConfigResponse] -> ShowS
$cshowList :: [GetResolverQueryLogConfigResponse] -> ShowS
show :: GetResolverQueryLogConfigResponse -> String
$cshow :: GetResolverQueryLogConfigResponse -> String
showsPrec :: Int -> GetResolverQueryLogConfigResponse -> ShowS
$cshowsPrec :: Int -> GetResolverQueryLogConfigResponse -> ShowS
Prelude.Show, (forall x.
 GetResolverQueryLogConfigResponse
 -> Rep GetResolverQueryLogConfigResponse x)
-> (forall x.
    Rep GetResolverQueryLogConfigResponse x
    -> GetResolverQueryLogConfigResponse)
-> Generic GetResolverQueryLogConfigResponse
forall x.
Rep GetResolverQueryLogConfigResponse x
-> GetResolverQueryLogConfigResponse
forall x.
GetResolverQueryLogConfigResponse
-> Rep GetResolverQueryLogConfigResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetResolverQueryLogConfigResponse x
-> GetResolverQueryLogConfigResponse
$cfrom :: forall x.
GetResolverQueryLogConfigResponse
-> Rep GetResolverQueryLogConfigResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetResolverQueryLogConfigResponse' 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:
--
-- 'resolverQueryLogConfig', 'getResolverQueryLogConfigResponse_resolverQueryLogConfig' - Information about the Resolver query logging configuration that you
-- specified in a @GetQueryLogConfig@ request.
--
-- 'httpStatus', 'getResolverQueryLogConfigResponse_httpStatus' - The response's http status code.
newGetResolverQueryLogConfigResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetResolverQueryLogConfigResponse
newGetResolverQueryLogConfigResponse :: Int -> GetResolverQueryLogConfigResponse
newGetResolverQueryLogConfigResponse Int
pHttpStatus_ =
  GetResolverQueryLogConfigResponse' :: Maybe ResolverQueryLogConfig
-> Int -> GetResolverQueryLogConfigResponse
GetResolverQueryLogConfigResponse'
    { $sel:resolverQueryLogConfig:GetResolverQueryLogConfigResponse' :: Maybe ResolverQueryLogConfig
resolverQueryLogConfig =
        Maybe ResolverQueryLogConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetResolverQueryLogConfigResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the Resolver query logging configuration that you
-- specified in a @GetQueryLogConfig@ request.
getResolverQueryLogConfigResponse_resolverQueryLogConfig :: Lens.Lens' GetResolverQueryLogConfigResponse (Prelude.Maybe ResolverQueryLogConfig)
getResolverQueryLogConfigResponse_resolverQueryLogConfig :: (Maybe ResolverQueryLogConfig -> f (Maybe ResolverQueryLogConfig))
-> GetResolverQueryLogConfigResponse
-> f GetResolverQueryLogConfigResponse
getResolverQueryLogConfigResponse_resolverQueryLogConfig = (GetResolverQueryLogConfigResponse -> Maybe ResolverQueryLogConfig)
-> (GetResolverQueryLogConfigResponse
    -> Maybe ResolverQueryLogConfig
    -> GetResolverQueryLogConfigResponse)
-> Lens
     GetResolverQueryLogConfigResponse
     GetResolverQueryLogConfigResponse
     (Maybe ResolverQueryLogConfig)
     (Maybe ResolverQueryLogConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResolverQueryLogConfigResponse' {Maybe ResolverQueryLogConfig
resolverQueryLogConfig :: Maybe ResolverQueryLogConfig
$sel:resolverQueryLogConfig:GetResolverQueryLogConfigResponse' :: GetResolverQueryLogConfigResponse -> Maybe ResolverQueryLogConfig
resolverQueryLogConfig} -> Maybe ResolverQueryLogConfig
resolverQueryLogConfig) (\s :: GetResolverQueryLogConfigResponse
s@GetResolverQueryLogConfigResponse' {} Maybe ResolverQueryLogConfig
a -> GetResolverQueryLogConfigResponse
s {$sel:resolverQueryLogConfig:GetResolverQueryLogConfigResponse' :: Maybe ResolverQueryLogConfig
resolverQueryLogConfig = Maybe ResolverQueryLogConfig
a} :: GetResolverQueryLogConfigResponse)

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

instance
  Prelude.NFData
    GetResolverQueryLogConfigResponse