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

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

-- | A structure containing migration status information.
--
-- /See:/ 'newCatalogImportStatus' smart constructor.
data CatalogImportStatus = CatalogImportStatus'
  { -- | The name of the person who initiated the migration.
    CatalogImportStatus -> Maybe Text
importedBy :: Prelude.Maybe Prelude.Text,
    -- | The time that the migration was started.
    CatalogImportStatus -> Maybe POSIX
importTime :: Prelude.Maybe Core.POSIX,
    -- | @True@ if the migration has completed, or @False@ otherwise.
    CatalogImportStatus -> Maybe Bool
importCompleted :: Prelude.Maybe Prelude.Bool
  }
  deriving (CatalogImportStatus -> CatalogImportStatus -> Bool
(CatalogImportStatus -> CatalogImportStatus -> Bool)
-> (CatalogImportStatus -> CatalogImportStatus -> Bool)
-> Eq CatalogImportStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CatalogImportStatus -> CatalogImportStatus -> Bool
$c/= :: CatalogImportStatus -> CatalogImportStatus -> Bool
== :: CatalogImportStatus -> CatalogImportStatus -> Bool
$c== :: CatalogImportStatus -> CatalogImportStatus -> Bool
Prelude.Eq, ReadPrec [CatalogImportStatus]
ReadPrec CatalogImportStatus
Int -> ReadS CatalogImportStatus
ReadS [CatalogImportStatus]
(Int -> ReadS CatalogImportStatus)
-> ReadS [CatalogImportStatus]
-> ReadPrec CatalogImportStatus
-> ReadPrec [CatalogImportStatus]
-> Read CatalogImportStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CatalogImportStatus]
$creadListPrec :: ReadPrec [CatalogImportStatus]
readPrec :: ReadPrec CatalogImportStatus
$creadPrec :: ReadPrec CatalogImportStatus
readList :: ReadS [CatalogImportStatus]
$creadList :: ReadS [CatalogImportStatus]
readsPrec :: Int -> ReadS CatalogImportStatus
$creadsPrec :: Int -> ReadS CatalogImportStatus
Prelude.Read, Int -> CatalogImportStatus -> ShowS
[CatalogImportStatus] -> ShowS
CatalogImportStatus -> String
(Int -> CatalogImportStatus -> ShowS)
-> (CatalogImportStatus -> String)
-> ([CatalogImportStatus] -> ShowS)
-> Show CatalogImportStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CatalogImportStatus] -> ShowS
$cshowList :: [CatalogImportStatus] -> ShowS
show :: CatalogImportStatus -> String
$cshow :: CatalogImportStatus -> String
showsPrec :: Int -> CatalogImportStatus -> ShowS
$cshowsPrec :: Int -> CatalogImportStatus -> ShowS
Prelude.Show, (forall x. CatalogImportStatus -> Rep CatalogImportStatus x)
-> (forall x. Rep CatalogImportStatus x -> CatalogImportStatus)
-> Generic CatalogImportStatus
forall x. Rep CatalogImportStatus x -> CatalogImportStatus
forall x. CatalogImportStatus -> Rep CatalogImportStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CatalogImportStatus x -> CatalogImportStatus
$cfrom :: forall x. CatalogImportStatus -> Rep CatalogImportStatus x
Prelude.Generic)

-- |
-- Create a value of 'CatalogImportStatus' 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:
--
-- 'importedBy', 'catalogImportStatus_importedBy' - The name of the person who initiated the migration.
--
-- 'importTime', 'catalogImportStatus_importTime' - The time that the migration was started.
--
-- 'importCompleted', 'catalogImportStatus_importCompleted' - @True@ if the migration has completed, or @False@ otherwise.
newCatalogImportStatus ::
  CatalogImportStatus
newCatalogImportStatus :: CatalogImportStatus
newCatalogImportStatus =
  CatalogImportStatus' :: Maybe Text -> Maybe POSIX -> Maybe Bool -> CatalogImportStatus
