{-# 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.EventTracker
-- 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.EventTracker where

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

-- | Provides information about an event tracker.
--
-- /See:/ 'newEventTracker' smart constructor.
data EventTracker = EventTracker'
  { -- | The status of the event tracker.
    --
    -- An event tracker can be in one of the following states:
    --
    -- -   CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED
    --
    -- -   DELETE PENDING > DELETE IN_PROGRESS
    EventTracker -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The ID of the event tracker. Include this ID in requests to the
    -- <https://docs.aws.amazon.com/personalize/latest/dg/API_UBS_PutEvents.html PutEvents>
    -- API.
    EventTracker -> Maybe Text
trackingId :: Prelude.Maybe Prelude.Text,
    -- | The date and time (in Unix time) that the event tracker was last
    -- updated.
    EventTracker -> Maybe POSIX
lastUpdatedDateTime :: Prelude.Maybe Core.POSIX,
    -- | The Amazon Web Services account that owns the event tracker.
    EventTracker -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | The name of the event tracker.
    EventTracker -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The date and time (in Unix format) that the event tracker was created.
    EventTracker -> Maybe POSIX
creationDateTime :: Prelude.Maybe Core.POSIX,
    -- | The Amazon Resource Name (ARN) of the dataset group that receives the
    -- event data.
    EventTracker -> Maybe Text
datasetGroupArn :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the event tracker.
    EventTracker -> Maybe Text
eventTrackerArn :: Prelude.Maybe Prelude.Text
  }
  deriving (EventTracker -> EventTracker -> Bool
(EventTracker -> EventTracker -> Bool)
-> (EventTracker -> EventTracker -> Bool) -> Eq EventTracker
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EventTracker -> EventTracker -> Bool
$c/= :: EventTracker -> EventTracker -> Bool
== :: EventTracker -> EventTracker -> Bool
$c== :: EventTracker -> EventTracker -> Bool
Prelude.Eq, ReadPrec [EventTracker]
ReadPrec EventTracker
Int -> ReadS EventTracker
ReadS [EventTracker]
(Int -> ReadS EventTracker)
-> ReadS [EventTracker]
-> ReadPrec EventTracker
-> ReadPrec [EventTracker]
-> Read EventTracker
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EventTracker]
$creadListPrec :: ReadPrec [EventTracker]
readPrec :: ReadPrec EventTracker
$creadPrec :: ReadPrec EventTracker
readList :: ReadS [EventTracker]
$creadList :: ReadS [EventTracker]
readsPrec :: Int -> ReadS EventTracker
$creadsPrec :: Int -> ReadS EventTracker
Prelude.Read, Int -> EventTracker -> ShowS
[EventTracker] -> ShowS
EventTracker -> String
(Int -> EventTracker -> ShowS)
-> (EventTracker -> String)
-> ([EventTracker] -> ShowS)
-> Show EventTracker
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EventTracker] -> ShowS
$cshowList :: [EventTracker] -> ShowS
show :: EventTracker -> String
$cshow :: EventTracker -> String
showsPrec :: Int -> EventTracker -> ShowS
$cshowsPrec :: Int -> EventTracker -> ShowS
Prelude.Show, (forall x. EventTracker -> Rep EventTracker x)
-> (forall x. Rep EventTracker x -> EventTracker)
-> Generic EventTracker
forall x. Rep EventTracker x -> EventTracker
forall x. EventTracker -> Rep EventTracker x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EventTracker x -> EventTracker
$cfrom :: forall x. EventTracker -> Rep EventTracker x
Prelude.Generic)

-- |
-- Create a value of 'EventTracker' 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:
--
-- 'status', 'eventTracker_status' - The status of the event tracker.
--
-- An event tracker can be in one of the following states:
--
-- -   CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED
--
-- -   DELETE PENDING > DELETE IN_PROGRESS
--
-- 'trackingId', 'eventTracker_trackingId' - The ID of the event tracker. Include this ID in requests to the
-- <https://docs.aws.amazon.com/personalize/latest/dg/API_UBS_PutEvents.html PutEvents>
-- API.
--
-- 'lastUpdatedDateTime', 'eventTracker_lastUpdatedDateTime' - The date and time (in Unix time) that the event tracker was last
-- updated.
--
-- 'accountId', 'eventTracker_accountId' - The Amazon Web Services account that owns the event tracker.
--
-- 'name', 'eventTracker_name' - The name of the event tracker.
--
-- 'creationDateTime', 'eventTracker_creationDateTime' - The date and time (in Unix format) that the event tracker was created.
--
-- 'datasetGroupArn', 'eventTracker_datasetGroupArn' - The Amazon Resource Name (ARN) of the dataset group that receives the
-- event data.
--
-- 'eventTrackerArn', 'eventTracker_eventTrackerArn' - The ARN of the event tracker.
newEventTracker ::
  EventTracker
