{-# 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.ServiceCatalog.Types.LastSync
-- 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.ServiceCatalog.Types.LastSync where

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
import Amazonka.ServiceCatalog.Types.LastSyncStatus

-- | Provides details about the product\'s connection sync and contains the
-- following sub-fields.
--
-- -   @LastSyncTime@
--
-- -   @LastSyncStatus@
--
-- -   @LastSyncStatusMessage@
--
-- -   @LastSuccessfulSyncTime@
--
-- -   @LastSuccessfulSyncProvisioningArtifactID@
--
-- /See:/ 'newLastSync' smart constructor.
data LastSync = LastSync'
  { -- | The ProvisioningArtifactID of the ProvisioningArtifact created from the
    -- latest successful sync.
    LastSync -> Maybe Text
lastSuccessfulSyncProvisioningArtifactId :: Prelude.Maybe Prelude.Text,
    -- | The time of the latest successful sync from the source repo artifact to
    -- the Service Catalog product.
    LastSync -> Maybe POSIX
lastSuccessfulSyncTime :: Prelude.Maybe Data.POSIX,
    -- | The current status of the sync. Responses include @SUCCEEDED@ or
    -- @FAILED@.
    LastSync -> Maybe LastSyncStatus
lastSyncStatus :: Prelude.Maybe LastSyncStatus,
    -- | The sync\'s status message.
    LastSync -> Maybe Text
lastSyncStatusMessage :: Prelude.Maybe Prelude.Text,
    -- | The time of the last attempted sync from the repository to the Service
    -- Catalog product.
    LastSync -> Maybe POSIX
lastSyncTime :: Prelude.Maybe Data.POSIX
  }
  deriving (LastSync -> LastSync -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LastSync -> LastSync -> Bool
$c/= :: LastSync -> LastSync -> Bool
== :: LastSync -> LastSync -> Bool
$c== :: LastSync -> LastSync -> Bool
Prelude.Eq, ReadPrec [LastSync]
ReadPrec LastSync
Int -> ReadS LastSync
ReadS [LastSync]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LastSync]
$creadListPrec :: ReadPrec [LastSync]
readPrec :: ReadPrec LastSync
$creadPrec :: ReadPrec LastSync
readList :: ReadS [LastSync]
$creadList :: ReadS [LastSync]
readsPrec :: Int -> ReadS LastSync
$creadsPrec :: Int -> ReadS LastSync
Prelude.Read, Int -> LastSync -> ShowS
[LastSync] -> ShowS
LastSync -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LastSync] -> ShowS
$cshowList :: [LastSync] -> ShowS
show :: LastSync -> String
$cshow :: LastSync -> String
showsPrec :: Int -> LastSync -> ShowS
$cshowsPrec :: Int -> LastSync -> ShowS
Prelude.Show, forall x. Rep LastSync x -> LastSync
forall x. LastSync -> Rep LastSync x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LastSync x -> LastSync
$cfrom :: forall x. LastSync -> Rep LastSync x
Prelude.Generic)

-- |
-- Create a value of 'LastSync' 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:
--
-- 'lastSuccessfulSyncProvisioningArtifactId', 'lastSync_lastSuccessfulSyncProvisioningArtifactId' - The ProvisioningArtifactID of the ProvisioningArtifact created from the
-- latest successful sync.
--
-- 'lastSuccessfulSyncTime', 'lastSync_lastSuccessfulSyncTime' - The time of the latest successful sync from the source repo artifact to
-- the Service Catalog product.
--
-- 'lastSyncStatus', 'lastSync_lastSyncStatus' - The current status of the sync. Responses include @SUCCEEDED@ or
-- @FAILED@.
--
-- 'lastSyncStatusMessage', 'lastSync_lastSyncStatusMessage' - The sync\'s status message.
--
-- 'lastSyncTime', 'lastSync_lastSyncTime' - The time of the last attempted sync from the repository to the Service
-- Catalog product.
newLastSync ::
  LastSync
