{-# 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.CloudTrail.Types.ImportsListItem
-- 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.CloudTrail.Types.ImportsListItem where

import Amazonka.CloudTrail.Types.ImportStatus
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Contains information about an import that was returned by a lookup
-- request.
--
-- /See:/ 'newImportsListItem' smart constructor.
data ImportsListItem = ImportsListItem'
  { -- | The timestamp of the import\'s creation.
    ImportsListItem -> Maybe POSIX
createdTimestamp :: Prelude.Maybe Data.POSIX,
    -- | The ARN of the destination event data store.
    ImportsListItem -> Maybe (NonEmpty Text)
destinations :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The ID of the import.
    ImportsListItem -> Maybe Text
importId :: Prelude.Maybe Prelude.Text,
    -- | The status of the import.
    ImportsListItem -> Maybe ImportStatus
importStatus :: Prelude.Maybe ImportStatus,
    -- | The timestamp of the import\'s last update.
    ImportsListItem -> Maybe POSIX
updatedTimestamp :: Prelude.Maybe Data.POSIX
  }
  deriving (ImportsListItem -> ImportsListItem -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportsListItem -> ImportsListItem -> Bool
$c/= :: ImportsListItem -> ImportsListItem -> Bool
== :: ImportsListItem -> ImportsListItem -> Bool
$c== :: ImportsListItem -> ImportsListItem -> Bool
Prelude.Eq, ReadPrec [ImportsListItem]
ReadPrec ImportsListItem
Int -> ReadS ImportsListItem
ReadS [ImportsListItem]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImportsListItem]
$creadListPrec :: ReadPrec [ImportsListItem]
readPrec :: ReadPrec ImportsListItem
$creadPrec :: ReadPrec ImportsListItem
readList :: ReadS [ImportsListItem]
$creadList :: ReadS [ImportsListItem]
readsPrec :: Int -> ReadS ImportsListItem
$creadsPrec :: Int -> ReadS ImportsListItem
Prelude.Read, Int -> ImportsListItem -> ShowS
[ImportsListItem] -> ShowS
ImportsListItem -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImportsListItem] -> ShowS
$cshowList :: [ImportsListItem] -> ShowS
show :: ImportsListItem -> String
$cshow :: ImportsListItem -> String
showsPrec :: Int -> ImportsListItem -> ShowS
$cshowsPrec :: Int -> ImportsListItem -> ShowS
Prelude.Show, forall x. Rep ImportsListItem x -> ImportsListItem
forall x. ImportsListItem -> Rep ImportsListItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImportsListItem x -> ImportsListItem
$cfrom :: forall x. ImportsListItem -> Rep ImportsListItem x
Prelude.Generic)

-- |
-- Create a value of 'ImportsListItem' 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:
--
-- 'createdTimestamp', 'importsListItem_createdTimestamp' - The timestamp of the import\'s creation.
--
-- 'destinations', 'importsListItem_destinations' - The ARN of the destination event data store.
--
-- 'importId', 'importsListItem_importId' - The ID of the import.
--
-- 'importStatus', 'importsListItem_importStatus' - The status of the import.
--
-- 'updatedTimestamp', 'importsListItem_updatedTimestamp' - The timestamp of the import\'s last update.
newImportsListItem ::
  ImportsListItem
newImportsListItem :: ImportsListItem
newImportsListItem =
  ImportsListItem'
    { $sel:createdTimestamp:ImportsListItem' :: Maybe POSIX
createdTimestamp =
        forall a. Maybe a
Prelude.Nothing,
      $sel:destinations:ImportsListItem' :: Maybe (NonEmpty Text)
destinations = forall a. Maybe a
Prelude.Nothing,
      $sel:importId:ImportsListItem' :: Maybe Text
importId = forall a. Maybe a
Prelude.Nothing,
      $sel:importStatus:ImportsListItem' :: Maybe ImportStatus
importStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:updatedTimestamp:ImportsListItem' :: Maybe POSIX
updatedTimestamp = forall a. Maybe a
Prelude.Nothing
    }

-- | The timestamp of the import\'s creation.
importsListItem_createdTimestamp :: Lens.Lens' ImportsListItem (Prelude.Maybe Prelude.UTCTime)
importsListItem_createdTimestamp :: Lens' ImportsListItem (Maybe UTCTime)
importsListItem_createdTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportsListItem' {Maybe POSIX
createdTimestamp :: Maybe POSIX
$sel:createdTimestamp:ImportsListItem' :: ImportsListItem -> Maybe POSIX
createdTimestamp} -> Maybe POSIX
createdTimestamp) (\s :: ImportsListItem
s@ImportsListItem' {} Maybe POSIX
a -> ImportsListItem
s {$sel:createdTimestamp:ImportsListItem' :: Maybe POSIX
createdTimestamp = Maybe POSIX
a} :: ImportsListItem) 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

