{-# 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.DMS.Types.RefreshSchemasStatus
-- 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.DMS.Types.RefreshSchemasStatus where

import qualified Amazonka.Core as Core
import Amazonka.DMS.Types.RefreshSchemasStatusTypeValue
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Provides information that describes status of a schema at an endpoint
-- specified by the @DescribeRefreshSchemaStatus@ operation.
--
-- /See:/ 'newRefreshSchemasStatus' smart constructor.
data RefreshSchemasStatus = RefreshSchemasStatus'
  { -- | The status of the schema.
    RefreshSchemasStatus -> Maybe RefreshSchemasStatusTypeValue
status :: Prelude.Maybe RefreshSchemasStatusTypeValue,
    -- | The date the schema was last refreshed.
    RefreshSchemasStatus -> Maybe POSIX
lastRefreshDate :: Prelude.Maybe Core.POSIX,
    -- | The Amazon Resource Name (ARN) of the replication instance.
    RefreshSchemasStatus -> Maybe Text
replicationInstanceArn :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) string that uniquely identifies the
    -- endpoint.
    RefreshSchemasStatus -> Maybe Text
endpointArn :: Prelude.Maybe Prelude.Text,
    -- | The last failure message for the schema.
    RefreshSchemasStatus -> Maybe Text
lastFailureMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (RefreshSchemasStatus -> RefreshSchemasStatus -> Bool
(RefreshSchemasStatus -> RefreshSchemasStatus -> Bool)
-> (RefreshSchemasStatus -> RefreshSchemasStatus -> Bool)
-> Eq RefreshSchemasStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RefreshSchemasStatus -> RefreshSchemasStatus -> Bool
$c/= :: RefreshSchemasStatus -> RefreshSchemasStatus -> Bool
== :: RefreshSchemasStatus -> RefreshSchemasStatus -> Bool
$c== :: RefreshSchemasStatus -> RefreshSchemasStatus -> Bool
Prelude.Eq, ReadPrec [RefreshSchemasStatus]
ReadPrec RefreshSchemasStatus
Int -> ReadS RefreshSchemasStatus
ReadS [RefreshSchemasStatus]
(Int -> ReadS RefreshSchemasStatus)
-> ReadS [RefreshSchemasStatus]
-> ReadPrec RefreshSchemasStatus
-> ReadPrec [RefreshSchemasStatus]
-> Read RefreshSchemasStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RefreshSchemasStatus]
$creadListPrec :: ReadPrec [RefreshSchemasStatus]
readPrec :: ReadPrec RefreshSchemasStatus
$creadPrec :: ReadPrec RefreshSchemasStatus
readList :: ReadS [RefreshSchemasStatus]
$creadList :: ReadS [RefreshSchemasStatus]
readsPrec :: Int -> ReadS RefreshSchemasStatus
$creadsPrec :: Int -> ReadS RefreshSchemasStatus
Prelude.Read, Int -> RefreshSchemasStatus -> ShowS
[RefreshSchemasStatus] -> ShowS
RefreshSchemasStatus -> String
(Int -> RefreshSchemasStatus -> ShowS)
-> (RefreshSchemasStatus -> String)
-> ([RefreshSchemasStatus] -> ShowS)
-> Show RefreshSchemasStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RefreshSchemasStatus] -> ShowS
$cshowList :: [RefreshSchemasStatus] -> ShowS
show :: RefreshSchemasStatus -> String
$cshow :: RefreshSchemasStatus -> String
showsPrec :: Int -> RefreshSchemasStatus -> ShowS
$cshowsPrec :: Int -> RefreshSchemasStatus -> ShowS
Prelude.Show, (forall x. RefreshSchemasStatus -> Rep RefreshSchemasStatus x)
-> (forall x. Rep RefreshSchemasStatus x -> RefreshSchemasStatus)
-> Generic RefreshSchemasStatus
forall x. Rep RefreshSchemasStatus x -> RefreshSchemasStatus
forall x. RefreshSchemasStatus -> Rep RefreshSchemasStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RefreshSchemasStatus x -> RefreshSchemasStatus
$cfrom :: forall x. RefreshSchemasStatus -> Rep RefreshSchemasStatus x
Prelude.Generic)

-- |
-- Create a value of 'RefreshSchemasStatus' 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', 'refreshSchemasStatus_status' - The status of the schema.
--
-- 'lastRefreshDate', 'refreshSchemasStatus_lastRefreshDate' - The date the schema was last refreshed.
--
-- 'replicationInstanceArn', 'refreshSchemasStatus_replicationInstanceArn' - The Amazon Resource Name (ARN) of the replication instance.
--
-- 'endpointArn', 'refreshSchemasStatus_endpointArn' - The Amazon Resource Name (ARN) string that uniquely identifies the
-- endpoint.
--
-- 'lastFailureMessage', 'refreshSchemasStatus_lastFailureMessage' - The last failure message for the schema.
newRefreshSchemasStatus ::
  RefreshSchemasStatus
