{-# 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.Personalize.Types.FilterSummary
-- 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.Personalize.Types.FilterSummary where

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

-- | A short summary of a filter\'s attributes.
--
-- /See:/ 'newFilterSummary' smart constructor.
data FilterSummary = FilterSummary'
  { -- | If the filter failed, the reason for the failure.
    FilterSummary -> Maybe Text
failureReason :: Prelude.Maybe Prelude.Text,
    -- | The status of the filter.
    FilterSummary -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The time at which the filter was last updated.
    FilterSummary -> Maybe POSIX
lastUpdatedDateTime :: Prelude.Maybe Core.POSIX,
    -- | The name of the filter.
    FilterSummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the filter.
    FilterSummary -> Maybe Text
filterArn :: Prelude.Maybe Prelude.Text,
    -- | The time at which the filter was created.
    FilterSummary -> Maybe POSIX
creationDateTime :: Prelude.Maybe Core.POSIX,
    -- | The ARN of the dataset group to which the filter belongs.
    FilterSummary -> Maybe Text
datasetGroupArn :: Prelude.Maybe Prelude.Text
  }
  deriving (FilterSummary -> FilterSummary -> Bool
(FilterSummary -> FilterSummary -> Bool)
-> (FilterSummary -> FilterSummary -> Bool) -> Eq FilterSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FilterSummary -> FilterSummary -> Bool
$c/= :: FilterSummary -> FilterSummary -> Bool
== :: FilterSummary -> FilterSummary -> Bool
$c== :: FilterSummary -> FilterSummary -> Bool
Prelude.Eq, ReadPrec [FilterSummary]
ReadPrec FilterSummary
Int -> ReadS FilterSummary
ReadS [FilterSummary]
(Int -> ReadS FilterSummary)
-> ReadS [FilterSummary]
-> ReadPrec FilterSummary
-> ReadPrec [FilterSummary]
-> Read FilterSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FilterSummary]
$creadListPrec :: ReadPrec [FilterSummary]
readPrec :: ReadPrec FilterSummary
$creadPrec :: ReadPrec FilterSummary
readList :: ReadS [FilterSummary]
$creadList :: ReadS [FilterSummary]
readsPrec :: Int -> ReadS FilterSummary
$creadsPrec :: Int -> ReadS FilterSummary
Prelude.Read, Int -> FilterSummary -> ShowS
[FilterSummary] -> ShowS
FilterSummary -> String
(Int -> FilterSummary -> ShowS)
-> (FilterSummary -> String)
-> ([FilterSummary] -> ShowS)
-> Show FilterSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FilterSummary] -> ShowS
$cshowList :: [FilterSummary] -> ShowS
show :: FilterSummary -> String
$cshow :: FilterSummary -> String
showsPrec :: Int -> FilterSummary -> ShowS
$cshowsPrec :: Int -> FilterSummary -> ShowS
Prelude.Show, (forall x. FilterSummary -> Rep FilterSummary x)
-> (forall x. Rep FilterSummary x -> FilterSummary)
-> Generic FilterSummary
forall x. Rep FilterSummary x -> FilterSummary
forall x. FilterSummary -> Rep FilterSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FilterSummary x -> FilterSummary
$cfrom :: forall x. FilterSummary -> Rep FilterSummary x
Prelude.Generic)

-- |
-- Create a value of 'FilterSummary' 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:
--
-- 'failureReason', 'filterSummary_failureReason' - If the filter failed, the reason for the failure.
--
-- 'status', 'filterSummary_status' - The status of the filter.
--
-- 'lastUpdatedDateTime', 'filterSummary_lastUpdatedDateTime' - The time at which the filter was last updated.
--
-- 'name', 'filterSummary_name' - The name of the filter.
--
-- 'filterArn', 'filterSummary_filterArn' - The ARN of the filter.
--
-- 'creationDateTime', 'filterSummary_creationDateTime' - The time at which the filter was created.
--
-- 'datasetGroupArn', 'filterSummary_datasetGroupArn' - The ARN of the dataset group to which the filter belongs.
newFilterSummary ::
  FilterSummary
