{-# 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.QuickSight.Types.RowInfo
-- 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.QuickSight.Types.RowInfo where

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

-- | Information about rows for a data set SPICE ingestion.
--
-- /See:/ 'newRowInfo' smart constructor.
data RowInfo = RowInfo'
  { -- | The number of rows that were ingested.
    RowInfo -> Maybe Integer
rowsIngested :: Prelude.Maybe Prelude.Integer,
    -- | The total number of rows in the dataset.
    RowInfo -> Maybe Integer
totalRowsInDataset :: Prelude.Maybe Prelude.Integer,
    -- | The number of rows that were not ingested.
    RowInfo -> Maybe Integer
rowsDropped :: Prelude.Maybe Prelude.Integer
  }
  deriving (RowInfo -> RowInfo -> Bool
(RowInfo -> RowInfo -> Bool)
-> (RowInfo -> RowInfo -> Bool) -> Eq RowInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RowInfo -> RowInfo -> Bool
$c/= :: RowInfo -> RowInfo -> Bool
== :: RowInfo -> RowInfo -> Bool
$c== :: RowInfo -> RowInfo -> Bool
Prelude.Eq, ReadPrec [RowInfo]
ReadPrec RowInfo
Int -> ReadS RowInfo
ReadS [RowInfo]
(Int -> ReadS RowInfo)
-> ReadS [RowInfo]
-> ReadPrec RowInfo
-> ReadPrec [RowInfo]
-> Read RowInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RowInfo]
$creadListPrec :: ReadPrec [RowInfo]
readPrec :: ReadPrec RowInfo
$creadPrec :: ReadPrec RowInfo
readList :: ReadS [RowInfo]
$creadList :: ReadS [RowInfo]
readsPrec :: Int -> ReadS RowInfo
$creadsPrec :: Int -> ReadS RowInfo
Prelude.Read, Int -> RowInfo -> ShowS
[RowInfo] -> ShowS
RowInfo -> String
(Int -> RowInfo -> ShowS)
-> (RowInfo -> String) -> ([RowInfo] -> ShowS) -> Show RowInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RowInfo] -> ShowS
$cshowList :: [RowInfo] -> ShowS
show :: RowInfo -> String
$cshow :: RowInfo -> String
showsPrec :: Int -> RowInfo -> ShowS
$cshowsPrec :: Int -> RowInfo -> ShowS
Prelude.Show, (forall x. RowInfo -> Rep RowInfo x)
-> (forall x. Rep RowInfo x -> RowInfo) -> Generic RowInfo
forall x. Rep RowInfo x -> RowInfo
forall x. RowInfo -> Rep RowInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RowInfo x -> RowInfo
$cfrom :: forall x. RowInfo -> Rep RowInfo x
Prelude.Generic)

-- |
-- Create a value of 'RowInfo' 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:
--
-- 'rowsIngested', 'rowInfo_rowsIngested' - The number of rows that were ingested.
--
-- 'totalRowsInDataset', 'rowInfo_totalRowsInDataset' - The total number of rows in the dataset.
--
-- 'rowsDropped', 'rowInfo_rowsDropped' - The number of rows that were not ingested.
newRowInfo ::
  RowInfo
newRowInfo :: RowInfo
newRowInfo =
  RowInfo' :: Maybe Integer -> Maybe Integer -> Maybe Integer -> RowInfo
RowInfo'
    { $sel:rowsIngested:RowInfo' :: Maybe Integer
rowsIngested = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:totalRowsInDataset:RowInfo' :: Maybe Integer
totalRowsInDataset = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:rowsDropped:RowInfo' :: Maybe Integer
rowsDropped = Maybe Integer
forall a. Maybe a
Prelude.Nothing
    }

-- | The number of rows that were ingested.
rowInfo_rowsIngested :: Lens.Lens' RowInfo (Prelude.Maybe Prelude.Integer)
rowInfo_rowsIngested :: (Maybe Integer -> f (Maybe Integer)) -> RowInfo -> f RowInfo
rowInfo_rowsIngested = (RowInfo -> Maybe Integer)
-> (RowInfo -> Maybe Integer -> RowInfo)
-> Lens RowInfo RowInfo (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RowInfo' {Maybe Integer
rowsIngested :: Maybe Integer
$sel:rowsIngested:RowInfo' :: RowInfo -> Maybe Integer
rowsIngested} -> Maybe Integer
rowsIngested) (\s :: RowInfo
s@RowInfo' {} Maybe Integer
a -> RowInfo
s {$sel:rowsIngested:RowInfo' :: Maybe Integer
rowsIngested = Maybe Integer
a} :: RowInfo)

-- | The total number of rows in the dataset.
rowInfo_totalRowsInDataset :: Lens.Lens' RowInfo (Prelude.Maybe Prelude.Integer)
rowInfo_totalRowsInDataset :: (Maybe Integer -> f (Maybe Integer)) -> RowInfo -> f RowInfo
rowInfo_totalRowsInDataset = (RowInfo -> Maybe Integer)
-> (RowInfo -> Maybe Integer -> RowInfo)
-> Lens RowInfo RowInfo (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RowInfo' {Maybe Integer
totalRowsInDataset :: Maybe Integer
$sel:totalRowsInDataset:RowInfo' :: RowInfo -> Maybe Integer
totalRowsInDataset} -> Maybe Integer
totalRowsInDataset) (\s :: RowInfo
s@RowInfo' {} Maybe Integer
a -> RowInfo
s {$sel:totalRowsInDataset:RowInfo' :: Maybe Integer
totalRowsInDataset = Maybe Integer
a} :: RowInfo)

-- | The number of rows that were not ingested.
rowInfo_rowsDropped :: Lens.Lens' RowInfo (Prelude.Maybe Prelude.Integer)
rowInfo_rowsDropped :: (Maybe Integer -> f (Maybe Integer)) -> RowInfo -> f RowInfo
rowInfo_rowsDropped = (RowInfo -> Maybe Integer)
-> (RowInfo -> Maybe Integer -> RowInfo)
-> Lens RowInfo RowInfo (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RowInfo' {Maybe Integer
rowsDropped :: Maybe Integer
$sel:rowsDropped:RowInfo' :: RowInfo -> Maybe Integer
rowsDropped} -> Maybe Integer
rowsDropped) (\s :: RowInfo
s@RowInfo' {} Maybe Integer
a -> RowInfo
s {$sel:rowsDropped:RowInfo' :: Maybe Integer
rowsDropped = Maybe Integer
a} :: RowInfo)

instance Core.FromJSON RowInfo where
  parseJSON :: Value -> Parser RowInfo
parseJSON =
    String -> (Object -> Parser RowInfo) -> Value -> Parser RowInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RowInfo"
      ( \Object
x ->
          Maybe Integer -> Maybe Integer -> Maybe Integer -> RowInfo
RowInfo'
            (Maybe Integer -> Maybe Integer -> Maybe Integer -> RowInfo)
-> Parser (Maybe Integer)
-> Parser (Maybe Integer -> Maybe Integer -> RowInfo)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RowsIngested")
            Parser (Maybe Integer -> Maybe Integer -> RowInfo)
-> Parser (Maybe Integer) -> Parser (Maybe Integer -> RowInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TotalRowsInDataset")
            Parser (Maybe Integer -> RowInfo)
-> Parser (Maybe Integer) -> Parser RowInfo
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RowsDropped")
      )

instance Prelude.Hashable RowInfo

instance Prelude.NFData RowInfo