{-# 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.Greengrass.Types.TelemetryConfigurationUpdate
-- 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.Greengrass.Types.TelemetryConfigurationUpdate where

import qualified Amazonka.Core as Core
import Amazonka.Greengrass.Types.Telemetry
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Configuration settings for running telemetry.
--
-- /See:/ 'newTelemetryConfigurationUpdate' smart constructor.
data TelemetryConfigurationUpdate = TelemetryConfigurationUpdate'
  { -- | Configure telemetry to be on or off.
    TelemetryConfigurationUpdate -> Telemetry
telemetry :: Telemetry
  }
  deriving (TelemetryConfigurationUpdate
-> TelemetryConfigurationUpdate -> Bool
(TelemetryConfigurationUpdate
 -> TelemetryConfigurationUpdate -> Bool)
-> (TelemetryConfigurationUpdate
    -> TelemetryConfigurationUpdate -> Bool)
-> Eq TelemetryConfigurationUpdate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TelemetryConfigurationUpdate
-> TelemetryConfigurationUpdate -> Bool
$c/= :: TelemetryConfigurationUpdate
-> TelemetryConfigurationUpdate -> Bool
== :: TelemetryConfigurationUpdate
-> TelemetryConfigurationUpdate -> Bool
$c== :: TelemetryConfigurationUpdate
-> TelemetryConfigurationUpdate -> Bool
Prelude.Eq, ReadPrec [TelemetryConfigurationUpdate]
ReadPrec TelemetryConfigurationUpdate
Int -> ReadS TelemetryConfigurationUpdate
ReadS [TelemetryConfigurationUpdate]
(Int -> ReadS TelemetryConfigurationUpdate)
-> ReadS [TelemetryConfigurationUpdate]
-> ReadPrec TelemetryConfigurationUpdate
-> ReadPrec [TelemetryConfigurationUpdate]
-> Read TelemetryConfigurationUpdate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TelemetryConfigurationUpdate]
$creadListPrec :: ReadPrec [TelemetryConfigurationUpdate]
readPrec :: ReadPrec TelemetryConfigurationUpdate
$creadPrec :: ReadPrec TelemetryConfigurationUpdate
readList :: ReadS [TelemetryConfigurationUpdate]
$creadList :: ReadS [TelemetryConfigurationUpdate]
readsPrec :: Int -> ReadS TelemetryConfigurationUpdate
$creadsPrec :: Int -> ReadS TelemetryConfigurationUpdate
Prelude.Read, Int -> TelemetryConfigurationUpdate -> ShowS
[TelemetryConfigurationUpdate] -> ShowS
TelemetryConfigurationUpdate -> String
(Int -> TelemetryConfigurationUpdate -> ShowS)
-> (TelemetryConfigurationUpdate -> String)
-> ([TelemetryConfigurationUpdate] -> ShowS)
-> Show TelemetryConfigurationUpdate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TelemetryConfigurationUpdate] -> ShowS
$cshowList :: [TelemetryConfigurationUpdate] -> ShowS
show :: TelemetryConfigurationUpdate -> String
$cshow :: TelemetryConfigurationUpdate -> String
showsPrec :: Int -> TelemetryConfigurationUpdate -> ShowS
$cshowsPrec :: Int -> TelemetryConfigurationUpdate -> ShowS
Prelude.Show, (forall x.
 TelemetryConfigurationUpdate -> Rep TelemetryConfigurationUpdate x)
-> (forall x.
    Rep TelemetryConfigurationUpdate x -> TelemetryConfigurationUpdate)
-> Generic TelemetryConfigurationUpdate
forall x.
Rep TelemetryConfigurationUpdate x -> TelemetryConfigurationUpdate
forall x.
TelemetryConfigurationUpdate -> Rep TelemetryConfigurationUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TelemetryConfigurationUpdate x -> TelemetryConfigurationUpdate
$cfrom :: forall x.
TelemetryConfigurationUpdate -> Rep TelemetryConfigurationUpdate x
Prelude.Generic)

-- |
-- Create a value of 'TelemetryConfigurationUpdate' 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:
--
-- 'telemetry', 'telemetryConfigurationUpdate_telemetry' - Configure telemetry to be on or off.
newTelemetryConfigurationUpdate ::
  -- | 'telemetry'
  Telemetry ->
  TelemetryConfigurationUpdate
newTelemetryConfigurationUpdate :: Telemetry -> TelemetryConfigurationUpdate
newTelemetryConfigurationUpdate Telemetry
pTelemetry_ =
  TelemetryConfigurationUpdate' :: Telemetry -> TelemetryConfigurationUpdate
TelemetryConfigurationUpdate'
    { $sel:telemetry:TelemetryConfigurationUpdate' :: Telemetry
telemetry =
        Telemetry
pTelemetry_
    }

-- | Configure telemetry to be on or off.
telemetryConfigurationUpdate_telemetry :: Lens.Lens' TelemetryConfigurationUpdate Telemetry
telemetryConfigurationUpdate_telemetry :: (Telemetry -> f Telemetry)
-> TelemetryConfigurationUpdate -> f TelemetryConfigurationUpdate
telemetryConfigurationUpdate_telemetry = (TelemetryConfigurationUpdate -> Telemetry)
-> (TelemetryConfigurationUpdate
    -> Telemetry -> TelemetryConfigurationUpdate)
-> Lens
     TelemetryConfigurationUpdate
     TelemetryConfigurationUpdate
     Telemetry
     Telemetry
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TelemetryConfigurationUpdate' {Telemetry
telemetry :: Telemetry
$sel:telemetry:TelemetryConfigurationUpdate' :: TelemetryConfigurationUpdate -> Telemetry
telemetry} -> Telemetry
telemetry) (\s :: TelemetryConfigurationUpdate
s@TelemetryConfigurationUpdate' {} Telemetry
a -> TelemetryConfigurationUpdate
s {$sel:telemetry:TelemetryConfigurationUpdate' :: Telemetry
telemetry = Telemetry
a} :: TelemetryConfigurationUpdate)

instance
  Prelude.Hashable
    TelemetryConfigurationUpdate

instance Prelude.NFData TelemetryConfigurationUpdate

instance Core.ToJSON TelemetryConfigurationUpdate where
  toJSON :: TelemetryConfigurationUpdate -> Value
toJSON TelemetryConfigurationUpdate' {Telemetry
telemetry :: Telemetry
$sel:telemetry:TelemetryConfigurationUpdate' :: TelemetryConfigurationUpdate -> Telemetry
..} =
    [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
"Telemetry" Text -> Telemetry -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Telemetry
telemetry)]
      )