{-# 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.CustomerProfiles.Types.ListDomainItem
-- 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.CustomerProfiles.Types.ListDomainItem where

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

-- | An object in a list that represents a domain.
--
-- /See:/ 'newListDomainItem' smart constructor.
data ListDomainItem = ListDomainItem'
  { -- | The tags used to organize, track, or control access for this resource.
    ListDomainItem -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The unique name of the domain.
    ListDomainItem -> Text
domainName :: Prelude.Text,
    -- | The timestamp of when the domain was created.
    ListDomainItem -> POSIX
createdAt :: Core.POSIX,
    -- | The timestamp of when the domain was most recently edited.
    ListDomainItem -> POSIX
lastUpdatedAt :: Core.POSIX
  }
  deriving (ListDomainItem -> ListDomainItem -> Bool
(ListDomainItem -> ListDomainItem -> Bool)
-> (ListDomainItem -> ListDomainItem -> Bool) -> Eq ListDomainItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDomainItem -> ListDomainItem -> Bool
$c/= :: ListDomainItem -> ListDomainItem -> Bool
== :: ListDomainItem -> ListDomainItem -> Bool
$c== :: ListDomainItem -> ListDomainItem -> Bool
Prelude.Eq, ReadPrec [ListDomainItem]
ReadPrec ListDomainItem
Int -> ReadS ListDomainItem
ReadS [ListDomainItem]
(Int -> ReadS ListDomainItem)
-> ReadS [ListDomainItem]
-> ReadPrec ListDomainItem
-> ReadPrec [ListDomainItem]
-> Read ListDomainItem
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDomainItem]
$creadListPrec :: ReadPrec [ListDomainItem]
readPrec :: ReadPrec ListDomainItem
$creadPrec :: ReadPrec ListDomainItem
readList :: ReadS [ListDomainItem]
$creadList :: ReadS [ListDomainItem]
readsPrec :: Int -> ReadS ListDomainItem
$creadsPrec :: Int -> ReadS ListDomainItem
Prelude.Read, Int -> ListDomainItem -> ShowS
[ListDomainItem] -> ShowS
ListDomainItem -> String
(Int -> ListDomainItem -> ShowS)
-> (ListDomainItem -> String)
-> ([ListDomainItem] -> ShowS)
-> Show ListDomainItem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDomainItem] -> ShowS
$cshowList :: [ListDomainItem] -> ShowS
show :: ListDomainItem -> String
$cshow :: ListDomainItem -> String
showsPrec :: Int -> ListDomainItem -> ShowS
$cshowsPrec :: Int -> ListDomainItem -> ShowS
Prelude.Show, (forall x. ListDomainItem -> Rep ListDomainItem x)
-> (forall x. Rep ListDomainItem x -> ListDomainItem)
-> Generic ListDomainItem
forall x. Rep ListDomainItem x -> ListDomainItem
forall x. ListDomainItem -> Rep ListDomainItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListDomainItem x -> ListDomainItem
$cfrom :: forall x. ListDomainItem -> Rep ListDomainItem x
Prelude.Generic)

-- |
-- Create a value of 'ListDomainItem' 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:
--
-- 'tags', 'listDomainItem_tags' - The tags used to organize, track, or control access for this resource.
--
-- 'domainName', 'listDomainItem_domainName' - The unique name of the domain.
--
-- 'createdAt', 'listDomainItem_createdAt' - The timestamp of when the domain was created.
--
-- 'lastUpdatedAt', 'listDomainItem_lastUpdatedAt' - The timestamp of when the domain was most recently edited.
newListDomainItem ::
  -- | 'domainName'
  Prelude.Text ->
  -- | 'createdAt'
  Prelude.UTCTime ->
  -- | 'lastUpdatedAt'
  Prelude.UTCTime ->
  ListDomainItem
newListDomainItem :: Text -> UTCTime -> UTCTime -> ListDomainItem
newListDomainItem
  Text
pDomainName_
  UTCTime
pCreatedAt_
  UTCTime
pLastUpdatedAt_ =
    ListDomainItem' :: Maybe (HashMap Text Text)
-> Text -> POSIX -> POSIX -> ListDomainItem
ListDomainItem'
      { $sel:tags:ListDomainItem' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:domainName:ListDomainItem' :: Text
domainName = Text
pDomainName_,
        $sel:createdAt:ListDomainItem' :: POSIX
createdAt = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreatedAt_,
        $sel:lastUpdatedAt:ListDomainItem' :: POSIX
lastUpdatedAt = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pLastUpdatedAt_
      }

