{-# 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.GetResolverQueryLogConfigAssociation
-- 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 association between a Resolver query
-- logging configuration and an Amazon VPC. When you associate a VPC with a
-- query logging configuration, Resolver logs DNS queries that originate in
-- that VPC.
module Amazonka.Route53Resolver.GetResolverQueryLogConfigAssociation
  ( -- * Creating a Request
    GetResolverQueryLogConfigAssociation (..),
    newGetResolverQueryLogConfigAssociation,

    -- * Request Lenses
    getResolverQueryLogConfigAssociation_resolverQueryLogConfigAssociationId,

    -- * Destructuring the Response
    GetResolverQueryLogConfigAssociationResponse (..),
    newGetResolverQueryLogConfigAssociationResponse,

    -- * Response Lenses
    getResolverQueryLogConfigAssociationResponse_resolverQueryLogConfigAssociation,
    getResolverQueryLogConfigAssociationResponse_httpStatus,
  )
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.Route53Resolver.Types

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

-- |
-- Create a value of 'GetResolverQueryLogConfigAssociation' 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:
--
-- 'resolverQueryLogConfigAssociationId', 'getResolverQueryLogConfigAssociation_resolverQueryLogConfigAssociationId' - The ID of the Resolver query logging configuration association that you
-- want to get information about.
newGetResolverQueryLogConfigAssociation ::
  -- | 'resolverQueryLogConfigAssociationId'
  Prelude.Text ->
  GetResolverQueryLogConfigAssociation
newGetResolverQueryLogConfigAssociation :: Text -> GetResolverQueryLogConfigAssociation
newGetResolverQueryLogConfigAssociation
  Text
pResolverQueryLogConfigAssociationId_ =
    GetResolverQueryLogConfigAssociation'
      { $sel:resolverQueryLogConfigAssociationId:GetResolverQueryLogConfigAssociation' :: Text
resolverQueryLogConfigAssociationId =
          Text
pResolverQueryLogConfigAssociationId_
      }

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

instance
  Core.AWSRequest
    GetResolverQueryLogConfigAssociation
  where
  type
    AWSResponse GetResolverQueryLogConfigAssociation =
      GetResolverQueryLogConfigAssociationResponse
  request :: (Service -> Service)
-> GetResolverQueryLogConfigAssociation
-> Request GetResolverQueryLogConfigAssociation
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetResolverQueryLogConfigAssociation
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse GetResolverQueryLogConfigAssociation)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe ResolverQueryLogConfigAssociation
-> Int -> GetResolverQueryLogConfigAssociationResponse
GetResolverQueryLogConfigAssociationResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ResolverQueryLogConfigAssociation")
            forall (f :: * -> *) a b. Applicative f => 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))
      )

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

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

instance
  Data.ToHeaders
    GetResolverQueryLogConfigAssociation
  where
  toHeaders :: GetResolverQueryLogConfigAssociation -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"Route53Resolver.GetResolverQueryLogConfigAssociation" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance
  Data.ToJSON
    GetResolverQueryLogConfigAssociation
  where
  toJSON :: GetResolverQueryLogConfigAssociation -> Value
toJSON GetResolverQueryLogConfigAssociation' {Text
resolverQueryLogConfigAssociationId :: Text
$sel:resolverQueryLogConfigAssociationId:GetResolverQueryLogConfigAssociation' :: GetResolverQueryLogConfigAssociation -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              ( Key
"ResolverQueryLogConfigAssociationId"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
resolverQueryLogConfigAssociationId
              )
          ]
      )

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

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

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

-- |
-- Create a value of 'GetResolverQueryLogConfigAssociationResponse' 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:
--
-- 'resolverQueryLogConfigAssociation', 'getResolverQueryLogConfigAssociationResponse_resolverQueryLogConfigAssociation' - Information about the Resolver query logging configuration association
-- that you specified in a @GetQueryLogConfigAssociation@ request.
--
-- 'httpStatus', 'getResolverQueryLogConfigAssociationResponse_httpStatus' - The response's http status code.
newGetResolverQueryLogConfigAssociationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetResolverQueryLogConfigAssociationResponse
newGetResolverQueryLogConfigAssociationResponse :: Int -> GetResolverQueryLogConfigAssociationResponse
newGetResolverQueryLogConfigAssociationResponse
  Int
pHttpStatus_ =
    GetResolverQueryLogConfigAssociationResponse'
      { $sel:resolverQueryLogConfigAssociation:GetResolverQueryLogConfigAssociationResponse' :: Maybe ResolverQueryLogConfigAssociation
resolverQueryLogConfigAssociation =
          forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:GetResolverQueryLogConfigAssociationResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | Information about the Resolver query logging configuration association
-- that you specified in a @GetQueryLogConfigAssociation@ request.
getResolverQueryLogConfigAssociationResponse_resolverQueryLogConfigAssociation :: Lens.Lens' GetResolverQueryLogConfigAssociationResponse (Prelude.Maybe ResolverQueryLogConfigAssociation)
getResolverQueryLogConfigAssociationResponse_resolverQueryLogConfigAssociation :: Lens'
  GetResolverQueryLogConfigAssociationResponse
  (Maybe ResolverQueryLogConfigAssociation)
getResolverQueryLogConfigAssociationResponse_resolverQueryLogConfigAssociation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResolverQueryLogConfigAssociationResponse' {Maybe ResolverQueryLogConfigAssociation
resolverQueryLogConfigAssociation :: Maybe ResolverQueryLogConfigAssociation
$sel:resolverQueryLogConfigAssociation:GetResolverQueryLogConfigAssociationResponse' :: GetResolverQueryLogConfigAssociationResponse
-> Maybe ResolverQueryLogConfigAssociation
resolverQueryLogConfigAssociation} -> Maybe ResolverQueryLogConfigAssociation
resolverQueryLogConfigAssociation) (\s :: GetResolverQueryLogConfigAssociationResponse
s@GetResolverQueryLogConfigAssociationResponse' {} Maybe ResolverQueryLogConfigAssociation
a -> GetResolverQueryLogConfigAssociationResponse
s {$sel:resolverQueryLogConfigAssociation:GetResolverQueryLogConfigAssociationResponse' :: Maybe ResolverQueryLogConfigAssociation
resolverQueryLogConfigAssociation = Maybe ResolverQueryLogConfigAssociation
a} :: GetResolverQueryLogConfigAssociationResponse)

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

instance
  Prelude.NFData
    GetResolverQueryLogConfigAssociationResponse
  where
  rnf :: GetResolverQueryLogConfigAssociationResponse -> ()
rnf GetResolverQueryLogConfigAssociationResponse' {Int
Maybe ResolverQueryLogConfigAssociation
httpStatus :: Int
resolverQueryLogConfigAssociation :: Maybe ResolverQueryLogConfigAssociation
$sel:httpStatus:GetResolverQueryLogConfigAssociationResponse' :: GetResolverQueryLogConfigAssociationResponse -> Int
$sel:resolverQueryLogConfigAssociation:GetResolverQueryLogConfigAssociationResponse' :: GetResolverQueryLogConfigAssociationResponse
-> Maybe ResolverQueryLogConfigAssociation
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ResolverQueryLogConfigAssociation
resolverQueryLogConfigAssociation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus