{-# 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.CloudFront.Types.RealtimeMetricsSubscriptionConfig
-- 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.CloudFront.Types.RealtimeMetricsSubscriptionConfig where

import Amazonka.CloudFront.Types.RealtimeMetricsSubscriptionStatus
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A subscription configuration for additional CloudWatch metrics.
--
-- /See:/ 'newRealtimeMetricsSubscriptionConfig' smart constructor.
data RealtimeMetricsSubscriptionConfig = RealtimeMetricsSubscriptionConfig'
  { -- | A flag that indicates whether additional CloudWatch metrics are enabled
    -- for a given CloudFront distribution.
    RealtimeMetricsSubscriptionConfig
-> RealtimeMetricsSubscriptionStatus
realtimeMetricsSubscriptionStatus :: RealtimeMetricsSubscriptionStatus
  }
  deriving (RealtimeMetricsSubscriptionConfig
-> RealtimeMetricsSubscriptionConfig -> Bool
(RealtimeMetricsSubscriptionConfig
 -> RealtimeMetricsSubscriptionConfig -> Bool)
-> (RealtimeMetricsSubscriptionConfig
    -> RealtimeMetricsSubscriptionConfig -> Bool)
-> Eq RealtimeMetricsSubscriptionConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RealtimeMetricsSubscriptionConfig
-> RealtimeMetricsSubscriptionConfig -> Bool
$c/= :: RealtimeMetricsSubscriptionConfig
-> RealtimeMetricsSubscriptionConfig -> Bool
== :: RealtimeMetricsSubscriptionConfig
-> RealtimeMetricsSubscriptionConfig -> Bool
$c== :: RealtimeMetricsSubscriptionConfig
-> RealtimeMetricsSubscriptionConfig -> Bool
Prelude.Eq, ReadPrec [RealtimeMetricsSubscriptionConfig]
ReadPrec RealtimeMetricsSubscriptionConfig
Int -> ReadS RealtimeMetricsSubscriptionConfig
ReadS [RealtimeMetricsSubscriptionConfig]
(Int -> ReadS RealtimeMetricsSubscriptionConfig)
-> ReadS [RealtimeMetricsSubscriptionConfig]
-> ReadPrec RealtimeMetricsSubscriptionConfig
-> ReadPrec [RealtimeMetricsSubscriptionConfig]
-> Read RealtimeMetricsSubscriptionConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RealtimeMetricsSubscriptionConfig]
$creadListPrec :: ReadPrec [RealtimeMetricsSubscriptionConfig]
readPrec :: ReadPrec RealtimeMetricsSubscriptionConfig
$creadPrec :: ReadPrec RealtimeMetricsSubscriptionConfig
readList :: ReadS [RealtimeMetricsSubscriptionConfig]
$creadList :: ReadS [RealtimeMetricsSubscriptionConfig]
readsPrec :: Int -> ReadS RealtimeMetricsSubscriptionConfig
$creadsPrec :: Int -> ReadS RealtimeMetricsSubscriptionConfig
Prelude.Read, Int -> RealtimeMetricsSubscriptionConfig -> ShowS
[RealtimeMetricsSubscriptionConfig] -> ShowS
RealtimeMetricsSubscriptionConfig -> String
(Int -> RealtimeMetricsSubscriptionConfig -> ShowS)
-> (RealtimeMetricsSubscriptionConfig -> String)
-> ([RealtimeMetricsSubscriptionConfig] -> ShowS)
-> Show RealtimeMetricsSubscriptionConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RealtimeMetricsSubscriptionConfig] -> ShowS
$cshowList :: [RealtimeMetricsSubscriptionConfig] -> ShowS
show :: RealtimeMetricsSubscriptionConfig -> String
$cshow :: RealtimeMetricsSubscriptionConfig -> String
showsPrec :: Int -> RealtimeMetricsSubscriptionConfig -> ShowS
$cshowsPrec :: Int -> RealtimeMetricsSubscriptionConfig -> ShowS
Prelude.Show, (forall x.
 RealtimeMetricsSubscriptionConfig
 -> Rep RealtimeMetricsSubscriptionConfig x)
-> (forall x.
    Rep RealtimeMetricsSubscriptionConfig x
    -> RealtimeMetricsSubscriptionConfig)
-> Generic RealtimeMetricsSubscriptionConfig
forall x.
Rep RealtimeMetricsSubscriptionConfig x
-> RealtimeMetricsSubscriptionConfig
forall x.
RealtimeMetricsSubscriptionConfig
-> Rep RealtimeMetricsSubscriptionConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RealtimeMetricsSubscriptionConfig x
-> RealtimeMetricsSubscriptionConfig
$cfrom :: forall x.
RealtimeMetricsSubscriptionConfig
-> Rep RealtimeMetricsSubscriptionConfig x
Prelude.Generic)