-- | The ARN of the destination event data store.
importsListItem_destinations :: Lens.Lens' ImportsListItem (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
importsListItem_destinations :: Lens' ImportsListItem (Maybe (NonEmpty Text))
importsListItem_destinations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportsListItem' {Maybe (NonEmpty Text)
destinations :: Maybe (NonEmpty Text)
$sel:destinations:ImportsListItem' :: ImportsListItem -> Maybe (NonEmpty Text)
destinations} -> Maybe (NonEmpty Text)
destinations) (\s :: ImportsListItem
s@ImportsListItem' {} Maybe (NonEmpty Text)
a -> ImportsListItem
s {$sel:destinations:ImportsListItem' :: Maybe (NonEmpty Text)
destinations = Maybe (NonEmpty Text)
a} :: ImportsListItem) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ID of the import.
importsListItem_importId :: Lens.Lens' ImportsListItem (Prelude.Maybe Prelude.Text)
importsListItem_importId :: Lens' ImportsListItem (Maybe Text)
importsListItem_importId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportsListItem' {Maybe Text
importId :: Maybe Text
$sel:importId:ImportsListItem' :: ImportsListItem -> Maybe Text
importId} -> Maybe Text
importId) (\s :: ImportsListItem
s@ImportsListItem' {} Maybe Text
a -> ImportsListItem
s {$sel:importId:ImportsListItem' :: Maybe Text
importId = Maybe Text
a} :: ImportsListItem)

-- | The status of the import.
importsListItem_importStatus :: Lens.Lens' ImportsListItem (Prelude.Maybe ImportStatus)
importsListItem_importStatus :: Lens' ImportsListItem (Maybe ImportStatus)
importsListItem_importStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportsListItem' {Maybe ImportStatus
importStatus :: Maybe ImportStatus
$sel:importStatus:ImportsListItem' :: ImportsListItem -> Maybe ImportStatus
importStatus} -> Maybe ImportStatus
importStatus) (\s :: ImportsListItem
s@ImportsListItem' {} Maybe ImportStatus
a -> ImportsListItem
s {$sel:importStatus:ImportsListItem' :: Maybe ImportStatus
importStatus = Maybe ImportStatus
a} :: ImportsListItem)

-- | The timestamp of the import\'s last update.
importsListItem_updatedTimestamp :: Lens.Lens' ImportsListItem (Prelude.Maybe Prelude.UTCTime)
importsListItem_updatedTimestamp :: Lens' ImportsListItem (Maybe UTCTime)
importsListItem_updatedTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportsListItem' {Maybe POSIX
updatedTimestamp :: Maybe POSIX
$sel:updatedTimestamp:ImportsListItem' :: ImportsListItem -> Maybe POSIX
updatedTimestamp} -> Maybe POSIX
updatedTimestamp) (\s :: ImportsListItem
s@ImportsListItem' {} Maybe POSIX
a -> ImportsListItem
s {$sel:updatedTimestamp:ImportsListItem' :: Maybe POSIX
updatedTimestamp = Maybe POSIX
a} :: ImportsListItem) 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

instance Data.FromJSON ImportsListItem where
  parseJSON :: Value -> Parser ImportsListItem
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ImportsListItem"
      ( \Object
x ->
          Maybe POSIX
-> Maybe (NonEmpty Text)
-> Maybe Text
-> Maybe ImportStatus
-> Maybe POSIX
-> ImportsListItem
ImportsListItem'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CreatedTimestamp")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Destinations")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ImportId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ImportStatus")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"UpdatedTimestamp")
      )

instance Prelude.Hashable ImportsListItem where
  hashWithSalt :: Int -> ImportsListItem -> Int
hashWithSalt Int
_salt ImportsListItem' {Maybe (NonEmpty Text)
Maybe Text
Maybe POSIX
Maybe ImportStatus
updatedTimestamp :: Maybe POSIX
importStatus :: Maybe ImportStatus
importId :: Maybe Text
destinations :: Maybe (NonEmpty Text)
createdTimestamp :: Maybe POSIX
$sel:updatedTimestamp:ImportsListItem' :: ImportsListItem -> Maybe POSIX
$sel:importStatus:ImportsListItem' :: ImportsListItem -> Maybe ImportStatus
$sel:importId:ImportsListItem' :: ImportsListItem -> Maybe Text
$sel:destinations:ImportsListItem' :: ImportsListItem -> Maybe (NonEmpty Text)
$sel:createdTimestamp:ImportsListItem' :: ImportsListItem -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdTimestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
destinations
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
importId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ImportStatus
importStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
updatedTimestamp

instance Prelude.NFData ImportsListItem where
  rnf :: ImportsListItem -> ()
rnf ImportsListItem' {Maybe (NonEmpty Text)
Maybe Text
Maybe POSIX
Maybe ImportStatus
updatedTimestamp :: Maybe POSIX
importStatus :: Maybe ImportStatus
importId :: Maybe Text
destinations :: Maybe (NonEmpty Text)
createdTimestamp :: Maybe POSIX
$sel:updatedTimestamp:ImportsListItem' :: ImportsListItem -> Maybe POSIX
$sel:importStatus:ImportsListItem' :: ImportsListItem -> Maybe ImportStatus
$sel:importId:ImportsListItem' :: ImportsListItem -> Maybe Text
$sel:destinations:ImportsListItem' :: ImportsListItem -> Maybe (NonEmpty Text)
$sel:createdTimestamp:ImportsListItem' :: ImportsListItem -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdTimestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
destinations
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
importId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ImportStatus
importStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
updatedTimestamp