{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.QueryLoggingConfig
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Route53.Types.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 Amazonka.Route53.Internal

-- | A complex type that contains information about a configuration for DNS
-- query logging.
--
-- /See:/ 'newQueryLoggingConfig' smart constructor.
data QueryLoggingConfig = QueryLoggingConfig'
  { -- | The ID for a configuration for DNS query logging.
    QueryLoggingConfig -> Text
id :: Prelude.Text,
    -- | The ID of the hosted zone that CloudWatch Logs is logging queries for.
    QueryLoggingConfig -> ResourceId
hostedZoneId :: ResourceId,
    -- | The Amazon Resource Name (ARN) of the CloudWatch Logs log group that
    -- Amazon Route 53 is publishing logs to.
    QueryLoggingConfig -> Text
cloudWatchLogsLogGroupArn :: Prelude.Text
  }
  deriving (QueryLoggingConfig -> QueryLoggingConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: QueryLoggingConfig -> QueryLoggingConfig -> Bool
$c/= :: QueryLoggingConfig -> QueryLoggingConfig -> Bool
== :: QueryLoggingConfig -> QueryLoggingConfig -> Bool
$c== :: QueryLoggingConfig -> QueryLoggingConfig -> Bool
Prelude.Eq, ReadPrec [QueryLoggingConfig]
ReadPrec QueryLoggingConfig
Int -> ReadS QueryLoggingConfig
ReadS [QueryLoggingConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [QueryLoggingConfig]
$creadListPrec :: ReadPrec [QueryLoggingConfig]
readPrec :: ReadPrec QueryLoggingConfig
$creadPrec :: ReadPrec QueryLoggingConfig
readList :: ReadS [QueryLoggingConfig]
$creadList :: ReadS [QueryLoggingConfig]
readsPrec :: Int -> ReadS QueryLoggingConfig
$creadsPrec :: Int -> ReadS QueryLoggingConfig
Prelude.Read, Int -> QueryLoggingConfig -> ShowS
[QueryLoggingConfig] -> ShowS
QueryLoggingConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [QueryLoggingConfig] -> ShowS
$cshowList :: [QueryLoggingConfig] -> ShowS
show :: QueryLoggingConfig -> String
$cshow :: QueryLoggingConfig -> String
showsPrec :: Int -> QueryLoggingConfig -> ShowS
$cshowsPrec :: Int -> QueryLoggingConfig -> ShowS
Prelude.Show, forall x. Rep QueryLoggingConfig x -> QueryLoggingConfig
forall x. QueryLoggingConfig -> Rep QueryLoggingConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep QueryLoggingConfig x -> QueryLoggingConfig
$cfrom :: forall x. QueryLoggingConfig -> Rep QueryLoggingConfig x
Prelude.Generic)

-- |
-- Create a value of 'QueryLoggingConfig' 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', 'queryLoggingConfig_id' - The ID for a configuration for DNS query logging.
--
-- 'hostedZoneId', 'queryLoggingConfig_hostedZoneId' - The ID of the hosted zone that CloudWatch Logs is logging queries for.
--
-- 'cloudWatchLogsLogGroupArn', 'queryLoggingConfig_cloudWatchLogsLogGroupArn' - The Amazon Resource Name (ARN) of the CloudWatch Logs log group that
-- Amazon Route 53 is publishing logs to.
newQueryLoggingConfig ::
  -- | 'id'
  Prelude.Text ->
  -- | 'hostedZoneId'
  ResourceId ->
  -- | 'cloudWatchLogsLogGroupArn'
  Prelude.Text ->
  QueryLoggingConfig
newQueryLoggingConfig :: Text -> ResourceId -> Text -> QueryLoggingConfig
newQueryLoggingConfig
  Text
pId_
  ResourceId
pHostedZoneId_
  Text
pCloudWatchLogsLogGroupArn_ =
    QueryLoggingConfig'
      { $sel:id:QueryLoggingConfig' :: Text
id = Text
pId_,
        $sel:hostedZoneId:QueryLoggingConfig' :: ResourceId
hostedZoneId = ResourceId
pHostedZoneId_,
        $sel:cloudWatchLogsLogGroupArn:QueryLoggingConfig' :: Text
cloudWatchLogsLogGroupArn =
          Text
pCloudWatchLogsLogGroupArn_
      }

-- | The ID for a configuration for DNS query logging.
queryLoggingConfig_id :: Lens.Lens' QueryLoggingConfig Prelude.Text
queryLoggingConfig_id :: Lens' QueryLoggingConfig Text
queryLoggingConfig_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryLoggingConfig' {Text
id :: Text
$sel:id:QueryLoggingConfig' :: QueryLoggingConfig -> Text
id} -> Text
id) (\s :: QueryLoggingConfig
s@QueryLoggingConfig' {} Text
a -> QueryLoggingConfig
s {$sel:id:QueryLoggingConfig' :: Text
id = Text
a} :: QueryLoggingConfig)