-- |
-- Create a value of 'RealtimeMetricsSubscriptionConfig' 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:
--
-- 'realtimeMetricsSubscriptionStatus', 'realtimeMetricsSubscriptionConfig_realtimeMetricsSubscriptionStatus' - A flag that indicates whether additional CloudWatch metrics are enabled
-- for a given CloudFront distribution.
newRealtimeMetricsSubscriptionConfig ::
  -- | 'realtimeMetricsSubscriptionStatus'
  RealtimeMetricsSubscriptionStatus ->
  RealtimeMetricsSubscriptionConfig
newRealtimeMetricsSubscriptionConfig :: RealtimeMetricsSubscriptionStatus
-> RealtimeMetricsSubscriptionConfig
newRealtimeMetricsSubscriptionConfig
  RealtimeMetricsSubscriptionStatus
pRealtimeMetricsSubscriptionStatus_ =
    RealtimeMetricsSubscriptionConfig' :: RealtimeMetricsSubscriptionStatus
-> RealtimeMetricsSubscriptionConfig
RealtimeMetricsSubscriptionConfig'
      { $sel:realtimeMetricsSubscriptionStatus:RealtimeMetricsSubscriptionConfig' :: RealtimeMetricsSubscriptionStatus
realtimeMetricsSubscriptionStatus =
          RealtimeMetricsSubscriptionStatus
pRealtimeMetricsSubscriptionStatus_
      }

-- | A flag that indicates whether additional CloudWatch metrics are enabled
-- for a given CloudFront distribution.
realtimeMetricsSubscriptionConfig_realtimeMetricsSubscriptionStatus :: Lens.Lens' RealtimeMetricsSubscriptionConfig RealtimeMetricsSubscriptionStatus
realtimeMetricsSubscriptionConfig_realtimeMetricsSubscriptionStatus :: (RealtimeMetricsSubscriptionStatus
 -> f RealtimeMetricsSubscriptionStatus)
-> RealtimeMetricsSubscriptionConfig
-> f RealtimeMetricsSubscriptionConfig
realtimeMetricsSubscriptionConfig_realtimeMetricsSubscriptionStatus = (RealtimeMetricsSubscriptionConfig
 -> RealtimeMetricsSubscriptionStatus)
-> (RealtimeMetricsSubscriptionConfig
    -> RealtimeMetricsSubscriptionStatus
    -> RealtimeMetricsSubscriptionConfig)
-> Lens
     RealtimeMetricsSubscriptionConfig
     RealtimeMetricsSubscriptionConfig
     RealtimeMetricsSubscriptionStatus
     RealtimeMetricsSubscriptionStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RealtimeMetricsSubscriptionConfig' {RealtimeMetricsSubscriptionStatus
realtimeMetricsSubscriptionStatus :: RealtimeMetricsSubscriptionStatus
$sel:realtimeMetricsSubscriptionStatus:RealtimeMetricsSubscriptionConfig' :: RealtimeMetricsSubscriptionConfig
-> RealtimeMetricsSubscriptionStatus
realtimeMetricsSubscriptionStatus} -> RealtimeMetricsSubscriptionStatus
realtimeMetricsSubscriptionStatus) (\s :: RealtimeMetricsSubscriptionConfig
s@RealtimeMetricsSubscriptionConfig' {} RealtimeMetricsSubscriptionStatus
a -> RealtimeMetricsSubscriptionConfig
s {$sel:realtimeMetricsSubscriptionStatus:RealtimeMetricsSubscriptionConfig' :: RealtimeMetricsSubscriptionStatus
realtimeMetricsSubscriptionStatus = RealtimeMetricsSubscriptionStatus
a} :: RealtimeMetricsSubscriptionConfig)

instance
  Core.FromXML
    RealtimeMetricsSubscriptionConfig
  where
  parseXML :: [Node] -> Either String RealtimeMetricsSubscriptionConfig
parseXML [Node]
x =
    RealtimeMetricsSubscriptionStatus
-> RealtimeMetricsSubscriptionConfig
RealtimeMetricsSubscriptionConfig'
      (RealtimeMetricsSubscriptionStatus
 -> RealtimeMetricsSubscriptionConfig)
-> Either String RealtimeMetricsSubscriptionStatus
-> Either String RealtimeMetricsSubscriptionConfig
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String RealtimeMetricsSubscriptionStatus
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"RealtimeMetricsSubscriptionStatus")

instance
  Prelude.Hashable
    RealtimeMetricsSubscriptionConfig

instance
  Prelude.NFData
    RealtimeMetricsSubscriptionConfig

instance Core.ToXML RealtimeMetricsSubscriptionConfig where
  toXML :: RealtimeMetricsSubscriptionConfig -> XML
toXML RealtimeMetricsSubscriptionConfig' {RealtimeMetricsSubscriptionStatus
realtimeMetricsSubscriptionStatus :: RealtimeMetricsSubscriptionStatus
$sel:realtimeMetricsSubscriptionStatus:RealtimeMetricsSubscriptionConfig' :: RealtimeMetricsSubscriptionConfig
-> RealtimeMetricsSubscriptionStatus
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ Name
"RealtimeMetricsSubscriptionStatus"
          Name -> RealtimeMetricsSubscriptionStatus -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= RealtimeMetricsSubscriptionStatus
realtimeMetricsSubscriptionStatus
      ]