newEventTracker :: EventTracker
newEventTracker =
  EventTracker' :: Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> EventTracker
EventTracker'
    { $sel:status:EventTracker' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:trackingId:EventTracker' :: Maybe Text
trackingId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedDateTime:EventTracker' :: Maybe POSIX
lastUpdatedDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:accountId:EventTracker' :: Maybe Text
accountId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:EventTracker' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDateTime:EventTracker' :: Maybe POSIX
creationDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:datasetGroupArn:EventTracker' :: Maybe Text
datasetGroupArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:eventTrackerArn:EventTracker' :: Maybe Text
eventTrackerArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the event tracker.
--
-- An event tracker can be in one of the following states:
--
-- -   CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED
--
-- -   DELETE PENDING > DELETE IN_PROGRESS
eventTracker_status :: Lens.Lens' EventTracker (Prelude.Maybe Prelude.Text)
eventTracker_status :: (Maybe Text -> f (Maybe Text)) -> EventTracker -> f EventTracker
eventTracker_status = (EventTracker -> Maybe Text)
-> (EventTracker -> Maybe Text -> EventTracker)
-> Lens EventTracker EventTracker (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventTracker' {Maybe Text
status :: Maybe Text
$sel:status:EventTracker' :: EventTracker -> Maybe Text
status} -> Maybe Text
status) (\s :: EventTracker
s@EventTracker' {} Maybe Text
a -> EventTracker
s {$sel:status:EventTracker' :: Maybe Text
status = Maybe Text
a} :: EventTracker)

-- | The ID of the event tracker. Include this ID in requests to the
-- <https://docs.aws.amazon.com/personalize/latest/dg/API_UBS_PutEvents.html PutEvents>
-- API.
eventTracker_trackingId :: Lens.Lens' EventTracker (Prelude.Maybe Prelude.Text)
eventTracker_trackingId :: (Maybe Text -> f (Maybe Text)) -> EventTracker -> f EventTracker
eventTracker_trackingId = (EventTracker -> Maybe Text)
-> (EventTracker -> Maybe Text -> EventTracker)
-> Lens EventTracker EventTracker (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventTracker' {Maybe Text
trackingId :: Maybe Text
$sel:trackingId:EventTracker' :: EventTracker -> Maybe Text
trackingId} -> Maybe Text
trackingId) (\s :: EventTracker
s@EventTracker' {} Maybe Text
a -> EventTracker
s {$sel:trackingId:EventTracker' :: Maybe Text
trackingId = Maybe Text
a} :: EventTracker)

-- | The date and time (in Unix time) that the event tracker was last
-- updated.
eventTracker_lastUpdatedDateTime :: Lens.Lens' EventTracker (Prelude.Maybe Prelude.UTCTime)
eventTracker_lastUpdatedDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> EventTracker -> f EventTracker
eventTracker_lastUpdatedDateTime = (EventTracker -> Maybe POSIX)
-> (EventTracker -> Maybe POSIX -> EventTracker)
-> Lens EventTracker EventTracker (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventTracker' {Maybe POSIX
lastUpdatedDateTime :: Maybe POSIX
$sel:lastUpdatedDateTime:EventTracker' :: EventTracker -> Maybe POSIX
lastUpdatedDateTime} -> Maybe POSIX
lastUpdatedDateTime) (\s :: EventTracker
s@EventTracker' {} Maybe POSIX
a -> EventTracker
s {$sel:lastUpdatedDateTime:EventTracker' :: Maybe POSIX
lastUpdatedDateTime = Maybe POSIX
a} :: EventTracker) ((Maybe POSIX -> f (Maybe POSIX))
 -> EventTracker -> f EventTracker)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> EventTracker
-> f EventTracker
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 Amazon Web Services account that owns the event tracker.
eventTracker_accountId :: Lens.Lens' EventTracker (Prelude.Maybe Prelude.Text)
eventTracker_accountId :: (Maybe Text -> f (Maybe Text)) -> EventTracker -> f EventTracker
eventTracker_accountId = (EventTracker -> Maybe Text)
-> (EventTracker -> Maybe Text -> EventTracker)
-> Lens EventTracker EventTracker (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventTracker' {Maybe Text
accountId :: Maybe Text
$sel:accountId:EventTracker' :: EventTracker -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: EventTracker
s@EventTracker' {} Maybe Text
a -> EventTracker
s {$sel:accountId:EventTracker' :: Maybe Text
accountId = Maybe Text
a} :: EventTracker)

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

