{-# 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.Glue.Types.DataQualityRulesetEvaluationRunFilter
-- 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.Glue.Types.DataQualityRulesetEvaluationRunFilter where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Glue.Types.DataSource
import qualified Amazonka.Prelude as Prelude

-- | The filter criteria.
--
-- /See:/ 'newDataQualityRulesetEvaluationRunFilter' smart constructor.
data DataQualityRulesetEvaluationRunFilter = DataQualityRulesetEvaluationRunFilter'
  { -- | Filter results by runs that started after this time.
    DataQualityRulesetEvaluationRunFilter -> Maybe POSIX
startedAfter :: Prelude.Maybe Data.POSIX,
    -- | Filter results by runs that started before this time.
    DataQualityRulesetEvaluationRunFilter -> Maybe POSIX
startedBefore :: Prelude.Maybe Data.POSIX,
    -- | Filter based on a data source (an Glue table) associated with the run.
    DataQualityRulesetEvaluationRunFilter -> DataSource
dataSource :: DataSource
  }
  deriving (DataQualityRulesetEvaluationRunFilter
-> DataQualityRulesetEvaluationRunFilter -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataQualityRulesetEvaluationRunFilter
-> DataQualityRulesetEvaluationRunFilter -> Bool
$c/= :: DataQualityRulesetEvaluationRunFilter
-> DataQualityRulesetEvaluationRunFilter -> Bool
== :: DataQualityRulesetEvaluationRunFilter
-> DataQualityRulesetEvaluationRunFilter -> Bool
$c== :: DataQualityRulesetEvaluationRunFilter
-> DataQualityRulesetEvaluationRunFilter -> Bool
Prelude.Eq, ReadPrec [DataQualityRulesetEvaluationRunFilter]
ReadPrec DataQualityRulesetEvaluationRunFilter
Int -> ReadS DataQualityRulesetEvaluationRunFilter
ReadS [DataQualityRulesetEvaluationRunFilter]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataQualityRulesetEvaluationRunFilter]
$creadListPrec :: ReadPrec [DataQualityRulesetEvaluationRunFilter]
readPrec :: ReadPrec DataQualityRulesetEvaluationRunFilter
$creadPrec :: ReadPrec DataQualityRulesetEvaluationRunFilter
readList :: ReadS [DataQualityRulesetEvaluationRunFilter]
$creadList :: ReadS [DataQualityRulesetEvaluationRunFilter]
readsPrec :: Int -> ReadS DataQualityRulesetEvaluationRunFilter
$creadsPrec :: Int -> ReadS DataQualityRulesetEvaluationRunFilter
Prelude.Read, Int -> DataQualityRulesetEvaluationRunFilter -> ShowS
[DataQualityRulesetEvaluationRunFilter] -> ShowS
DataQualityRulesetEvaluationRunFilter -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataQualityRulesetEvaluationRunFilter] -> ShowS
$cshowList :: [DataQualityRulesetEvaluationRunFilter] -> ShowS
show :: DataQualityRulesetEvaluationRunFilter -> String
$cshow :: DataQualityRulesetEvaluationRunFilter -> String
showsPrec :: Int -> DataQualityRulesetEvaluationRunFilter -> ShowS
$cshowsPrec :: Int -> DataQualityRulesetEvaluationRunFilter -> ShowS
Prelude.Show, forall x.
Rep DataQualityRulesetEvaluationRunFilter x
-> DataQualityRulesetEvaluationRunFilter
forall x.
DataQualityRulesetEvaluationRunFilter
-> Rep DataQualityRulesetEvaluationRunFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DataQualityRulesetEvaluationRunFilter x
-> DataQualityRulesetEvaluationRunFilter
$cfrom :: forall x.
DataQualityRulesetEvaluationRunFilter
-> Rep DataQualityRulesetEvaluationRunFilter x
Prelude.Generic)

