{-# 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.IoTAnalytics.Types.DeltaTimeSessionWindowConfiguration
-- 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.IoTAnalytics.Types.DeltaTimeSessionWindowConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A structure that contains the configuration information of a delta time
-- session window.
--
-- <https://docs.aws.amazon.com/iotanalytics/latest/APIReference/API_DeltaTime.html DeltaTime>
-- specifies a time interval. You can use @DeltaTime@ to create dataset
-- contents with data that has arrived in the data store since the last
-- execution. For an example of @DeltaTime@, see
-- <https://docs.aws.amazon.com/iotanalytics/latest/userguide/automate-create-dataset.html#automate-example6 Creating a SQL dataset with a delta window (CLI)>
-- in the /IoT Analytics User Guide/.
--
-- /See:/ 'newDeltaTimeSessionWindowConfiguration' smart constructor.
data DeltaTimeSessionWindowConfiguration = DeltaTimeSessionWindowConfiguration'
  { -- | A time interval. You can use @timeoutInMinutes@ so that IoT Analytics
    -- can batch up late data notifications that have been generated since the
    -- last execution. IoT Analytics sends one batch of notifications to Amazon
    -- CloudWatch Events at one time.
    --
    -- For more information about how to write a timestamp expression, see
    -- <https://prestodb.io/docs/0.172/functions/datetime.html Date and Time Functions and Operators>,
    -- in the /Presto 0.172 Documentation/.
    DeltaTimeSessionWindowConfiguration -> Natural
timeoutInMinutes :: Prelude.Natural
  }
  deriving (DeltaTimeSessionWindowConfiguration
-> DeltaTimeSessionWindowConfiguration -> Bool
(DeltaTimeSessionWindowConfiguration
 -> DeltaTimeSessionWindowConfiguration -> Bool)
-> (DeltaTimeSessionWindowConfiguration
    -> DeltaTimeSessionWindowConfiguration -> Bool)
-> Eq DeltaTimeSessionWindowConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeltaTimeSessionWindowConfiguration
-> DeltaTimeSessionWindowConfiguration -> Bool
$c/= :: DeltaTimeSessionWindowConfiguration
-> DeltaTimeSessionWindowConfiguration -> Bool
== :: DeltaTimeSessionWindowConfiguration
-> DeltaTimeSessionWindowConfiguration -> Bool
$c== :: DeltaTimeSessionWindowConfiguration
-> DeltaTimeSessionWindowConfiguration -> Bool
Prelude.Eq, ReadPrec [DeltaTimeSessionWindowConfiguration]
ReadPrec DeltaTimeSessionWindowConfiguration
Int -> ReadS DeltaTimeSessionWindowConfiguration
ReadS [DeltaTimeSessionWindowConfiguration]
(Int -> ReadS DeltaTimeSessionWindowConfiguration)
-> ReadS [DeltaTimeSessionWindowConfiguration]
-> ReadPrec DeltaTimeSessionWindowConfiguration
-> ReadPrec [DeltaTimeSessionWindowConfiguration]
-> Read DeltaTimeSessionWindowConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeltaTimeSessionWindowConfiguration]
$creadListPrec :: ReadPrec [DeltaTimeSessionWindowConfiguration]
readPrec :: ReadPrec DeltaTimeSessionWindowConfiguration
$creadPrec :: ReadPrec DeltaTimeSessionWindowConfiguration
readList :: ReadS [DeltaTimeSessionWindowConfiguration]
$creadList :: ReadS [DeltaTimeSessionWindowConfiguration]
readsPrec :: Int -> ReadS DeltaTimeSessionWindowConfiguration
$creadsPrec :: Int -> ReadS DeltaTimeSessionWindowConfiguration
Prelude.Read, Int -> DeltaTimeSessionWindowConfiguration -> ShowS
[DeltaTimeSessionWindowConfiguration] -> ShowS
DeltaTimeSessionWindowConfiguration -> String
(Int -> DeltaTimeSessionWindowConfiguration -> ShowS)
-> (DeltaTimeSessionWindowConfiguration -> String)
-> ([DeltaTimeSessionWindowConfiguration] -> ShowS)
-> Show DeltaTimeSessionWindowConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeltaTimeSessionWindowConfiguration] -> ShowS
$cshowList :: [DeltaTimeSessionWindowConfiguration] -> ShowS
show :: DeltaTimeSessionWindowConfiguration -> String
$cshow :: DeltaTimeSessionWindowConfiguration -> String
showsPrec :: Int -> DeltaTimeSessionWindowConfiguration -> ShowS
$cshowsPrec :: Int -> DeltaTimeSessionWindowConfiguration -> ShowS
Prelude.Show, (forall x.
 DeltaTimeSessionWindowConfiguration
 -> Rep DeltaTimeSessionWindowConfiguration x)
