{-# 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.LaunchedInstance
-- 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.LaunchedInstance 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.FirstBoot
import qualified Amazonka.Prelude as Prelude

-- | Launched instance.
--
-- /See:/ 'newLaunchedInstance' smart constructor.
data LaunchedInstance = LaunchedInstance'
  { -- | Launched instance EC2 ID.
    LaunchedInstance -> Maybe Text
ec2InstanceID :: Prelude.Maybe Prelude.Text,
    -- | Launched instance first boot.
    LaunchedInstance -> Maybe FirstBoot
firstBoot :: Prelude.Maybe FirstBoot,
    -- | Launched instance Job ID.
    LaunchedInstance -> Maybe Text
jobID :: Prelude.Maybe Prelude.Text
  }
  deriving (LaunchedInstance -> LaunchedInstance -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LaunchedInstance -> LaunchedInstance -> Bool
$c/= :: LaunchedInstance -> LaunchedInstance -> Bool
== :: LaunchedInstance -> LaunchedInstance -> Bool
$c== :: LaunchedInstance -> LaunchedInstance -> Bool
Prelude.Eq, ReadPrec [LaunchedInstance]
ReadPrec LaunchedInstance
Int -> ReadS LaunchedInstance
ReadS [LaunchedInstance]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LaunchedInstance]
$creadListPrec :: ReadPrec [LaunchedInstance]
readPrec :: ReadPrec LaunchedInstance
$creadPrec :: ReadPrec LaunchedInstance
readList :: ReadS [LaunchedInstance]
$creadList :: ReadS [LaunchedInstance]
readsPrec :: Int -> ReadS LaunchedInstance
$creadsPrec :: Int -> ReadS LaunchedInstance
Prelude.Read, Int -> LaunchedInstance -> ShowS
[LaunchedInstance] -> ShowS
LaunchedInstance -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LaunchedInstance] -> ShowS
$cshowList :: [LaunchedInstance] -> ShowS
show :: LaunchedInstance -> String
$cshow :: LaunchedInstance -> String
showsPrec :: Int -> LaunchedInstance -> ShowS
$cshowsPrec :: Int -> LaunchedInstance -> ShowS
Prelude.Show, forall x. Rep LaunchedInstance x -> LaunchedInstance
forall x. LaunchedInstance -> Rep LaunchedInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LaunchedInstance x -> LaunchedInstance
$cfrom :: forall x. LaunchedInstance -> Rep LaunchedInstance x
Prelude.Generic)

-- |
-- Create a value of 'LaunchedInstance' 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:
--
-- 'ec2InstanceID', 'launchedInstance_ec2InstanceID' - Launched instance EC2 ID.
--
-- 'firstBoot', 'launchedInstance_firstBoot' - Launched instance first boot.
--
-- 'jobID', 'launchedInstance_jobID' - Launched instance Job ID.
newLaunchedInstance ::
  LaunchedInstance
newLaunchedInstance :: LaunchedInstance
newLaunchedInstance =
  LaunchedInstance'
    { $sel:ec2InstanceID:LaunchedInstance' :: Maybe Text
ec2InstanceID = forall a. Maybe a
Prelude.Nothing,
      $sel:firstBoot:LaunchedInstance' :: Maybe FirstBoot
firstBoot = forall a. Maybe a
Prelude.Nothing,
      $sel:jobID:LaunchedInstance' :: Maybe Text
jobID = forall a. Maybe a
Prelude.Nothing
    }

-- | Launched instance EC2 ID.
launchedInstance_ec2InstanceID :: Lens.Lens' LaunchedInstance (Prelude.Maybe Prelude.Text)
launchedInstance_ec2InstanceID :: Lens' LaunchedInstance (Maybe Text)
launchedInstance_ec2InstanceID = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchedInstance' {Maybe Text
ec2InstanceID :: Maybe Text
$sel:ec2InstanceID:LaunchedInstance' :: LaunchedInstance -> Maybe Text
ec2InstanceID} -> Maybe Text
ec2InstanceID) (\s :: LaunchedInstance
s@LaunchedInstance' {} Maybe Text
a -> LaunchedInstance
s {$sel:ec2InstanceID:LaunchedInstance' :: Maybe Text
ec2InstanceID = Maybe Text
a} :: LaunchedInstance)

-- | Launched instance first boot.
launchedInstance_firstBoot :: Lens.Lens' LaunchedInstance (Prelude.Maybe FirstBoot)
launchedInstance_firstBoot :: Lens' LaunchedInstance (Maybe FirstBoot)
launchedInstance_firstBoot = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchedInstance' {Maybe FirstBoot
firstBoot :: Maybe FirstBoot
$sel:firstBoot:LaunchedInstance' :: LaunchedInstance -> Maybe FirstBoot
firstBoot} -> Maybe FirstBoot
firstBoot) (\s :: LaunchedInstance
s@LaunchedInstance' {} Maybe FirstBoot
a -> LaunchedInstance
s {$sel:firstBoot:LaunchedInstance' :: Maybe FirstBoot
firstBoot = Maybe FirstBoot
a} :: LaunchedInstance)

-- | Launched instance Job ID.
launchedInstance_jobID :: Lens.Lens' LaunchedInstance (Prelude.Maybe Prelude.Text)
launchedInstance_jobID :: Lens' LaunchedInstance (Maybe Text)
launchedInstance_jobID = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchedInstance' {Maybe Text
jobID :: Maybe Text
$sel:jobID:LaunchedInstance' :: LaunchedInstance -> Maybe Text
jobID} -> Maybe Text
jobID) (\s :: LaunchedInstance
s@LaunchedInstance' {} Maybe Text
a -> LaunchedInstance
s {$sel:jobID:LaunchedInstance' :: Maybe Text
jobID = Maybe Text
a} :: LaunchedInstance)

instance Data.FromJSON LaunchedInstance where
  parseJSON :: Value -> Parser LaunchedInstance
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LaunchedInstance"
      ( \Object
x ->
          Maybe Text -> Maybe FirstBoot -> Maybe Text -> LaunchedInstance
LaunchedInstance'
            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
"ec2InstanceID")
            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
"firstBoot")
            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
"jobID")
      )

instance Prelude.Hashable LaunchedInstance where
  hashWithSalt :: Int -> LaunchedInstance -> Int
hashWithSalt Int
_salt LaunchedInstance' {Maybe Text
Maybe FirstBoot
jobID :: Maybe Text
firstBoot :: Maybe FirstBoot
ec2InstanceID :: Maybe Text
$sel:jobID:LaunchedInstance' :: LaunchedInstance -> Maybe Text
$sel:firstBoot:LaunchedInstance' :: LaunchedInstance -> Maybe FirstBoot
$sel:ec2InstanceID:LaunchedInstance' :: LaunchedInstance -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ec2InstanceID
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FirstBoot
firstBoot
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
jobID

instance Prelude.NFData LaunchedInstance where
  rnf :: LaunchedInstance -> ()
rnf LaunchedInstance' {Maybe Text
Maybe FirstBoot
jobID :: Maybe Text
firstBoot :: Maybe FirstBoot
ec2InstanceID :: Maybe Text
$sel:jobID:LaunchedInstance' :: LaunchedInstance -> Maybe Text
$sel:firstBoot:LaunchedInstance' :: LaunchedInstance -> Maybe FirstBoot
$sel:ec2InstanceID:LaunchedInstance' :: LaunchedInstance -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
ec2InstanceID
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe FirstBoot
firstBoot
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
jobID