newRefreshSchemasStatus :: RefreshSchemasStatus
newRefreshSchemasStatus =
  RefreshSchemasStatus' :: Maybe RefreshSchemasStatusTypeValue
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> RefreshSchemasStatus
RefreshSchemasStatus'
    { $sel:status:RefreshSchemasStatus' :: Maybe RefreshSchemasStatusTypeValue
status = Maybe RefreshSchemasStatusTypeValue
forall a. Maybe a
Prelude.Nothing,
      $sel:lastRefreshDate:RefreshSchemasStatus' :: Maybe POSIX
lastRefreshDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:replicationInstanceArn:RefreshSchemasStatus' :: Maybe Text
replicationInstanceArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:endpointArn:RefreshSchemasStatus' :: Maybe Text
endpointArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastFailureMessage:RefreshSchemasStatus' :: Maybe Text
lastFailureMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the schema.
refreshSchemasStatus_status :: Lens.Lens' RefreshSchemasStatus (Prelude.Maybe RefreshSchemasStatusTypeValue)
refreshSchemasStatus_status :: (Maybe RefreshSchemasStatusTypeValue
 -> f (Maybe RefreshSchemasStatusTypeValue))
-> RefreshSchemasStatus -> f RefreshSchemasStatus
refreshSchemasStatus_status = (RefreshSchemasStatus -> Maybe RefreshSchemasStatusTypeValue)
-> (RefreshSchemasStatus
    -> Maybe RefreshSchemasStatusTypeValue -> RefreshSchemasStatus)
-> Lens
     RefreshSchemasStatus
     RefreshSchemasStatus
     (Maybe RefreshSchemasStatusTypeValue)
     (Maybe RefreshSchemasStatusTypeValue)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RefreshSchemasStatus' {Maybe RefreshSchemasStatusTypeValue
status :: Maybe RefreshSchemasStatusTypeValue
$sel:status:RefreshSchemasStatus' :: RefreshSchemasStatus -> Maybe RefreshSchemasStatusTypeValue
status} -> Maybe RefreshSchemasStatusTypeValue
status) (\s :: RefreshSchemasStatus
s@RefreshSchemasStatus' {} Maybe RefreshSchemasStatusTypeValue
a -> RefreshSchemasStatus
s {$sel:status:RefreshSchemasStatus' :: Maybe RefreshSchemasStatusTypeValue
status = Maybe RefreshSchemasStatusTypeValue
a} :: RefreshSchemasStatus)

-- | The date the schema was last refreshed.
refreshSchemasStatus_lastRefreshDate :: Lens.Lens' RefreshSchemasStatus (Prelude.Maybe Prelude.UTCTime)
refreshSchemasStatus_lastRefreshDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> RefreshSchemasStatus -> f RefreshSchemasStatus
refreshSchemasStatus_lastRefreshDate = (RefreshSchemasStatus -> Maybe POSIX)
-> (RefreshSchemasStatus -> Maybe POSIX -> RefreshSchemasStatus)
-> Lens
     RefreshSchemasStatus
     RefreshSchemasStatus
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RefreshSchemasStatus' {Maybe POSIX
lastRefreshDate :: Maybe POSIX
$sel:lastRefreshDate:RefreshSchemasStatus' :: RefreshSchemasStatus -> Maybe POSIX
lastRefreshDate} -> Maybe POSIX
lastRefreshDate) (\s :: RefreshSchemasStatus
s@RefreshSchemasStatus' {} Maybe POSIX
a -> RefreshSchemasStatus
s {$sel:lastRefreshDate:RefreshSchemasStatus' :: Maybe POSIX
lastRefreshDate = Maybe POSIX
a} :: RefreshSchemasStatus) ((Maybe POSIX -> f (Maybe POSIX))
 -> RefreshSchemasStatus -> f RefreshSchemasStatus)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> RefreshSchemasStatus