CatalogImportStatus'
    { $sel:importedBy:CatalogImportStatus' :: Maybe Text
importedBy = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:importTime:CatalogImportStatus' :: Maybe POSIX
importTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:importCompleted:CatalogImportStatus' :: Maybe Bool
importCompleted = Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the person who initiated the migration.
catalogImportStatus_importedBy :: Lens.Lens' CatalogImportStatus (Prelude.Maybe Prelude.Text)
catalogImportStatus_importedBy :: (Maybe Text -> f (Maybe Text))
-> CatalogImportStatus -> f CatalogImportStatus
catalogImportStatus_importedBy = (CatalogImportStatus -> Maybe Text)
-> (CatalogImportStatus -> Maybe Text -> CatalogImportStatus)
-> Lens
     CatalogImportStatus CatalogImportStatus (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CatalogImportStatus' {Maybe Text
importedBy :: Maybe Text
$sel:importedBy:CatalogImportStatus' :: CatalogImportStatus -> Maybe Text
importedBy} -> Maybe Text
importedBy) (\s :: CatalogImportStatus
s@CatalogImportStatus' {} Maybe Text
a -> CatalogImportStatus
s {$sel:importedBy:CatalogImportStatus' :: Maybe Text
importedBy = Maybe Text
a} :: CatalogImportStatus)

-- | The time that the migration was started.
catalogImportStatus_importTime :: Lens.Lens' CatalogImportStatus (Prelude.Maybe Prelude.UTCTime)
catalogImportStatus_importTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CatalogImportStatus -> f CatalogImportStatus
catalogImportStatus_importTime = (CatalogImportStatus -> Maybe POSIX)
-> (CatalogImportStatus -> Maybe POSIX -> CatalogImportStatus)
-> Lens
     CatalogImportStatus CatalogImportStatus (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CatalogImportStatus' {Maybe POSIX
importTime :: Maybe POSIX
$sel:importTime:CatalogImportStatus' :: CatalogImportStatus -> Maybe POSIX
importTime} -> Maybe POSIX
importTime) (\s :: CatalogImportStatus
s@CatalogImportStatus' {} Maybe POSIX
a -> CatalogImportStatus
s {$sel:importTime:CatalogImportStatus' :: Maybe POSIX
importTime = Maybe POSIX
a} :: CatalogImportStatus) ((Maybe POSIX -> f (Maybe POSIX))
 -> CatalogImportStatus -> f CatalogImportStatus)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CatalogImportStatus
-> f CatalogImportStatus
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

-- | @True@ if the migration has completed, or @False@ otherwise.
catalogImportStatus_importCompleted :: Lens.Lens' CatalogImportStatus (Prelude.Maybe Prelude.Bool)
catalogImportStatus_importCompleted :: (Maybe Bool -> f (Maybe Bool))
-> CatalogImportStatus -> f CatalogImportStatus
catalogImportStatus_importCompleted = (CatalogImportStatus -> Maybe Bool)
-> (CatalogImportStatus -> Maybe Bool -> CatalogImportStatus)
-> Lens
     CatalogImportStatus CatalogImportStatus (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CatalogImportStatus' {Maybe Bool
importCompleted :: Maybe Bool
$sel:importCompleted:CatalogImportStatus' :: CatalogImportStatus -> Maybe Bool
importCompleted} -> Maybe Bool
importCompleted) (\s :: CatalogImportStatus
s@CatalogImportStatus' {} Maybe Bool
a -> CatalogImportStatus
s {$sel:importCompleted:CatalogImportStatus' :: Maybe Bool
importCompleted = Maybe Bool
a} :: CatalogImportStatus)

instance Core.FromJSON CatalogImportStatus where
  parseJSON :: Value -> Parser CatalogImportStatus
parseJSON =
    String
-> (Object -> Parser CatalogImportStatus)
-> Value
-> Parser CatalogImportStatus
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CatalogImportStatus"
      ( \Object
x ->
          Maybe Text -> Maybe POSIX -> Maybe Bool -> CatalogImportStatus
CatalogImportStatus'
            (Maybe Text -> Maybe POSIX -> Maybe Bool -> CatalogImportStatus)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe Bool -> CatalogImportStatus)
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
"ImportedBy")
            Parser (Maybe POSIX -> Maybe Bool -> CatalogImportStatus)
-> Parser (Maybe POSIX)
-> Parser (Maybe Bool -> CatalogImportStatus)
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
"ImportTime")
            Parser (Maybe Bool -> CatalogImportStatus)
-> Parser (Maybe Bool) -> Parser CatalogImportStatus
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ImportCompleted")
      )

instance Prelude.Hashable CatalogImportStatus

instance Prelude.NFData CatalogImportStatus