{-# 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.TimeStreamWrite.Types.RecordsIngested
-- 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.TimeStreamWrite.Types.RecordsIngested 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

-- | Information on the records ingested by this request.
--
-- /See:/ 'newRecordsIngested' smart constructor.
data RecordsIngested = RecordsIngested'
  { -- | Count of records ingested into the magnetic store.
    RecordsIngested -> Maybe Int
magneticStore :: Prelude.Maybe Prelude.Int,
    -- | Count of records ingested into the memory store.
    RecordsIngested -> Maybe Int
memoryStore :: Prelude.Maybe Prelude.Int,
    -- | Total count of successfully ingested records.
    RecordsIngested -> Maybe Int
total :: Prelude.Maybe Prelude.Int
  }
  deriving (RecordsIngested -> RecordsIngested -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RecordsIngested -> RecordsIngested -> Bool
$c/= :: RecordsIngested -> RecordsIngested -> Bool
== :: RecordsIngested -> RecordsIngested -> Bool
$c== :: RecordsIngested -> RecordsIngested -> Bool
Prelude.Eq, ReadPrec [RecordsIngested]
ReadPrec RecordsIngested
Int -> ReadS RecordsIngested
ReadS [RecordsIngested]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RecordsIngested]
$creadListPrec :: ReadPrec [RecordsIngested]
readPrec :: ReadPrec RecordsIngested
$creadPrec :: ReadPrec RecordsIngested
readList :: ReadS [RecordsIngested]
$creadList :: ReadS [RecordsIngested]
readsPrec :: Int -> ReadS RecordsIngested
$creadsPrec :: Int -> ReadS RecordsIngested
Prelude.Read, Int -> RecordsIngested -> ShowS
[RecordsIngested] -> ShowS
RecordsIngested -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RecordsIngested] -> ShowS
$cshowList :: [RecordsIngested] -> ShowS
show :: RecordsIngested -> String
$cshow :: RecordsIngested -> String
showsPrec :: Int -> RecordsIngested -> ShowS
$cshowsPrec :: Int -> RecordsIngested -> ShowS
Prelude.Show, forall x. Rep RecordsIngested x -> RecordsIngested
forall x. RecordsIngested -> Rep RecordsIngested x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RecordsIngested x -> RecordsIngested
$cfrom :: forall x. RecordsIngested -> Rep RecordsIngested x
Prelude.Generic)

-- |
-- Create a value of 'RecordsIngested' 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:
--
-- 'magneticStore', 'recordsIngested_magneticStore' - Count of records ingested into the magnetic store.
--
-- 'memoryStore', 'recordsIngested_memoryStore' - Count of records ingested into the memory store.
--
-- 'total', 'recordsIngested_total' - Total count of successfully ingested records.
newRecordsIngested ::
  RecordsIngested
newRecordsIngested :: RecordsIngested
newRecordsIngested =
  RecordsIngested'
    { $sel:magneticStore:RecordsIngested' :: Maybe Int
magneticStore = forall a. Maybe a
Prelude.Nothing,
      $sel:memoryStore:RecordsIngested' :: Maybe Int
memoryStore = forall a. Maybe a
Prelude.Nothing,
      $sel:total:RecordsIngested' :: Maybe Int
total = forall a. Maybe a
Prelude.Nothing
    }

-- | Count of records ingested into the magnetic store.
recordsIngested_magneticStore :: Lens.Lens' RecordsIngested (Prelude.Maybe Prelude.Int)
recordsIngested_magneticStore :: Lens' RecordsIngested (Maybe Int)
recordsIngested_magneticStore = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecordsIngested' {Maybe Int
magneticStore :: Maybe Int
$sel:magneticStore:RecordsIngested' :: RecordsIngested -> Maybe Int
magneticStore} -> Maybe Int
magneticStore) (\s :: RecordsIngested
s@RecordsIngested' {} Maybe Int
a -> RecordsIngested
s {$sel:magneticStore:RecordsIngested' :: Maybe Int
magneticStore = Maybe Int
a} :: RecordsIngested)

-- | Count of records ingested into the memory store.
recordsIngested_memoryStore :: Lens.Lens' RecordsIngested (Prelude.Maybe Prelude.Int)
recordsIngested_memoryStore :: Lens' RecordsIngested (Maybe Int)
recordsIngested_memoryStore = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecordsIngested' {Maybe Int
memoryStore :: Maybe Int
$sel:memoryStore:RecordsIngested' :: RecordsIngested -> Maybe Int
memoryStore} -> Maybe Int
memoryStore) (\s :: RecordsIngested
s@RecordsIngested' {} Maybe Int
a -> RecordsIngested
s {$sel:memoryStore:RecordsIngested' :: Maybe Int
memoryStore = Maybe Int
a} :: RecordsIngested)

-- | Total count of successfully ingested records.
recordsIngested_total :: Lens.Lens' RecordsIngested (Prelude.Maybe Prelude.Int)
recordsIngested_total :: Lens' RecordsIngested (Maybe Int)
recordsIngested_total = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecordsIngested' {Maybe Int
total :: Maybe Int
$sel:total:RecordsIngested' :: RecordsIngested -> Maybe Int
total} -> Maybe Int
total) (\s :: RecordsIngested
s@RecordsIngested' {} Maybe Int
a -> RecordsIngested
s {$sel:total:RecordsIngested' :: Maybe Int
total = Maybe Int
a} :: RecordsIngested)

instance Data.FromJSON RecordsIngested where
  parseJSON :: Value -> Parser RecordsIngested
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RecordsIngested"
      ( \Object
x ->
          Maybe Int -> Maybe Int -> Maybe Int -> RecordsIngested
RecordsIngested'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"MagneticStore")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"MemoryStore")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Total")
      )

instance Prelude.Hashable RecordsIngested where
  hashWithSalt :: Int -> RecordsIngested -> Int
hashWithSalt Int
_salt RecordsIngested' {Maybe Int
total :: Maybe Int
memoryStore :: Maybe Int
magneticStore :: Maybe Int
$sel:total:RecordsIngested' :: RecordsIngested -> Maybe Int
$sel:memoryStore:RecordsIngested' :: RecordsIngested -> Maybe Int
$sel:magneticStore:RecordsIngested' :: RecordsIngested -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
magneticStore
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
memoryStore
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
total

instance Prelude.NFData RecordsIngested where
  rnf :: RecordsIngested -> ()
rnf RecordsIngested' {Maybe Int
total :: Maybe Int
memoryStore :: Maybe Int
magneticStore :: Maybe Int
$sel:total:RecordsIngested' :: RecordsIngested -> Maybe Int
$sel:memoryStore:RecordsIngested' :: RecordsIngested -> Maybe Int
$sel:magneticStore:RecordsIngested' :: RecordsIngested -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
magneticStore
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
memoryStore
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
total