-> f RefreshSchemasStatus
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 replication instance.
refreshSchemasStatus_replicationInstanceArn :: Lens.Lens' RefreshSchemasStatus (Prelude.Maybe Prelude.Text)
refreshSchemasStatus_replicationInstanceArn :: (Maybe Text -> f (Maybe Text))
-> RefreshSchemasStatus -> f RefreshSchemasStatus
refreshSchemasStatus_replicationInstanceArn = (RefreshSchemasStatus -> Maybe Text)
-> (RefreshSchemasStatus -> Maybe Text -> RefreshSchemasStatus)
-> Lens
     RefreshSchemasStatus RefreshSchemasStatus (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RefreshSchemasStatus' {Maybe Text
replicationInstanceArn :: Maybe Text
$sel:replicationInstanceArn:RefreshSchemasStatus' :: RefreshSchemasStatus -> Maybe Text
replicationInstanceArn} -> Maybe Text
replicationInstanceArn) (\s :: RefreshSchemasStatus
s@RefreshSchemasStatus' {} Maybe Text
a -> RefreshSchemasStatus
s {$sel:replicationInstanceArn:RefreshSchemasStatus' :: Maybe Text
replicationInstanceArn = Maybe Text
a} :: RefreshSchemasStatus)

-- | The Amazon Resource Name (ARN) string that uniquely identifies the
-- endpoint.
refreshSchemasStatus_endpointArn :: Lens.Lens' RefreshSchemasStatus (Prelude.Maybe Prelude.Text)
refreshSchemasStatus_endpointArn :: (Maybe Text -> f (Maybe Text))
-> RefreshSchemasStatus -> f RefreshSchemasStatus
refreshSchemasStatus_endpointArn = (RefreshSchemasStatus -> Maybe Text)
-> (RefreshSchemasStatus -> Maybe Text -> RefreshSchemasStatus)
-> Lens
     RefreshSchemasStatus RefreshSchemasStatus (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RefreshSchemasStatus' {Maybe Text
endpointArn :: Maybe Text
$sel:endpointArn:RefreshSchemasStatus' :: RefreshSchemasStatus -> Maybe Text
endpointArn} -> Maybe Text
endpointArn) (\s :: RefreshSchemasStatus
s@RefreshSchemasStatus' {} Maybe Text
a -> RefreshSchemasStatus
s {$sel:endpointArn:RefreshSchemasStatus' :: Maybe Text
endpointArn = Maybe Text
a} :: RefreshSchemasStatus)

-- | The last failure message for the schema.
refreshSchemasStatus_lastFailureMessage :: Lens.Lens' RefreshSchemasStatus (Prelude.Maybe Prelude.Text)
refreshSchemasStatus_lastFailureMessage :: (Maybe Text -> f (Maybe Text))
-> RefreshSchemasStatus -> f RefreshSchemasStatus
refreshSchemasStatus_lastFailureMessage = (RefreshSchemasStatus -> Maybe Text)
-> (RefreshSchemasStatus -> Maybe Text -> RefreshSchemasStatus)
-> Lens
     RefreshSchemasStatus RefreshSchemasStatus (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RefreshSchemasStatus' {Maybe Text
lastFailureMessage :: Maybe Text
$sel:lastFailureMessage:RefreshSchemasStatus' :: RefreshSchemasStatus -> Maybe Text
lastFailureMessage} -> Maybe Text
lastFailureMessage) (\s :: RefreshSchemasStatus
s@RefreshSchemasStatus' {} Maybe Text
a -> RefreshSchemasStatus
s {$sel:lastFailureMessage:RefreshSchemasStatus' :: Maybe Text
lastFailureMessage = Maybe Text
a} :: RefreshSchemasStatus)

instance Core.FromJSON RefreshSchemasStatus where
  parseJSON :: Value -> Parser RefreshSchemasStatus
parseJSON =
    String
-> (Object -> Parser RefreshSchemasStatus)
-> Value
-> Parser RefreshSchemasStatus
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RefreshSchemasStatus"
      ( \Object
x ->
          Maybe RefreshSchemasStatusTypeValue
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> RefreshSchemasStatus
RefreshSchemasStatus'
            (Maybe RefreshSchemasStatusTypeValue
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> RefreshSchemasStatus)
-> Parser (Maybe RefreshSchemasStatusTypeValue)
-> Parser
     (Maybe POSIX
      -> Maybe Text -> Maybe Text -> Maybe Text -> RefreshSchemasStatus)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe RefreshSchemasStatusTypeValue)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe POSIX
   -> Maybe Text -> Maybe Text -> Maybe Text -> RefreshSchemasStatus)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> RefreshSchemasStatus)
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
"LastRefreshDate")
            Parser
  (Maybe Text -> Maybe Text -> Maybe Text -> RefreshSchemasStatus)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> RefreshSchemasStatus)
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
"ReplicationInstanceArn")
            Parser (Maybe Text -> Maybe Text -> RefreshSchemasStatus)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> RefreshSchemasStatus)
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
"EndpointArn")
            Parser (Maybe Text -> RefreshSchemasStatus)
-> Parser (Maybe Text) -> Parser RefreshSchemasStatus
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
"LastFailureMessage")
      )

instance Prelude.Hashable RefreshSchemasStatus

instance Prelude.NFData RefreshSchemasStatus