-- | The date and time (in Unix format) that the event tracker was created.
eventTracker_creationDateTime :: Lens.Lens' EventTracker (Prelude.Maybe Prelude.UTCTime)
eventTracker_creationDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> EventTracker -> f EventTracker
eventTracker_creationDateTime = (EventTracker -> Maybe POSIX)
-> (EventTracker -> Maybe POSIX -> EventTracker)
-> Lens EventTracker EventTracker (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventTracker' {Maybe POSIX
creationDateTime :: Maybe POSIX
$sel:creationDateTime:EventTracker' :: EventTracker -> Maybe POSIX
creationDateTime} -> Maybe POSIX
creationDateTime) (\s :: EventTracker
s@EventTracker' {} Maybe POSIX
a -> EventTracker
s {$sel:creationDateTime:EventTracker' :: Maybe POSIX
creationDateTime = Maybe POSIX
a} :: EventTracker) ((Maybe POSIX -> f (Maybe POSIX))
 -> EventTracker -> f EventTracker)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> EventTracker
-> f EventTracker
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 Amazon Resource Name (ARN) of the dataset group that receives the
-- event data.
eventTracker_datasetGroupArn :: Lens.Lens' EventTracker (Prelude.Maybe Prelude.Text)
eventTracker_datasetGroupArn :: (Maybe Text -> f (Maybe Text)) -> EventTracker -> f EventTracker
eventTracker_datasetGroupArn = (EventTracker -> Maybe Text)
-> (EventTracker -> Maybe Text -> EventTracker)
-> Lens EventTracker EventTracker (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventTracker' {Maybe Text
datasetGroupArn :: Maybe Text
$sel:datasetGroupArn:EventTracker' :: EventTracker -> Maybe Text
datasetGroupArn} -> Maybe Text
datasetGroupArn) (\s :: EventTracker
s@EventTracker' {} Maybe Text
a -> EventTracker
s {$sel:datasetGroupArn:EventTracker' :: Maybe Text
datasetGroupArn = Maybe Text
a} :: EventTracker)

-- | The ARN of the event tracker.
eventTracker_eventTrackerArn :: Lens.Lens' EventTracker (Prelude.Maybe Prelude.Text)
eventTracker_eventTrackerArn :: (Maybe Text -> f (Maybe Text)) -> EventTracker -> f EventTracker
eventTracker_eventTrackerArn = (EventTracker -> Maybe Text)
-> (EventTracker -> Maybe Text -> EventTracker)
-> Lens EventTracker EventTracker (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventTracker' {Maybe Text
eventTrackerArn :: Maybe Text
$sel:eventTrackerArn:EventTracker' :: EventTracker -> Maybe Text
eventTrackerArn} -> Maybe Text
eventTrackerArn) (\s :: EventTracker
s@EventTracker' {} Maybe Text
a -> EventTracker
s {$sel:eventTrackerArn:EventTracker' :: Maybe Text
eventTrackerArn = Maybe Text
a} :: EventTracker)

instance Core.FromJSON EventTracker where
  parseJSON :: Value -> Parser EventTracker
parseJSON =
    String
-> (Object -> Parser EventTracker) -> Value -> Parser EventTracker
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EventTracker"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> EventTracker
EventTracker'
            (Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> EventTracker)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> EventTracker)
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
"status")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> EventTracker)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> EventTracker)
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
"trackingId")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> EventTracker)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> EventTracker)
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
   -> Maybe Text
   -> EventTracker)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX -> Maybe Text -> Maybe Text -> EventTracker)
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
"accountId")
            Parser
  (Maybe Text
   -> Maybe POSIX -> Maybe Text -> Maybe Text -> EventTracker)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe Text -> Maybe Text -> EventTracker)
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 POSIX -> Maybe Text -> Maybe Text -> EventTracker)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> Maybe Text -> EventTracker)
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 -> Maybe Text -> EventTracker)
-> Parser (Maybe Text) -> Parser (Maybe Text -> EventTracker)
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")
            Parser (Maybe Text -> EventTracker)
-> Parser (Maybe Text) -> Parser EventTracker
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
"eventTrackerArn")
      )

instance Prelude.Hashable EventTracker

instance Prelude.NFData EventTracker