newFilterSummary :: FilterSummary
newFilterSummary =
  FilterSummary' :: Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> FilterSummary
FilterSummary'
    { $sel:failureReason:FilterSummary' :: Maybe Text
failureReason = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:status:FilterSummary' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedDateTime:FilterSummary' :: Maybe POSIX
lastUpdatedDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:name:FilterSummary' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:filterArn:FilterSummary' :: Maybe Text
filterArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDateTime:FilterSummary' :: Maybe POSIX
creationDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:datasetGroupArn:FilterSummary' :: Maybe Text
datasetGroupArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | If the filter failed, the reason for the failure.
filterSummary_failureReason :: Lens.Lens' FilterSummary (Prelude.Maybe Prelude.Text)
filterSummary_failureReason :: (Maybe Text -> f (Maybe Text)) -> FilterSummary -> f FilterSummary
filterSummary_failureReason = (FilterSummary -> Maybe Text)
-> (FilterSummary -> Maybe Text -> FilterSummary)
-> Lens FilterSummary FilterSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FilterSummary' {Maybe Text
failureReason :: Maybe Text
$sel:failureReason:FilterSummary' :: FilterSummary -> Maybe Text
failureReason} -> Maybe Text
failureReason) (\s :: FilterSummary
s@FilterSummary' {} Maybe Text
a -> FilterSummary
s {$sel:failureReason:FilterSummary' :: Maybe Text
failureReason = Maybe Text
a} :: FilterSummary)

-- | The status of the filter.
filterSummary_status :: Lens.Lens' FilterSummary (Prelude.Maybe Prelude.Text)
filterSummary_status :: (Maybe Text -> f (Maybe Text)) -> FilterSummary -> f FilterSummary
filterSummary_status = (FilterSummary -> Maybe Text)
-> (FilterSummary -> Maybe Text -> FilterSummary)
-> Lens FilterSummary FilterSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FilterSummary' {Maybe Text
status :: Maybe Text
$sel:status:FilterSummary' :: FilterSummary -> Maybe Text
status} -> Maybe Text
status) (\s :: FilterSummary
s@FilterSummary' {} Maybe Text
a -> FilterSummary
s {$sel:status:FilterSummary' :: Maybe Text
status = Maybe Text
a} :: FilterSummary)

-- | The time at which the filter was last updated.
filterSummary_lastUpdatedDateTime :: Lens.Lens' FilterSummary (Prelude.Maybe Prelude.UTCTime)
filterSummary_lastUpdatedDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> FilterSummary -> f FilterSummary
filterSummary_lastUpdatedDateTime = (FilterSummary -> Maybe POSIX)
-> (FilterSummary -> Maybe POSIX -> FilterSummary)
-> Lens FilterSummary FilterSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FilterSummary' {Maybe POSIX
lastUpdatedDateTime :: Maybe POSIX
$sel:lastUpdatedDateTime:FilterSummary' :: FilterSummary -> Maybe POSIX
lastUpdatedDateTime} -> Maybe POSIX
lastUpdatedDateTime) (\s :: FilterSummary
s@FilterSummary' {} Maybe POSIX
a -> FilterSummary
s {$sel:lastUpdatedDateTime:FilterSummary' :: Maybe POSIX
lastUpdatedDateTime = Maybe POSIX
a} :: FilterSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> FilterSummary -> f FilterSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> FilterSummary
-> f FilterSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The name of the filter.
filterSummary_name :: Lens.Lens' FilterSummary (Prelude.Maybe Prelude.Text)
filterSummary_name :: (Maybe Text -> f (Maybe Text)) -> FilterSummary -> f FilterSummary
filterSummary_name = (FilterSummary -> Maybe Text)
-> (FilterSummary -> Maybe Text -> FilterSummary)
-> Lens FilterSummary FilterSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FilterSummary' {Maybe Text
name :: Maybe Text
$sel:name:FilterSummary' :: FilterSummary -> Maybe Text
name} -> Maybe Text
name) (\s :: FilterSummary
s@FilterSummary' {} Maybe Text
a -> FilterSummary
s {$sel:name:FilterSummary' :: Maybe Text
name = Maybe Text
a} :: FilterSummary)

