{-# 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.EFS.Types.Destination
-- 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.EFS.Types.Destination where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EFS.Types.ReplicationStatus
import qualified Amazonka.Prelude as Prelude

-- | Describes the destination file system in the replication configuration.
--
-- /See:/ 'newDestination' smart constructor.
data Destination = Destination'
  { -- | The time when the most recent sync was successfully completed on the
    -- destination file system. Any changes to data on the source file system
    -- that occurred before this time have been successfully replicated to the
    -- destination file system. Any changes that occurred after this time might
    -- not be fully replicated.
    Destination -> Maybe POSIX
lastReplicatedTimestamp :: Prelude.Maybe Data.POSIX,
    -- | Describes the status of the destination Amazon EFS file system. If the
    -- status is @ERROR@, the destination file system in the replication
    -- configuration is in a failed state and is unrecoverable. To access the
    -- file system data, restore a backup of the failed file system to a new
    -- file system.
    Destination -> ReplicationStatus
status :: ReplicationStatus,
    -- | The ID of the destination Amazon EFS file system.
    Destination -> Text
fileSystemId :: Prelude.Text,
    -- | The Amazon Web Services Region in which the destination file system is
    -- located.
    Destination -> Text
region :: Prelude.Text
  }
  deriving (Destination -> Destination -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Destination -> Destination -> Bool
$c/= :: Destination -> Destination -> Bool
== :: Destination -> Destination -> Bool
$c== :: Destination -> Destination -> Bool
Prelude.Eq, ReadPrec [Destination]
ReadPrec Destination
Int -> ReadS Destination
ReadS [Destination]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Destination]
$creadListPrec :: ReadPrec [Destination]
readPrec :: ReadPrec Destination
$creadPrec :: ReadPrec Destination
readList :: ReadS [Destination]
$creadList :: ReadS [Destination]
readsPrec :: Int -> ReadS Destination
$creadsPrec :: Int -> ReadS Destination
Prelude.Read, Int -> Destination -> ShowS
[Destination] -> ShowS
Destination -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Destination] -> ShowS
$cshowList :: [Destination] -> ShowS
show :: Destination -> String
$cshow :: Destination -> String
showsPrec :: Int -> Destination -> ShowS
$cshowsPrec :: Int -> Destination -> ShowS
Prelude.Show, forall x. Rep Destination x -> Destination
forall x. Destination -> Rep Destination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Destination x -> Destination
$cfrom :: forall x. Destination -> Rep Destination x
Prelude.Generic)

-- |
-- Create a value of 'Destination' 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:
--
-- 'lastReplicatedTimestamp', 'destination_lastReplicatedTimestamp' - The time when the most recent sync was successfully completed on the
-- destination file system. Any changes to data on the source file system
-- that occurred before this time have been successfully replicated to the
-- destination file system. Any changes that occurred after this time might
-- not be fully replicated.
--
-- 'status', 'destination_status' - Describes the status of the destination Amazon EFS file system. If the
-- status is @ERROR@, the destination file system in the replication
-- configuration is in a failed state and is unrecoverable. To access the
-- file system data, restore a backup of the failed file system to a new
-- file system.
--
-- 'fileSystemId', 'destination_fileSystemId' - The ID of the destination Amazon EFS file system.
--
-- 'region', 'destination_region' - The Amazon Web Services Region in which the destination file system is
-- located.
newDestination ::
  -- | 'status'
  ReplicationStatus ->
  -- | 'fileSystemId'
  Prelude.Text ->
  -- | 'region'
  Prelude.Text ->
  Destination
newDestination :: ReplicationStatus -> Text -> Text -> Destination
newDestination ReplicationStatus
pStatus_ Text
pFileSystemId_ Text
pRegion_ =
  Destination'
    { $sel:lastReplicatedTimestamp:Destination' :: Maybe POSIX
lastReplicatedTimestamp =
        forall a. Maybe a
Prelude.Nothing,
      $sel:status:Destination' :: ReplicationStatus
status = ReplicationStatus
pStatus_,
      $sel:fileSystemId:Destination' :: Text
fileSystemId = Text
pFileSystemId_,
      $sel:region:Destination' :: Text
region = Text
pRegion_
    }

