{-# 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.DrS.Types.ParticipatingServer
-- 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.DrS.Types.ParticipatingServer where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DrS.Types.LaunchStatus
import qualified Amazonka.Prelude as Prelude

-- | Represents a server participating in an asynchronous Job.
--
-- /See:/ 'newParticipatingServer' smart constructor.
data ParticipatingServer = ParticipatingServer'
  { -- | The launch status of a participating server.
    ParticipatingServer -> Maybe LaunchStatus
launchStatus :: Prelude.Maybe LaunchStatus,
    -- | The Recovery Instance ID of a participating server.
    ParticipatingServer -> Maybe Text
recoveryInstanceID :: Prelude.Maybe Prelude.Text,
    -- | The Source Server ID of a participating server.
    ParticipatingServer -> Maybe Text
sourceServerID :: Prelude.Maybe Prelude.Text
  }
  deriving (ParticipatingServer -> ParticipatingServer -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ParticipatingServer -> ParticipatingServer -> Bool
$c/= :: ParticipatingServer -> ParticipatingServer -> Bool
== :: ParticipatingServer -> ParticipatingServer -> Bool
$c== :: ParticipatingServer -> ParticipatingServer -> Bool
Prelude.Eq, ReadPrec [ParticipatingServer]
ReadPrec ParticipatingServer
Int -> ReadS ParticipatingServer
ReadS [ParticipatingServer]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ParticipatingServer]
$creadListPrec :: ReadPrec [ParticipatingServer]
readPrec :: ReadPrec ParticipatingServer
$creadPrec :: ReadPrec ParticipatingServer
readList :: ReadS [ParticipatingServer]
$creadList :: ReadS [ParticipatingServer]
readsPrec :: Int -> ReadS ParticipatingServer
$creadsPrec :: Int -> ReadS ParticipatingServer
Prelude.Read, Int -> ParticipatingServer -> ShowS
[ParticipatingServer] -> ShowS
ParticipatingServer -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ParticipatingServer] -> ShowS
$cshowList :: [ParticipatingServer] -> ShowS
show :: ParticipatingServer -> String
$cshow :: ParticipatingServer -> String
showsPrec :: Int -> ParticipatingServer -> ShowS
$cshowsPrec :: Int -> ParticipatingServer -> ShowS
Prelude.Show, forall x. Rep ParticipatingServer x -> ParticipatingServer
forall x. ParticipatingServer -> Rep ParticipatingServer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ParticipatingServer x -> ParticipatingServer
$cfrom :: forall x. ParticipatingServer -> Rep ParticipatingServer x
Prelude.Generic)

-- |
-- Create a value of 'ParticipatingServer' 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:
--
-- 'launchStatus', 'participatingServer_launchStatus' - The launch status of a participating server.
--
-- 'recoveryInstanceID', 'participatingServer_recoveryInstanceID' - The Recovery Instance ID of a participating server.
--
-- 'sourceServerID', 'participatingServer_sourceServerID' - The Source Server ID of a participating server.
newParticipatingServer ::
  ParticipatingServer
newParticipatingServer :: ParticipatingServer
newParticipatingServer =
  ParticipatingServer'
    { $sel:launchStatus:ParticipatingServer' :: Maybe LaunchStatus
launchStatus =
        forall a. Maybe a
Prelude.Nothing,
      $sel:recoveryInstanceID:ParticipatingServer' :: Maybe Text
recoveryInstanceID = forall a. Maybe a
Prelude.Nothing,
      $sel:sourceServerID:ParticipatingServer' :: Maybe Text
sourceServerID = forall a. Maybe a
Prelude.Nothing
    }