-- | The ARN of the filter.
filterSummary_filterArn :: Lens.Lens' FilterSummary (Prelude.Maybe Prelude.Text)
filterSummary_filterArn :: (Maybe Text -> f (Maybe Text)) -> FilterSummary -> f FilterSummary
filterSummary_filterArn = (FilterSummary -> Maybe Text)
-> (FilterSummary -> Maybe Text -> FilterSummary)
-> Lens FilterSummary FilterSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FilterSummary' {Maybe Text
filterArn :: Maybe Text
$sel:filterArn:FilterSummary' :: FilterSummary -> Maybe Text
filterArn} -> Maybe Text
filterArn) (\s :: FilterSummary
s@FilterSummary' {} Maybe Text
a -> FilterSummary
s {$sel:filterArn:FilterSummary' :: Maybe Text
filterArn = Maybe Text
a} :: FilterSummary)

-- | The time at which the filter was created.
filterSummary_creationDateTime :: Lens.Lens' FilterSummary (Prelude.Maybe Prelude.UTCTime)
filterSummary_creationDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> FilterSummary -> f FilterSummary
filterSummary_creationDateTime = (FilterSummary -> Maybe POSIX)
-> (FilterSummary -> Maybe POSIX -> FilterSummary)
-> Lens FilterSummary FilterSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FilterSummary' {Maybe POSIX
creationDateTime :: Maybe POSIX
$sel:creationDateTime:FilterSummary' :: FilterSummary -> Maybe POSIX
creationDateTime} -> Maybe POSIX
creationDateTime) (\s :: FilterSummary
s@FilterSummary' {} Maybe POSIX
a -> FilterSummary
s {$sel:creationDateTime:FilterSummary' :: Maybe POSIX
creationDateTime = Maybe POSIX
a} :: FilterSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> FilterSummary -> f FilterSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> FilterSummary
-> f FilterSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The ARN of the dataset group to which the filter belongs.
filterSummary_datasetGroupArn :: Lens.Lens' FilterSummary (Prelude.Maybe Prelude.Text)
filterSummary_datasetGroupArn :: (Maybe Text -> f (Maybe Text)) -> FilterSummary -> f FilterSummary
filterSummary_datasetGroupArn = (FilterSummary -> Maybe Text)
-> (FilterSummary -> Maybe Text -> FilterSummary)
-> Lens FilterSummary FilterSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FilterSummary' {Maybe Text
datasetGroupArn :: Maybe Text
$sel:datasetGroupArn:FilterSummary' :: FilterSummary -> Maybe Text
datasetGroupArn} -> Maybe Text
datasetGroupArn) (\s :: FilterSummary
s@FilterSummary' {} Maybe Text
a -> FilterSummary
s {$sel:datasetGroupArn:FilterSummary' :: Maybe Text
datasetGroupArn = Maybe Text
a} :: FilterSummary)

instance Core.FromJSON FilterSummary where
  parseJSON :: Value -> Parser FilterSummary
parseJSON =
    String
-> (Object -> Parser FilterSummary)
-> Value
-> Parser FilterSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FilterSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> FilterSummary
FilterSummary'
            (Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> FilterSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> FilterSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"failureReason")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> FilterSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> FilterSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> FilterSummary)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe POSIX -> Maybe Text -> FilterSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"lastUpdatedDateTime")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe POSIX -> Maybe Text -> FilterSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe POSIX -> Maybe Text -> FilterSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"name")
            Parser (Maybe Text -> Maybe POSIX -> Maybe Text -> FilterSummary)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe Text -> FilterSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"filterArn")
            Parser (Maybe POSIX -> Maybe Text -> FilterSummary)
-> Parser (Maybe POSIX) -> Parser (Maybe Text -> FilterSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"creationDateTime")
            Parser (Maybe Text -> FilterSummary)
-> Parser (Maybe Text) -> Parser FilterSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"datasetGroupArn")
      )

instance Prelude.Hashable FilterSummary

instance Prelude.NFData FilterSummary