newLastSync :: LastSync
newLastSync =
  LastSync'
    { $sel:lastSuccessfulSyncProvisioningArtifactId:LastSync' :: Maybe Text
lastSuccessfulSyncProvisioningArtifactId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:lastSuccessfulSyncTime:LastSync' :: Maybe POSIX
lastSuccessfulSyncTime = forall a. Maybe a
Prelude.Nothing,
      $sel:lastSyncStatus:LastSync' :: Maybe LastSyncStatus
lastSyncStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:lastSyncStatusMessage:LastSync' :: Maybe Text
lastSyncStatusMessage = forall a. Maybe a
Prelude.Nothing,
      $sel:lastSyncTime:LastSync' :: Maybe POSIX
lastSyncTime = forall a. Maybe a
Prelude.Nothing
    }

-- | The ProvisioningArtifactID of the ProvisioningArtifact created from the
-- latest successful sync.
lastSync_lastSuccessfulSyncProvisioningArtifactId :: Lens.Lens' LastSync (Prelude.Maybe Prelude.Text)
lastSync_lastSuccessfulSyncProvisioningArtifactId :: Lens' LastSync (Maybe Text)
lastSync_lastSuccessfulSyncProvisioningArtifactId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LastSync' {Maybe Text
lastSuccessfulSyncProvisioningArtifactId :: Maybe Text
$sel:lastSuccessfulSyncProvisioningArtifactId:LastSync' :: LastSync -> Maybe Text
lastSuccessfulSyncProvisioningArtifactId} -> Maybe Text
lastSuccessfulSyncProvisioningArtifactId) (\s :: LastSync
s@LastSync' {} Maybe Text
a -> LastSync
s {$sel:lastSuccessfulSyncProvisioningArtifactId:LastSync' :: Maybe Text
lastSuccessfulSyncProvisioningArtifactId = Maybe Text
a} :: LastSync)

-- | The time of the latest successful sync from the source repo artifact to
-- the Service Catalog product.
lastSync_lastSuccessfulSyncTime :: Lens.Lens' LastSync (Prelude.Maybe Prelude.UTCTime)
lastSync_lastSuccessfulSyncTime :: Lens' LastSync (Maybe UTCTime)
lastSync_lastSuccessfulSyncTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LastSync' {Maybe POSIX
lastSuccessfulSyncTime :: Maybe POSIX
$sel:lastSuccessfulSyncTime:LastSync' :: LastSync -> Maybe POSIX
lastSuccessfulSyncTime} -> Maybe POSIX
lastSuccessfulSyncTime) (\s :: LastSync
s@LastSync' {} Maybe POSIX
a -> LastSync
s {$sel:lastSuccessfulSyncTime:LastSync' :: Maybe POSIX
lastSuccessfulSyncTime = Maybe POSIX
a} :: LastSync) 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 current status of the sync. Responses include @SUCCEEDED@ or
-- @FAILED@.
lastSync_lastSyncStatus :: Lens.Lens' LastSync (Prelude.Maybe LastSyncStatus)
lastSync_lastSyncStatus :: Lens' LastSync (Maybe LastSyncStatus)
lastSync_lastSyncStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LastSync' {Maybe LastSyncStatus
lastSyncStatus :: Maybe LastSyncStatus
$sel:lastSyncStatus:LastSync' :: LastSync -> Maybe LastSyncStatus
lastSyncStatus} -> Maybe LastSyncStatus
lastSyncStatus) (\s :: LastSync
s@LastSync' {} Maybe LastSyncStatus
a -> LastSync
s {$sel:lastSyncStatus:LastSync' :: Maybe LastSyncStatus
lastSyncStatus = Maybe LastSyncStatus
a} :: LastSync)