-- | The launch status of a participating server.
participatingServer_launchStatus :: Lens.Lens' ParticipatingServer (Prelude.Maybe LaunchStatus)
participatingServer_launchStatus :: Lens' ParticipatingServer (Maybe LaunchStatus)
participatingServer_launchStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParticipatingServer' {Maybe LaunchStatus
launchStatus :: Maybe LaunchStatus
$sel:launchStatus:ParticipatingServer' :: ParticipatingServer -> Maybe LaunchStatus
launchStatus} -> Maybe LaunchStatus
launchStatus) (\s :: ParticipatingServer
s@ParticipatingServer' {} Maybe LaunchStatus
a -> ParticipatingServer
s {$sel:launchStatus:ParticipatingServer' :: Maybe LaunchStatus
launchStatus = Maybe LaunchStatus
a} :: ParticipatingServer)

-- | The Recovery Instance ID of a participating server.
participatingServer_recoveryInstanceID :: Lens.Lens' ParticipatingServer (Prelude.Maybe Prelude.Text)
participatingServer_recoveryInstanceID :: Lens' ParticipatingServer (Maybe Text)
participatingServer_recoveryInstanceID = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParticipatingServer' {Maybe Text
recoveryInstanceID :: Maybe Text
$sel:recoveryInstanceID:ParticipatingServer' :: ParticipatingServer -> Maybe Text
recoveryInstanceID} -> Maybe Text
recoveryInstanceID) (\s :: ParticipatingServer
s@ParticipatingServer' {} Maybe Text
a -> ParticipatingServer
s {$sel:recoveryInstanceID:ParticipatingServer' :: Maybe Text
recoveryInstanceID = Maybe Text
a} :: ParticipatingServer)

-- | The Source Server ID of a participating server.
participatingServer_sourceServerID :: Lens.Lens' ParticipatingServer (Prelude.Maybe Prelude.Text)
participatingServer_sourceServerID :: Lens' ParticipatingServer (Maybe Text)
participatingServer_sourceServerID = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParticipatingServer' {Maybe Text
sourceServerID :: Maybe Text
$sel:sourceServerID:ParticipatingServer' :: ParticipatingServer -> Maybe Text
sourceServerID} -> Maybe Text
sourceServerID) (\s :: ParticipatingServer
s@ParticipatingServer' {} Maybe Text
a -> ParticipatingServer
s {$sel:sourceServerID:ParticipatingServer' :: Maybe Text
sourceServerID = Maybe Text
a} :: ParticipatingServer)

instance Data.FromJSON ParticipatingServer where
  parseJSON :: Value -> Parser ParticipatingServer
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ParticipatingServer"
      ( \Object
x ->
          Maybe LaunchStatus
-> Maybe Text -> Maybe Text -> ParticipatingServer
ParticipatingServer'
            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
"launchStatus")
            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
"recoveryInstanceID")
            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
"sourceServerID")
      )

instance Prelude.Hashable ParticipatingServer where
  hashWithSalt :: Int -> ParticipatingServer -> Int
hashWithSalt Int
_salt ParticipatingServer' {Maybe Text
Maybe LaunchStatus
sourceServerID :: Maybe Text
recoveryInstanceID :: Maybe Text
launchStatus :: Maybe LaunchStatus
$sel:sourceServerID:ParticipatingServer' :: ParticipatingServer -> Maybe Text
$sel:recoveryInstanceID:ParticipatingServer' :: ParticipatingServer -> Maybe Text
$sel:launchStatus:ParticipatingServer' :: ParticipatingServer -> Maybe LaunchStatus
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LaunchStatus
launchStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
recoveryInstanceID
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sourceServerID

instance Prelude.NFData ParticipatingServer where
  rnf :: ParticipatingServer -> ()
rnf ParticipatingServer' {Maybe Text
Maybe LaunchStatus
sourceServerID :: Maybe Text
recoveryInstanceID :: Maybe Text
launchStatus :: Maybe LaunchStatus
$sel:sourceServerID:ParticipatingServer' :: ParticipatingServer -> Maybe Text
$sel:recoveryInstanceID:ParticipatingServer' :: ParticipatingServer -> Maybe Text
$sel:launchStatus:ParticipatingServer' :: ParticipatingServer -> Maybe LaunchStatus
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe LaunchStatus
launchStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
recoveryInstanceID
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sourceServerID