{-# 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.MGN.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.MGN.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.MGN.Types.LaunchStatus
import Amazonka.MGN.Types.PostLaunchActionsStatus
import qualified Amazonka.Prelude as Prelude

-- | Server participating in Job.
--
-- /See:/ 'newParticipatingServer' smart constructor.
data ParticipatingServer = ParticipatingServer'
  { -- | Participating server launch status.
    ParticipatingServer -> Maybe LaunchStatus
launchStatus :: Prelude.Maybe LaunchStatus,
    -- | Participating server\'s launched ec2 instance ID.
    ParticipatingServer -> Maybe Text
launchedEc2InstanceID :: Prelude.Maybe Prelude.Text,
    -- | Participating server\'s Post Launch Actions Status.
    ParticipatingServer -> Maybe PostLaunchActionsStatus
postLaunchActionsStatus :: Prelude.Maybe PostLaunchActionsStatus,
    -- | Participating server Source Server ID.
    ParticipatingServer -> Text
sourceServerID :: 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' - Participating server launch status.
--
-- 'launchedEc2InstanceID', 'participatingServer_launchedEc2InstanceID' - Participating server\'s launched ec2 instance ID.
--
-- 'postLaunchActionsStatus', 'participatingServer_postLaunchActionsStatus' - Participating server\'s Post Launch Actions Status.
--
-- 'sourceServerID', 'participatingServer_sourceServerID' - Participating server Source Server ID.
newParticipatingServer ::
  -- | 'sourceServerID'
  Prelude.Text ->
  ParticipatingServer
newParticipatingServer :: Text -> ParticipatingServer
newParticipatingServer Text
pSourceServerID_ =
  ParticipatingServer'
    { $sel:launchStatus:ParticipatingServer' :: Maybe LaunchStatus
launchStatus =
        forall a. Maybe a
Prelude.Nothing,
      $sel:launchedEc2InstanceID:ParticipatingServer' :: Maybe Text
launchedEc2InstanceID = forall a. Maybe a
Prelude.Nothing,
      $sel:postLaunchActionsStatus:ParticipatingServer' :: Maybe PostLaunchActionsStatus
postLaunchActionsStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:sourceServerID:ParticipatingServer' :: Text
sourceServerID = Text
pSourceServerID_
    }

-- | Participating server launch status.
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)

-- | Participating server\'s launched ec2 instance ID.
participatingServer_launchedEc2InstanceID :: Lens.Lens' ParticipatingServer (Prelude.Maybe Prelude.Text)
participatingServer_launchedEc2InstanceID :: Lens' ParticipatingServer (Maybe Text)
participatingServer_launchedEc2InstanceID = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParticipatingServer' {Maybe Text
launchedEc2InstanceID :: Maybe Text
$sel:launchedEc2InstanceID:ParticipatingServer' :: ParticipatingServer -> Maybe Text
launchedEc2InstanceID} -> Maybe Text
launchedEc2InstanceID) (\s :: ParticipatingServer
s@ParticipatingServer' {} Maybe Text
a -> ParticipatingServer
s {$sel:launchedEc2InstanceID:ParticipatingServer' :: Maybe Text
launchedEc2InstanceID = Maybe Text
a} :: ParticipatingServer)

-- | Participating server\'s Post Launch Actions Status.
participatingServer_postLaunchActionsStatus :: Lens.Lens' ParticipatingServer (Prelude.Maybe PostLaunchActionsStatus)
participatingServer_postLaunchActionsStatus :: Lens' ParticipatingServer (Maybe PostLaunchActionsStatus)
participatingServer_postLaunchActionsStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParticipatingServer' {Maybe PostLaunchActionsStatus
postLaunchActionsStatus :: Maybe PostLaunchActionsStatus
$sel:postLaunchActionsStatus:ParticipatingServer' :: ParticipatingServer -> Maybe PostLaunchActionsStatus
postLaunchActionsStatus} -> Maybe PostLaunchActionsStatus
postLaunchActionsStatus) (\s :: ParticipatingServer
s@ParticipatingServer' {} Maybe PostLaunchActionsStatus
a -> ParticipatingServer
s {$sel:postLaunchActionsStatus:ParticipatingServer' :: Maybe PostLaunchActionsStatus
postLaunchActionsStatus = Maybe PostLaunchActionsStatus
a} :: ParticipatingServer)

-- | Participating server Source Server ID.
participatingServer_sourceServerID :: Lens.Lens' ParticipatingServer Prelude.Text
participatingServer_sourceServerID :: Lens' ParticipatingServer Text
participatingServer_sourceServerID = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParticipatingServer' {Text
sourceServerID :: Text
$sel:sourceServerID:ParticipatingServer' :: ParticipatingServer -> Text
sourceServerID} -> Text
sourceServerID) (\s :: ParticipatingServer
s@ParticipatingServer' {} Text
a -> ParticipatingServer
s {$sel:sourceServerID:ParticipatingServer' :: Text
sourceServerID = 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 PostLaunchActionsStatus
-> 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
"launchedEc2InstanceID")
            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
"postLaunchActionsStatus")
            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
"sourceServerID")
      )

instance Prelude.Hashable ParticipatingServer where
  hashWithSalt :: Int -> ParticipatingServer -> Int
hashWithSalt Int
_salt ParticipatingServer' {Maybe Text
Maybe LaunchStatus
Maybe PostLaunchActionsStatus
Text
sourceServerID :: Text
postLaunchActionsStatus :: Maybe PostLaunchActionsStatus
launchedEc2InstanceID :: Maybe Text
launchStatus :: Maybe LaunchStatus
$sel:sourceServerID:ParticipatingServer' :: ParticipatingServer -> Text
$sel:postLaunchActionsStatus:ParticipatingServer' :: ParticipatingServer -> Maybe PostLaunchActionsStatus
$sel:launchedEc2InstanceID: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
launchedEc2InstanceID
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PostLaunchActionsStatus
postLaunchActionsStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sourceServerID

instance Prelude.NFData ParticipatingServer where
  rnf :: ParticipatingServer -> ()
rnf ParticipatingServer' {Maybe Text
Maybe LaunchStatus
Maybe PostLaunchActionsStatus
Text
sourceServerID :: Text
postLaunchActionsStatus :: Maybe PostLaunchActionsStatus
launchedEc2InstanceID :: Maybe Text
launchStatus :: Maybe LaunchStatus
$sel:sourceServerID:ParticipatingServer' :: ParticipatingServer -> Text
$sel:postLaunchActionsStatus:ParticipatingServer' :: ParticipatingServer -> Maybe PostLaunchActionsStatus
$sel:launchedEc2InstanceID: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
launchedEc2InstanceID
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PostLaunchActionsStatus
postLaunchActionsStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
sourceServerID