-> (forall x.
    Rep DeltaTimeSessionWindowConfiguration x
    -> DeltaTimeSessionWindowConfiguration)
-> Generic DeltaTimeSessionWindowConfiguration
forall x.
Rep DeltaTimeSessionWindowConfiguration x
-> DeltaTimeSessionWindowConfiguration
forall x.
DeltaTimeSessionWindowConfiguration
-> Rep DeltaTimeSessionWindowConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeltaTimeSessionWindowConfiguration x
-> DeltaTimeSessionWindowConfiguration
$cfrom :: forall x.
DeltaTimeSessionWindowConfiguration
-> Rep DeltaTimeSessionWindowConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'DeltaTimeSessionWindowConfiguration' 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:
--
-- 'timeoutInMinutes', 'deltaTimeSessionWindowConfiguration_timeoutInMinutes' - A time interval. You can use @timeoutInMinutes@ so that IoT Analytics
-- can batch up late data notifications that have been generated since the
-- last execution. IoT Analytics sends one batch of notifications to Amazon
-- CloudWatch Events at one time.
--
-- For more information about how to write a timestamp expression, see
-- <https://prestodb.io/docs/0.172/functions/datetime.html Date and Time Functions and Operators>,
-- in the /Presto 0.172 Documentation/.
newDeltaTimeSessionWindowConfiguration ::
  -- | 'timeoutInMinutes'
  Prelude.Natural ->
  DeltaTimeSessionWindowConfiguration
newDeltaTimeSessionWindowConfiguration :: Natural -> DeltaTimeSessionWindowConfiguration
newDeltaTimeSessionWindowConfiguration
  Natural
pTimeoutInMinutes_ =
    DeltaTimeSessionWindowConfiguration' :: Natural -> DeltaTimeSessionWindowConfiguration
DeltaTimeSessionWindowConfiguration'
      { $sel:timeoutInMinutes:DeltaTimeSessionWindowConfiguration' :: Natural
timeoutInMinutes =
          Natural
pTimeoutInMinutes_
      }

-- | A time interval. You can use @timeoutInMinutes@ so that IoT Analytics
-- can batch up late data notifications that have been generated since the
-- last execution. IoT Analytics sends one batch of notifications to Amazon
-- CloudWatch Events at one time.
--
-- For more information about how to write a timestamp expression, see
-- <https://prestodb.io/docs/0.172/functions/datetime.html Date and Time Functions and Operators>,
-- in the /Presto 0.172 Documentation/.
deltaTimeSessionWindowConfiguration_timeoutInMinutes :: Lens.Lens' DeltaTimeSessionWindowConfiguration Prelude.Natural
deltaTimeSessionWindowConfiguration_timeoutInMinutes :: (Natural -> f Natural)
-> DeltaTimeSessionWindowConfiguration
-> f DeltaTimeSessionWindowConfiguration
deltaTimeSessionWindowConfiguration_timeoutInMinutes = (DeltaTimeSessionWindowConfiguration -> Natural)
-> (DeltaTimeSessionWindowConfiguration
    -> Natural -> DeltaTimeSessionWindowConfiguration)
-> Lens
     DeltaTimeSessionWindowConfiguration
     DeltaTimeSessionWindowConfiguration
     Natural
     Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeltaTimeSessionWindowConfiguration' {Natural
timeoutInMinutes :: Natural
$sel:timeoutInMinutes:DeltaTimeSessionWindowConfiguration' :: DeltaTimeSessionWindowConfiguration -> Natural
timeoutInMinutes} -> Natural
timeoutInMinutes) (\s :: DeltaTimeSessionWindowConfiguration
s@DeltaTimeSessionWindowConfiguration' {} Natural
a -> DeltaTimeSessionWindowConfiguration
s {$sel:timeoutInMinutes:DeltaTimeSessionWindowConfiguration' :: Natural
timeoutInMinutes = Natural
a} :: DeltaTimeSessionWindowConfiguration)

instance
  Core.FromJSON
    DeltaTimeSessionWindowConfiguration
  where
  parseJSON :: Value -> Parser DeltaTimeSessionWindowConfiguration
parseJSON =
    String
-> (Object -> Parser DeltaTimeSessionWindowConfiguration)
-> Value
-> Parser DeltaTimeSessionWindowConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DeltaTimeSessionWindowConfiguration"
      ( \Object
x ->
          Natural -> DeltaTimeSessionWindowConfiguration
DeltaTimeSessionWindowConfiguration'
            (Natural -> DeltaTimeSessionWindowConfiguration)
-> Parser Natural -> Parser DeltaTimeSessionWindowConfiguration
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"timeoutInMinutes")
      )

instance
  Prelude.Hashable
    DeltaTimeSessionWindowConfiguration

instance
  Prelude.NFData
    DeltaTimeSessionWindowConfiguration

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