-- | The sync\'s status message.
lastSync_lastSyncStatusMessage :: Lens.Lens' LastSync (Prelude.Maybe Prelude.Text)
lastSync_lastSyncStatusMessage :: Lens' LastSync (Maybe Text)
lastSync_lastSyncStatusMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LastSync' {Maybe Text
lastSyncStatusMessage :: Maybe Text
$sel:lastSyncStatusMessage:LastSync' :: LastSync -> Maybe Text
lastSyncStatusMessage} -> Maybe Text
lastSyncStatusMessage) (\s :: LastSync
s@LastSync' {} Maybe Text
a -> LastSync
s {$sel:lastSyncStatusMessage:LastSync' :: Maybe Text
lastSyncStatusMessage = Maybe Text
a} :: LastSync)

-- | The time of the last attempted sync from the repository to the Service
-- Catalog product.
lastSync_lastSyncTime :: Lens.Lens' LastSync (Prelude.Maybe Prelude.UTCTime)
lastSync_lastSyncTime :: Lens' LastSync (Maybe UTCTime)
lastSync_lastSyncTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LastSync' {Maybe POSIX
lastSyncTime :: Maybe POSIX
$sel:lastSyncTime:LastSync' :: LastSync -> Maybe POSIX
lastSyncTime} -> Maybe POSIX
lastSyncTime) (\s :: LastSync
s@LastSync' {} Maybe POSIX
a -> LastSync
s {$sel:lastSyncTime:LastSync' :: Maybe POSIX
lastSyncTime = Maybe POSIX
a} :: LastSync) 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 LastSync where
  parseJSON :: Value -> Parser LastSync
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LastSync"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe LastSyncStatus
-> Maybe Text
-> Maybe POSIX
-> LastSync
LastSync'
            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
"LastSuccessfulSyncProvisioningArtifactId"
                        )
            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
"LastSuccessfulSyncTime")
            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
"LastSyncStatus")
            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
"LastSyncStatusMessage")
            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
"LastSyncTime")
      )

instance Prelude.Hashable LastSync where
  hashWithSalt :: Int -> LastSync -> Int
hashWithSalt Int
_salt LastSync' {Maybe Text
Maybe POSIX
Maybe LastSyncStatus
lastSyncTime :: Maybe POSIX
lastSyncStatusMessage :: Maybe Text
lastSyncStatus :: Maybe LastSyncStatus
lastSuccessfulSyncTime :: Maybe POSIX
lastSuccessfulSyncProvisioningArtifactId :: Maybe Text
$sel:lastSyncTime:LastSync' :: LastSync -> Maybe POSIX
$sel:lastSyncStatusMessage:LastSync' :: LastSync -> Maybe Text
$sel:lastSyncStatus:LastSync' :: LastSync -> Maybe LastSyncStatus
$sel:lastSuccessfulSyncTime:LastSync' :: LastSync -> Maybe POSIX
$sel:lastSuccessfulSyncProvisioningArtifactId:LastSync' :: LastSync -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
lastSuccessfulSyncProvisioningArtifactId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastSuccessfulSyncTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LastSyncStatus
lastSyncStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
lastSyncStatusMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastSyncTime

instance Prelude.NFData LastSync where
  rnf :: LastSync -> ()
rnf LastSync' {Maybe Text
Maybe POSIX
Maybe LastSyncStatus
lastSyncTime :: Maybe POSIX
lastSyncStatusMessage :: Maybe Text
lastSyncStatus :: Maybe LastSyncStatus
lastSuccessfulSyncTime :: Maybe POSIX
lastSuccessfulSyncProvisioningArtifactId :: Maybe Text
$sel:lastSyncTime:LastSync' :: LastSync -> Maybe POSIX
$sel:lastSyncStatusMessage:LastSync' :: LastSync -> Maybe Text
$sel:lastSyncStatus:LastSync' :: LastSync -> Maybe LastSyncStatus
$sel:lastSuccessfulSyncTime:LastSync' :: LastSync -> Maybe POSIX
$sel:lastSuccessfulSyncProvisioningArtifactId:LastSync' :: LastSync -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf
      Maybe Text
lastSuccessfulSyncProvisioningArtifactId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastSuccessfulSyncTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe LastSyncStatus
lastSyncStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
lastSyncStatusMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastSyncTime