{-# 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-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)
module Amazonka.Route53.Types.QueryLoggingConfig where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(QueryLoggingConfig -> QueryLoggingConfig -> Bool)
-> (QueryLoggingConfig -> QueryLoggingConfig -> Bool)
-> Eq QueryLoggingConfig
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]
(Int -> ReadS QueryLoggingConfig)
-> ReadS [QueryLoggingConfig]
-> ReadPrec QueryLoggingConfig
-> ReadPrec [QueryLoggingConfig]
-> Read 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
(Int -> QueryLoggingConfig -> ShowS)
-> (QueryLoggingConfig -> String)
-> ([QueryLoggingConfig] -> ShowS)
-> Show QueryLoggingConfig
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. QueryLoggingConfig -> Rep QueryLoggingConfig x)
-> (forall x. Rep QueryLoggingConfig x -> QueryLoggingConfig)
-> Generic QueryLoggingConfig
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' :: Text -> ResourceId -> Text -> QueryLoggingConfig
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 :: (Text -> f Text) -> QueryLoggingConfig -> f QueryLoggingConfig
queryLoggingConfig_id = (QueryLoggingConfig -> Text)
-> (QueryLoggingConfig -> Text -> QueryLoggingConfig)
-> Lens QueryLoggingConfig QueryLoggingConfig Text Text
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 :: (ResourceId -> f ResourceId)
-> QueryLoggingConfig -> f QueryLoggingConfig
queryLoggingConfig_hostedZoneId = (QueryLoggingConfig -> ResourceId)
-> (QueryLoggingConfig -> ResourceId -> QueryLoggingConfig)
-> Lens QueryLoggingConfig QueryLoggingConfig ResourceId ResourceId
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 :: (Text -> f Text) -> QueryLoggingConfig -> f QueryLoggingConfig
queryLoggingConfig_cloudWatchLogsLogGroupArn = (QueryLoggingConfig -> Text)
-> (QueryLoggingConfig -> Text -> QueryLoggingConfig)
-> Lens QueryLoggingConfig QueryLoggingConfig Text Text
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 Core.FromXML QueryLoggingConfig where
  parseXML :: [Node] -> Either String QueryLoggingConfig
parseXML [Node]
x =
    Text -> ResourceId -> Text -> QueryLoggingConfig
QueryLoggingConfig'
      (Text -> ResourceId -> Text -> QueryLoggingConfig)
-> Either String Text
-> Either String (ResourceId -> Text -> QueryLoggingConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Id")
      Either String (ResourceId -> Text -> QueryLoggingConfig)
-> Either String ResourceId
-> Either String (Text -> QueryLoggingConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String ResourceId
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"HostedZoneId")
      Either String (Text -> QueryLoggingConfig)
-> Either String Text -> Either String QueryLoggingConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"CloudWatchLogsLogGroupArn")

instance Prelude.Hashable QueryLoggingConfig

instance Prelude.NFData QueryLoggingConfig