-- | The ID of the hosted zone that CloudWatch Logs is logging queries for.
queryLoggingConfig_hostedZoneId :: Lens.Lens' QueryLoggingConfig ResourceId
queryLoggingConfig_hostedZoneId :: Lens' QueryLoggingConfig ResourceId
queryLoggingConfig_hostedZoneId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryLoggingConfig' {ResourceId
hostedZoneId :: ResourceId
$sel:hostedZoneId:QueryLoggingConfig' :: QueryLoggingConfig -> ResourceId
hostedZoneId} -> ResourceId
hostedZoneId) (\s :: QueryLoggingConfig
s@QueryLoggingConfig' {} ResourceId
a -> QueryLoggingConfig
s {$sel:hostedZoneId:QueryLoggingConfig' :: ResourceId
hostedZoneId = ResourceId
a} :: QueryLoggingConfig)

-- | The Amazon Resource Name (ARN) of the CloudWatch Logs log group that
-- Amazon Route 53 is publishing logs to.
queryLoggingConfig_cloudWatchLogsLogGroupArn :: Lens.Lens' QueryLoggingConfig Prelude.Text
queryLoggingConfig_cloudWatchLogsLogGroupArn :: Lens' QueryLoggingConfig Text
queryLoggingConfig_cloudWatchLogsLogGroupArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryLoggingConfig' {Text
cloudWatchLogsLogGroupArn :: Text
$sel:cloudWatchLogsLogGroupArn:QueryLoggingConfig' :: QueryLoggingConfig -> Text
cloudWatchLogsLogGroupArn} -> Text
cloudWatchLogsLogGroupArn) (\s :: QueryLoggingConfig
s@QueryLoggingConfig' {} Text
a -> QueryLoggingConfig
s {$sel:cloudWatchLogsLogGroupArn:QueryLoggingConfig' :: Text
cloudWatchLogsLogGroupArn = Text
a} :: QueryLoggingConfig)

instance Data.FromXML QueryLoggingConfig where
  parseXML :: [Node] -> Either String QueryLoggingConfig
parseXML [Node]
x =
    Text -> ResourceId -> Text -> QueryLoggingConfig
QueryLoggingConfig'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"Id")
      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
"HostedZoneId")
      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
"CloudWatchLogsLogGroupArn")

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

instance Prelude.NFData QueryLoggingConfig where
  rnf :: QueryLoggingConfig -> ()
rnf QueryLoggingConfig' {Text
ResourceId
cloudWatchLogsLogGroupArn :: Text
hostedZoneId :: ResourceId
id :: Text
$sel:cloudWatchLogsLogGroupArn:QueryLoggingConfig' :: QueryLoggingConfig -> Text
$sel:hostedZoneId:QueryLoggingConfig' :: QueryLoggingConfig -> ResourceId
$sel:id:QueryLoggingConfig' :: QueryLoggingConfig -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ResourceId
hostedZoneId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
cloudWatchLogsLogGroupArn