-- |
-- Create a value of 'DataQualityRulesetEvaluationRunFilter' 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:
--
-- 'startedAfter', 'dataQualityRulesetEvaluationRunFilter_startedAfter' - Filter results by runs that started after this time.
--
-- 'startedBefore', 'dataQualityRulesetEvaluationRunFilter_startedBefore' - Filter results by runs that started before this time.
--
-- 'dataSource', 'dataQualityRulesetEvaluationRunFilter_dataSource' - Filter based on a data source (an Glue table) associated with the run.
newDataQualityRulesetEvaluationRunFilter ::
  -- | 'dataSource'
  DataSource ->
  DataQualityRulesetEvaluationRunFilter
newDataQualityRulesetEvaluationRunFilter :: DataSource -> DataQualityRulesetEvaluationRunFilter
newDataQualityRulesetEvaluationRunFilter DataSource
pDataSource_ =
  DataQualityRulesetEvaluationRunFilter'
    { $sel:startedAfter:DataQualityRulesetEvaluationRunFilter' :: Maybe POSIX
startedAfter =
        forall a. Maybe a
Prelude.Nothing,
      $sel:startedBefore:DataQualityRulesetEvaluationRunFilter' :: Maybe POSIX
startedBefore = forall a. Maybe a
Prelude.Nothing,
      $sel:dataSource:DataQualityRulesetEvaluationRunFilter' :: DataSource
dataSource = DataSource
pDataSource_
    }

-- | Filter results by runs that started after this time.
dataQualityRulesetEvaluationRunFilter_startedAfter :: Lens.Lens' DataQualityRulesetEvaluationRunFilter (Prelude.Maybe Prelude.UTCTime)
dataQualityRulesetEvaluationRunFilter_startedAfter :: Lens' DataQualityRulesetEvaluationRunFilter (Maybe UTCTime)
dataQualityRulesetEvaluationRunFilter_startedAfter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataQualityRulesetEvaluationRunFilter' {Maybe POSIX
startedAfter :: Maybe POSIX
$sel:startedAfter:DataQualityRulesetEvaluationRunFilter' :: DataQualityRulesetEvaluationRunFilter -> Maybe POSIX
startedAfter} -> Maybe POSIX
startedAfter) (\s :: DataQualityRulesetEvaluationRunFilter
s@DataQualityRulesetEvaluationRunFilter' {} Maybe POSIX
a -> DataQualityRulesetEvaluationRunFilter
s {$sel:startedAfter:DataQualityRulesetEvaluationRunFilter' :: Maybe POSIX
startedAfter = Maybe POSIX
a} :: DataQualityRulesetEvaluationRunFilter) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | Filter results by runs that started before this time.
dataQualityRulesetEvaluationRunFilter_startedBefore :: Lens.Lens' DataQualityRulesetEvaluationRunFilter (Prelude.Maybe Prelude.UTCTime)
dataQualityRulesetEvaluationRunFilter_startedBefore :: Lens' DataQualityRulesetEvaluationRunFilter (Maybe UTCTime)
dataQualityRulesetEvaluationRunFilter_startedBefore = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataQualityRulesetEvaluationRunFilter' {Maybe POSIX
startedBefore :: Maybe POSIX
$sel:startedBefore:DataQualityRulesetEvaluationRunFilter' :: DataQualityRulesetEvaluationRunFilter -> Maybe POSIX
startedBefore} -> Maybe POSIX
startedBefore) (\s :: DataQualityRulesetEvaluationRunFilter
s@DataQualityRulesetEvaluationRunFilter' {} Maybe POSIX
a -> DataQualityRulesetEvaluationRunFilter
s {$sel:startedBefore:DataQualityRulesetEvaluationRunFilter' :: Maybe POSIX
startedBefore = Maybe POSIX
a} :: DataQualityRulesetEvaluationRunFilter) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | Filter based on a data source (an Glue table) associated with the run.
dataQualityRulesetEvaluationRunFilter_dataSource :: Lens.Lens' DataQualityRulesetEvaluationRunFilter DataSource
dataQualityRulesetEvaluationRunFilter_dataSource :: Lens' DataQualityRulesetEvaluationRunFilter DataSource
dataQualityRulesetEvaluationRunFilter_dataSource = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataQualityRulesetEvaluationRunFilter' {DataSource
dataSource :: DataSource
$sel:dataSource:DataQualityRulesetEvaluationRunFilter' :: DataQualityRulesetEvaluationRunFilter -> DataSource
dataSource} -> DataSource
dataSource) (\s :: DataQualityRulesetEvaluationRunFilter
s@DataQualityRulesetEvaluationRunFilter' {} DataSource
a -> DataQualityRulesetEvaluationRunFilter
s {$sel:dataSource:DataQualityRulesetEvaluationRunFilter' :: DataSource
dataSource = DataSource
a} :: DataQualityRulesetEvaluationRunFilter)