-- | The tags used to organize, track, or control access for this resource.
listDomainItem_tags :: Lens.Lens' ListDomainItem (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
listDomainItem_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ListDomainItem -> f ListDomainItem
listDomainItem_tags = (ListDomainItem -> Maybe (HashMap Text Text))
-> (ListDomainItem -> Maybe (HashMap Text Text) -> ListDomainItem)
-> Lens
     ListDomainItem
     ListDomainItem
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDomainItem' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:ListDomainItem' :: ListDomainItem -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: ListDomainItem
s@ListDomainItem' {} Maybe (HashMap Text Text)
a -> ListDomainItem
s {$sel:tags:ListDomainItem' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: ListDomainItem) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> ListDomainItem -> f ListDomainItem)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ListDomainItem
-> f ListDomainItem
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The unique name of the domain.
listDomainItem_domainName :: Lens.Lens' ListDomainItem Prelude.Text
listDomainItem_domainName :: (Text -> f Text) -> ListDomainItem -> f ListDomainItem
listDomainItem_domainName = (ListDomainItem -> Text)
-> (ListDomainItem -> Text -> ListDomainItem)
-> Lens ListDomainItem ListDomainItem Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDomainItem' {Text
domainName :: Text
$sel:domainName:ListDomainItem' :: ListDomainItem -> Text
domainName} -> Text
domainName) (\s :: ListDomainItem
s@ListDomainItem' {} Text
a -> ListDomainItem
s {$sel:domainName:ListDomainItem' :: Text
domainName = Text
a} :: ListDomainItem)

-- | The timestamp of when the domain was created.
listDomainItem_createdAt :: Lens.Lens' ListDomainItem Prelude.UTCTime
listDomainItem_createdAt :: (UTCTime -> f UTCTime) -> ListDomainItem -> f ListDomainItem
listDomainItem_createdAt = (ListDomainItem -> POSIX)
-> (ListDomainItem -> POSIX -> ListDomainItem)
-> Lens ListDomainItem ListDomainItem POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDomainItem' {POSIX
createdAt :: POSIX
$sel:createdAt:ListDomainItem' :: ListDomainItem -> POSIX
createdAt} -> POSIX
createdAt) (\s :: ListDomainItem
s@ListDomainItem' {} POSIX
a -> ListDomainItem
s {$sel:createdAt:ListDomainItem' :: POSIX
createdAt = POSIX
a} :: ListDomainItem) ((POSIX -> f POSIX) -> ListDomainItem -> f ListDomainItem)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> ListDomainItem
-> f ListDomainItem
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The timestamp of when the domain was most recently edited.
listDomainItem_lastUpdatedAt :: Lens.Lens' ListDomainItem Prelude.UTCTime
listDomainItem_lastUpdatedAt :: (UTCTime -> f UTCTime) -> ListDomainItem -> f ListDomainItem
listDomainItem_lastUpdatedAt = (ListDomainItem -> POSIX)
-> (ListDomainItem -> POSIX -> ListDomainItem)
-> Lens ListDomainItem ListDomainItem POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDomainItem' {POSIX
lastUpdatedAt :: POSIX
$sel:lastUpdatedAt:ListDomainItem' :: ListDomainItem -> POSIX
lastUpdatedAt} -> POSIX
lastUpdatedAt) (\s :: ListDomainItem
s@ListDomainItem' {} POSIX
a -> ListDomainItem
s {$sel:lastUpdatedAt:ListDomainItem' :: POSIX
lastUpdatedAt = POSIX
a} :: ListDomainItem) ((POSIX -> f POSIX) -> ListDomainItem -> f ListDomainItem)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> ListDomainItem
-> f ListDomainItem
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON ListDomainItem where
  parseJSON :: Value -> Parser ListDomainItem
parseJSON =
    String
-> (Object -> Parser ListDomainItem)
-> Value
-> Parser ListDomainItem
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ListDomainItem"
      ( \Object
x ->
          Maybe (HashMap Text Text)
-> Text -> POSIX -> POSIX -> ListDomainItem
ListDomainItem'
            (Maybe (HashMap Text Text)
 -> Text -> POSIX -> POSIX -> ListDomainItem)
-> Parser (Maybe (HashMap Text Text))
-> Parser (Text -> POSIX -> POSIX -> ListDomainItem)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Tags" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Parser (Text -> POSIX -> POSIX -> ListDomainItem)
-> Parser Text -> Parser (POSIX -> POSIX -> ListDomainItem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"DomainName")
            Parser (POSIX -> POSIX -> ListDomainItem)
-> Parser POSIX -> Parser (POSIX -> ListDomainItem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"CreatedAt")
            Parser (POSIX -> ListDomainItem)
-> Parser POSIX -> Parser ListDomainItem
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"LastUpdatedAt")
      )

instance Prelude.Hashable ListDomainItem

instance Prelude.NFData ListDomainItem