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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MGN.Types.LaunchStatus
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 Source Server ID.
    ParticipatingServer -> Maybe Text
sourceServerID :: Prelude.Maybe Prelude.Text
  }
  deriving (ParticipatingServer -> ParticipatingServer -> Bool
(ParticipatingServer -> ParticipatingServer -> Bool)
-> (ParticipatingServer -> ParticipatingServer -> Bool)
-> Eq ParticipatingServer
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]
(Int -> ReadS ParticipatingServer)
-> ReadS [ParticipatingServer]
-> ReadPrec ParticipatingServer
-> ReadPrec [ParticipatingServer]
-> Read 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
(Int -> ParticipatingServer -> ShowS)
-> (ParticipatingServer -> String)
-> ([ParticipatingServer] -> ShowS)
-> Show ParticipatingServer
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. ParticipatingServer -> Rep ParticipatingServer x)
-> (forall x. Rep ParticipatingServer x -> ParticipatingServer)
-> Generic ParticipatingServer
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.
--
-- 'sourceServerID', 'participatingServer_sourceServerID' - Participating server Source Server ID.
newParticipatingServer ::
  ParticipatingServer
newParticipatingServer :: ParticipatingServer
newParticipatingServer =
  ParticipatingServer' :: Maybe LaunchStatus -> Maybe Text -> ParticipatingServer
ParticipatingServer'
    { $sel:launchStatus:ParticipatingServer' :: Maybe LaunchStatus
launchStatus =
        Maybe LaunchStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:sourceServerID:ParticipatingServer' :: Maybe Text
sourceServerID = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Participating server launch status.
participatingServer_launchStatus :: Lens.Lens' ParticipatingServer (Prelude.Maybe LaunchStatus)
participatingServer_launchStatus :: (Maybe LaunchStatus -> f (Maybe LaunchStatus))
-> ParticipatingServer -> f ParticipatingServer
participatingServer_launchStatus = (ParticipatingServer -> Maybe LaunchStatus)
-> (ParticipatingServer
    -> Maybe LaunchStatus -> ParticipatingServer)
-> Lens
     ParticipatingServer
     ParticipatingServer
     (Maybe LaunchStatus)
     (Maybe 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 Source Server ID.
participatingServer_sourceServerID :: Lens.Lens' ParticipatingServer (Prelude.Maybe Prelude.Text)
participatingServer_sourceServerID :: (Maybe Text -> f (Maybe Text))
-> ParticipatingServer -> f ParticipatingServer
participatingServer_sourceServerID = (ParticipatingServer -> Maybe Text)
-> (ParticipatingServer -> Maybe Text -> ParticipatingServer)
-> Lens
     ParticipatingServer ParticipatingServer (Maybe Text) (Maybe Text)
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 Core.FromJSON ParticipatingServer where
  parseJSON :: Value -> Parser ParticipatingServer
parseJSON =
    String
-> (Object -> Parser ParticipatingServer)
-> Value
-> Parser ParticipatingServer
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ParticipatingServer"
      ( \Object
x ->
          Maybe LaunchStatus -> Maybe Text -> ParticipatingServer
ParticipatingServer'
            (Maybe LaunchStatus -> Maybe Text -> ParticipatingServer)
-> Parser (Maybe LaunchStatus)
-> Parser (Maybe Text -> ParticipatingServer)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe LaunchStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"launchStatus")
            Parser (Maybe Text -> ParticipatingServer)
-> Parser (Maybe Text) -> Parser ParticipatingServer
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
"sourceServerID")
      )

instance Prelude.Hashable ParticipatingServer

instance Prelude.NFData ParticipatingServer