instance
  Prelude.Hashable
    DataQualityRulesetEvaluationRunFilter
  where
  hashWithSalt :: Int -> DataQualityRulesetEvaluationRunFilter -> Int
hashWithSalt
    Int
_salt
    DataQualityRulesetEvaluationRunFilter' {Maybe POSIX
DataSource
dataSource :: DataSource
startedBefore :: Maybe POSIX
startedAfter :: Maybe POSIX
$sel:dataSource:DataQualityRulesetEvaluationRunFilter' :: DataQualityRulesetEvaluationRunFilter -> DataSource
$sel:startedBefore:DataQualityRulesetEvaluationRunFilter' :: DataQualityRulesetEvaluationRunFilter -> Maybe POSIX
$sel:startedAfter:DataQualityRulesetEvaluationRunFilter' :: DataQualityRulesetEvaluationRunFilter -> Maybe POSIX
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
startedAfter
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
startedBefore
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DataSource
dataSource

instance
  Prelude.NFData
    DataQualityRulesetEvaluationRunFilter
  where
  rnf :: DataQualityRulesetEvaluationRunFilter -> ()
rnf DataQualityRulesetEvaluationRunFilter' {Maybe POSIX
DataSource
dataSource :: DataSource
startedBefore :: Maybe POSIX
startedAfter :: Maybe POSIX
$sel:dataSource:DataQualityRulesetEvaluationRunFilter' :: DataQualityRulesetEvaluationRunFilter -> DataSource
$sel:startedBefore:DataQualityRulesetEvaluationRunFilter' :: DataQualityRulesetEvaluationRunFilter -> Maybe POSIX
$sel:startedAfter:DataQualityRulesetEvaluationRunFilter' :: DataQualityRulesetEvaluationRunFilter -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
startedAfter
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
startedBefore
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf DataSource
dataSource

instance
  Data.ToJSON
    DataQualityRulesetEvaluationRunFilter
  where
  toJSON :: DataQualityRulesetEvaluationRunFilter -> Value
toJSON DataQualityRulesetEvaluationRunFilter' {Maybe POSIX
DataSource
dataSource :: DataSource
startedBefore :: Maybe POSIX
startedAfter :: Maybe POSIX
$sel:dataSource:DataQualityRulesetEvaluationRunFilter' :: DataQualityRulesetEvaluationRunFilter -> DataSource
$sel:startedBefore:DataQualityRulesetEvaluationRunFilter' :: DataQualityRulesetEvaluationRunFilter -> Maybe POSIX
$sel:startedAfter:DataQualityRulesetEvaluationRunFilter' :: DataQualityRulesetEvaluationRunFilter -> Maybe POSIX
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"StartedAfter" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
startedAfter,
            (Key
"StartedBefore" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
startedBefore,
            forall a. a -> Maybe a
Prelude.Just (Key
"DataSource" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= DataSource
dataSource)
          ]
      )