{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoTAnalytics.Types.DeltaTimeSessionWindowConfiguration 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

-- | 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
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]
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
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.
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'
      { $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 :: Lens' DeltaTimeSessionWindowConfiguration Natural
deltaTimeSessionWindowConfiguration_timeoutInMinutes = 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
  Data.FromJSON
    DeltaTimeSessionWindowConfiguration
  where
  parseJSON :: Value -> Parser DeltaTimeSessionWindowConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DeltaTimeSessionWindowConfiguration"
      ( \Object
x ->
          Natural -> DeltaTimeSessionWindowConfiguration
DeltaTimeSessionWindowConfiguration'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"timeoutInMinutes")
      )

instance
  Prelude.Hashable
    DeltaTimeSessionWindowConfiguration
  where
  hashWithSalt :: Int -> DeltaTimeSessionWindowConfiguration -> Int
hashWithSalt
    Int
_salt
    DeltaTimeSessionWindowConfiguration' {Natural
timeoutInMinutes :: Natural
$sel:timeoutInMinutes:DeltaTimeSessionWindowConfiguration' :: DeltaTimeSessionWindowConfiguration -> Natural
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
timeoutInMinutes

instance
  Prelude.NFData
    DeltaTimeSessionWindowConfiguration
  where
  rnf :: DeltaTimeSessionWindowConfiguration -> ()
rnf DeltaTimeSessionWindowConfiguration' {Natural
timeoutInMinutes :: Natural
$sel:timeoutInMinutes:DeltaTimeSessionWindowConfiguration' :: DeltaTimeSessionWindowConfiguration -> Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Natural
timeoutInMinutes

instance
  Data.ToJSON
    DeltaTimeSessionWindowConfiguration
  where
  toJSON :: DeltaTimeSessionWindowConfiguration -> Value
toJSON DeltaTimeSessionWindowConfiguration' {Natural
timeoutInMinutes :: Natural
$sel:timeoutInMinutes:DeltaTimeSessionWindowConfiguration' :: DeltaTimeSessionWindowConfiguration -> Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"timeoutInMinutes" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
timeoutInMinutes)
          ]
      )