-- | The time when the most recent sync was successfully completed on the
-- destination file system. Any changes to data on the source file system
-- that occurred before this time have been successfully replicated to the
-- destination file system. Any changes that occurred after this time might
-- not be fully replicated.
destination_lastReplicatedTimestamp :: Lens.Lens' Destination (Prelude.Maybe Prelude.UTCTime)
destination_lastReplicatedTimestamp :: Lens' Destination (Maybe UTCTime)
destination_lastReplicatedTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Destination' {Maybe POSIX
lastReplicatedTimestamp :: Maybe POSIX
$sel:lastReplicatedTimestamp:Destination' :: Destination -> Maybe POSIX
lastReplicatedTimestamp} -> Maybe POSIX
lastReplicatedTimestamp) (\s :: Destination
s@Destination' {} Maybe POSIX
a -> Destination
s {$sel:lastReplicatedTimestamp:Destination' :: Maybe POSIX
lastReplicatedTimestamp = Maybe POSIX
a} :: Destination) 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

-- | Describes the status of the destination Amazon EFS file system. If the
-- status is @ERROR@, the destination file system in the replication
-- configuration is in a failed state and is unrecoverable. To access the
-- file system data, restore a backup of the failed file system to a new
-- file system.
destination_status :: Lens.Lens' Destination ReplicationStatus
destination_status :: Lens' Destination ReplicationStatus
destination_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Destination' {ReplicationStatus
status :: ReplicationStatus
$sel:status:Destination' :: Destination -> ReplicationStatus
status} -> ReplicationStatus
status) (\s :: Destination
s@Destination' {} ReplicationStatus
a -> Destination
s {$sel:status:Destination' :: ReplicationStatus
status = ReplicationStatus
a} :: Destination)

-- | The ID of the destination Amazon EFS file system.
destination_fileSystemId :: Lens.Lens' Destination Prelude.Text
destination_fileSystemId :: Lens' Destination Text
destination_fileSystemId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Destination' {Text
fileSystemId :: Text
$sel:fileSystemId:Destination' :: Destination -> Text
fileSystemId} -> Text
fileSystemId) (\s :: Destination
s@Destination' {} Text
a -> Destination
s {$sel:fileSystemId:Destination' :: Text
fileSystemId = Text
a} :: Destination)

-- | The Amazon Web Services Region in which the destination file system is
-- located.
destination_region :: Lens.Lens' Destination Prelude.Text
destination_region :: Lens' Destination Text
destination_region = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Destination' {Text
region :: Text
$sel:region:Destination' :: Destination -> Text
region} -> Text
region) (\s :: Destination
s@Destination' {} Text
a -> Destination
s {$sel:region:Destination' :: Text
region = Text
a} :: Destination)

instance Data.FromJSON Destination where
  parseJSON :: Value -> Parser Destination
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Destination"
      ( \Object
x ->
          Maybe POSIX -> ReplicationStatus -> Text -> Text -> Destination
Destination'
            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
"LastReplicatedTimestamp")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Status")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"FileSystemId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Region")
      )

instance Prelude.Hashable Destination where
  hashWithSalt :: Int -> Destination -> Int
hashWithSalt Int
_salt Destination' {Maybe POSIX
Text
ReplicationStatus
region :: Text
fileSystemId :: Text
status :: ReplicationStatus
lastReplicatedTimestamp :: Maybe POSIX
$sel:region:Destination' :: Destination -> Text
$sel:fileSystemId:Destination' :: Destination -> Text
$sel:status:Destination' :: Destination -> ReplicationStatus
$sel:lastReplicatedTimestamp:Destination' :: Destination -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastReplicatedTimestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ReplicationStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
fileSystemId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
region

instance Prelude.NFData Destination where
  rnf :: Destination -> ()
rnf Destination' {Maybe POSIX
Text
ReplicationStatus
region :: Text
fileSystemId :: Text
status :: ReplicationStatus
lastReplicatedTimestamp :: Maybe POSIX
$sel:region:Destination' :: Destination -> Text
$sel:fileSystemId:Destination' :: Destination -> Text
$sel:status:Destination' :: Destination -> ReplicationStatus
$sel:lastReplicatedTimestamp:Destination' :: Destination -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastReplicatedTimestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ReplicationStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
fileSystemId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
region