{-# 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.LaunchConfiguration
-- 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.LaunchConfiguration 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.LaunchDisposition
import Amazonka.DrS.Types.Licensing
import Amazonka.DrS.Types.TargetInstanceTypeRightSizingMethod
import qualified Amazonka.Prelude as Prelude

-- | /See:/ 'newLaunchConfiguration' smart constructor.
data LaunchConfiguration = LaunchConfiguration'
  { -- | Whether we should copy the Private IP of the Source Server to the
    -- Recovery Instance.
    LaunchConfiguration -> Maybe Bool
copyPrivateIp :: Prelude.Maybe Prelude.Bool,
    -- | Whether we want to copy the tags of the Source Server to the EC2 machine
    -- of the Recovery Instance.
    LaunchConfiguration -> Maybe Bool
copyTags :: Prelude.Maybe Prelude.Bool,
    -- | The EC2 launch template ID of this launch configuration.
    LaunchConfiguration -> Maybe Text
ec2LaunchTemplateID :: Prelude.Maybe Prelude.Text,
    -- | The state of the Recovery Instance in EC2 after the recovery operation.
    LaunchConfiguration -> Maybe LaunchDisposition
launchDisposition :: Prelude.Maybe LaunchDisposition,
    -- | The licensing configuration to be used for this launch configuration.
    LaunchConfiguration -> Maybe Licensing
licensing :: Prelude.Maybe Licensing,
    -- | The name of the launch configuration.
    LaunchConfiguration -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Source Server for this launch configuration.
    LaunchConfiguration -> Maybe Text
sourceServerID :: Prelude.Maybe Prelude.Text,
    -- | Whether Elastic Disaster Recovery should try to automatically choose the
    -- instance type that best matches the OS, CPU, and RAM of your Source
    -- Server.
    LaunchConfiguration -> Maybe TargetInstanceTypeRightSizingMethod
targetInstanceTypeRightSizingMethod :: Prelude.Maybe TargetInstanceTypeRightSizingMethod
  }
  deriving (LaunchConfiguration -> LaunchConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LaunchConfiguration -> LaunchConfiguration -> Bool
$c/= :: LaunchConfiguration -> LaunchConfiguration -> Bool
== :: LaunchConfiguration -> LaunchConfiguration -> Bool
$c== :: LaunchConfiguration -> LaunchConfiguration -> Bool
Prelude.Eq, ReadPrec [LaunchConfiguration]
ReadPrec LaunchConfiguration
Int -> ReadS LaunchConfiguration
ReadS [LaunchConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LaunchConfiguration]
$creadListPrec :: ReadPrec [LaunchConfiguration]
readPrec :: ReadPrec LaunchConfiguration
$creadPrec :: ReadPrec LaunchConfiguration
readList :: ReadS [LaunchConfiguration]
$creadList :: ReadS [LaunchConfiguration]
readsPrec :: Int -> ReadS LaunchConfiguration
$creadsPrec :: Int -> ReadS LaunchConfiguration
Prelude.Read, Int -> LaunchConfiguration -> ShowS
[LaunchConfiguration] -> ShowS
LaunchConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LaunchConfiguration] -> ShowS
$cshowList :: [LaunchConfiguration] -> ShowS
show :: LaunchConfiguration -> String
$cshow :: LaunchConfiguration -> String
showsPrec :: Int -> LaunchConfiguration -> ShowS
$cshowsPrec :: Int -> LaunchConfiguration -> ShowS
Prelude.Show, forall x. Rep LaunchConfiguration x -> LaunchConfiguration
forall x. LaunchConfiguration -> Rep LaunchConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LaunchConfiguration x -> LaunchConfiguration
$cfrom :: forall x. LaunchConfiguration -> Rep LaunchConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'LaunchConfiguration' 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:
--
-- 'copyPrivateIp', 'launchConfiguration_copyPrivateIp' - Whether we should copy the Private IP of the Source Server to the
-- Recovery Instance.
--
-- 'copyTags', 'launchConfiguration_copyTags' - Whether we want to copy the tags of the Source Server to the EC2 machine
-- of the Recovery Instance.
--
-- 'ec2LaunchTemplateID', 'launchConfiguration_ec2LaunchTemplateID' - The EC2 launch template ID of this launch configuration.
--
-- 'launchDisposition', 'launchConfiguration_launchDisposition' - The state of the Recovery Instance in EC2 after the recovery operation.
--
-- 'licensing', 'launchConfiguration_licensing' - The licensing configuration to be used for this launch configuration.
--
-- 'name', 'launchConfiguration_name' - The name of the launch configuration.
--
-- 'sourceServerID', 'launchConfiguration_sourceServerID' - The ID of the Source Server for this launch configuration.
--
-- 'targetInstanceTypeRightSizingMethod', 'launchConfiguration_targetInstanceTypeRightSizingMethod' - Whether Elastic Disaster Recovery should try to automatically choose the
-- instance type that best matches the OS, CPU, and RAM of your Source
-- Server.
newLaunchConfiguration ::
  LaunchConfiguration
newLaunchConfiguration :: LaunchConfiguration
newLaunchConfiguration =
  LaunchConfiguration'
    { $sel:copyPrivateIp:LaunchConfiguration' :: Maybe Bool
copyPrivateIp =
        forall a. Maybe a
Prelude.Nothing,
      $sel:copyTags:LaunchConfiguration' :: Maybe Bool
copyTags = forall a. Maybe a
Prelude.Nothing,
      $sel:ec2LaunchTemplateID:LaunchConfiguration' :: Maybe Text
ec2LaunchTemplateID = forall a. Maybe a
Prelude.Nothing,
      $sel:launchDisposition:LaunchConfiguration' :: Maybe LaunchDisposition
launchDisposition = forall a. Maybe a
Prelude.Nothing,
      $sel:licensing:LaunchConfiguration' :: Maybe Licensing
licensing = forall a. Maybe a
Prelude.Nothing,
      $sel:name:LaunchConfiguration' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:sourceServerID:LaunchConfiguration' :: Maybe Text
sourceServerID = forall a. Maybe a
Prelude.Nothing,
      $sel:targetInstanceTypeRightSizingMethod:LaunchConfiguration' :: Maybe TargetInstanceTypeRightSizingMethod
targetInstanceTypeRightSizingMethod =
        forall a. Maybe a
Prelude.Nothing
    }

-- | Whether we should copy the Private IP of the Source Server to the
-- Recovery Instance.
launchConfiguration_copyPrivateIp :: Lens.Lens' LaunchConfiguration (Prelude.Maybe Prelude.Bool)
launchConfiguration_copyPrivateIp :: Lens' LaunchConfiguration (Maybe Bool)
launchConfiguration_copyPrivateIp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchConfiguration' {Maybe Bool
copyPrivateIp :: Maybe Bool
$sel:copyPrivateIp:LaunchConfiguration' :: LaunchConfiguration -> Maybe Bool
copyPrivateIp} -> Maybe Bool
copyPrivateIp) (\s :: LaunchConfiguration
s@LaunchConfiguration' {} Maybe Bool
a -> LaunchConfiguration
s {$sel:copyPrivateIp:LaunchConfiguration' :: Maybe Bool
copyPrivateIp = Maybe Bool
a} :: LaunchConfiguration)

-- | Whether we want to copy the tags of the Source Server to the EC2 machine
-- of the Recovery Instance.
launchConfiguration_copyTags :: Lens.Lens' LaunchConfiguration (Prelude.Maybe Prelude.Bool)
launchConfiguration_copyTags :: Lens' LaunchConfiguration (Maybe Bool)
launchConfiguration_copyTags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchConfiguration' {Maybe Bool
copyTags :: Maybe Bool
$sel:copyTags:LaunchConfiguration' :: LaunchConfiguration -> Maybe Bool
copyTags} -> Maybe Bool
copyTags) (\s :: LaunchConfiguration
s@LaunchConfiguration' {} Maybe Bool
a -> LaunchConfiguration
s {$sel:copyTags:LaunchConfiguration' :: Maybe Bool
copyTags = Maybe Bool
a} :: LaunchConfiguration)

-- | The EC2 launch template ID of this launch configuration.
launchConfiguration_ec2LaunchTemplateID :: Lens.Lens' LaunchConfiguration (Prelude.Maybe Prelude.Text)
launchConfiguration_ec2LaunchTemplateID :: Lens' LaunchConfiguration (Maybe Text)
launchConfiguration_ec2LaunchTemplateID = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchConfiguration' {Maybe Text
ec2LaunchTemplateID :: Maybe Text
$sel:ec2LaunchTemplateID:LaunchConfiguration' :: LaunchConfiguration -> Maybe Text
ec2LaunchTemplateID} -> Maybe Text
ec2LaunchTemplateID) (\s :: LaunchConfiguration
s@LaunchConfiguration' {} Maybe Text
a -> LaunchConfiguration
s {$sel:ec2LaunchTemplateID:LaunchConfiguration' :: Maybe Text
ec2LaunchTemplateID = Maybe Text
a} :: LaunchConfiguration)

-- | The state of the Recovery Instance in EC2 after the recovery operation.
launchConfiguration_launchDisposition :: Lens.Lens' LaunchConfiguration (Prelude.Maybe LaunchDisposition)
launchConfiguration_launchDisposition :: Lens' LaunchConfiguration (Maybe LaunchDisposition)
launchConfiguration_launchDisposition = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchConfiguration' {Maybe LaunchDisposition
launchDisposition :: Maybe LaunchDisposition
$sel:launchDisposition:LaunchConfiguration' :: LaunchConfiguration -> Maybe LaunchDisposition
launchDisposition} -> Maybe LaunchDisposition
launchDisposition) (\s :: LaunchConfiguration
s@LaunchConfiguration' {} Maybe LaunchDisposition
a -> LaunchConfiguration
s {$sel:launchDisposition:LaunchConfiguration' :: Maybe LaunchDisposition
launchDisposition = Maybe LaunchDisposition
a} :: LaunchConfiguration)

-- | The licensing configuration to be used for this launch configuration.
launchConfiguration_licensing :: Lens.Lens' LaunchConfiguration (Prelude.Maybe Licensing)
launchConfiguration_licensing :: Lens' LaunchConfiguration (Maybe Licensing)
launchConfiguration_licensing = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchConfiguration' {Maybe Licensing
licensing :: Maybe Licensing
$sel:licensing:LaunchConfiguration' :: LaunchConfiguration -> Maybe Licensing
licensing} -> Maybe Licensing
licensing) (\s :: LaunchConfiguration
s@LaunchConfiguration' {} Maybe Licensing
a -> LaunchConfiguration
s {$sel:licensing:LaunchConfiguration' :: Maybe Licensing
licensing = Maybe Licensing
a} :: LaunchConfiguration)

-- | The name of the launch configuration.
launchConfiguration_name :: Lens.Lens' LaunchConfiguration (Prelude.Maybe Prelude.Text)
launchConfiguration_name :: Lens' LaunchConfiguration (Maybe Text)
launchConfiguration_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchConfiguration' {Maybe Text
name :: Maybe Text
$sel:name:LaunchConfiguration' :: LaunchConfiguration -> Maybe Text
name} -> Maybe Text
name) (\s :: LaunchConfiguration
s@LaunchConfiguration' {} Maybe Text
a -> LaunchConfiguration
s {$sel:name:LaunchConfiguration' :: Maybe Text
name = Maybe Text
a} :: LaunchConfiguration)

-- | The ID of the Source Server for this launch configuration.
launchConfiguration_sourceServerID :: Lens.Lens' LaunchConfiguration (Prelude.Maybe Prelude.Text)
launchConfiguration_sourceServerID :: Lens' LaunchConfiguration (Maybe Text)
launchConfiguration_sourceServerID = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchConfiguration' {Maybe Text
sourceServerID :: Maybe Text
$sel:sourceServerID:LaunchConfiguration' :: LaunchConfiguration -> Maybe Text
sourceServerID} -> Maybe Text
sourceServerID) (\s :: LaunchConfiguration
s@LaunchConfiguration' {} Maybe Text
a -> LaunchConfiguration
s {$sel:sourceServerID:LaunchConfiguration' :: Maybe Text
sourceServerID = Maybe Text
a} :: LaunchConfiguration)

-- | Whether Elastic Disaster Recovery should try to automatically choose the
-- instance type that best matches the OS, CPU, and RAM of your Source
-- Server.
launchConfiguration_targetInstanceTypeRightSizingMethod :: Lens.Lens' LaunchConfiguration (Prelude.Maybe TargetInstanceTypeRightSizingMethod)
launchConfiguration_targetInstanceTypeRightSizingMethod :: Lens'
  LaunchConfiguration (Maybe TargetInstanceTypeRightSizingMethod)
launchConfiguration_targetInstanceTypeRightSizingMethod = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchConfiguration' {Maybe TargetInstanceTypeRightSizingMethod
targetInstanceTypeRightSizingMethod :: Maybe TargetInstanceTypeRightSizingMethod
$sel:targetInstanceTypeRightSizingMethod:LaunchConfiguration' :: LaunchConfiguration -> Maybe TargetInstanceTypeRightSizingMethod
targetInstanceTypeRightSizingMethod} -> Maybe TargetInstanceTypeRightSizingMethod
targetInstanceTypeRightSizingMethod) (\s :: LaunchConfiguration
s@LaunchConfiguration' {} Maybe TargetInstanceTypeRightSizingMethod
a -> LaunchConfiguration
s {$sel:targetInstanceTypeRightSizingMethod:LaunchConfiguration' :: Maybe TargetInstanceTypeRightSizingMethod
targetInstanceTypeRightSizingMethod = Maybe TargetInstanceTypeRightSizingMethod
a} :: LaunchConfiguration)

instance Data.FromJSON LaunchConfiguration where
  parseJSON :: Value -> Parser LaunchConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LaunchConfiguration"
      ( \Object
x ->
          Maybe Bool
-> Maybe Bool
-> Maybe Text
-> Maybe LaunchDisposition
-> Maybe Licensing
-> Maybe Text
-> Maybe Text
-> Maybe TargetInstanceTypeRightSizingMethod
-> LaunchConfiguration
LaunchConfiguration'
            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
"copyPrivateIp")
            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
"copyTags")
            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
"ec2LaunchTemplateID")
            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
"launchDisposition")
            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
"licensing")
            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
"name")
            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")
            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
"targetInstanceTypeRightSizingMethod")
      )

instance Prelude.Hashable LaunchConfiguration where
  hashWithSalt :: Int -> LaunchConfiguration -> Int
hashWithSalt Int
_salt LaunchConfiguration' {Maybe Bool
Maybe Text
Maybe LaunchDisposition
Maybe Licensing
Maybe TargetInstanceTypeRightSizingMethod
targetInstanceTypeRightSizingMethod :: Maybe TargetInstanceTypeRightSizingMethod
sourceServerID :: Maybe Text
name :: Maybe Text
licensing :: Maybe Licensing
launchDisposition :: Maybe LaunchDisposition
ec2LaunchTemplateID :: Maybe Text
copyTags :: Maybe Bool
copyPrivateIp :: Maybe Bool
$sel:targetInstanceTypeRightSizingMethod:LaunchConfiguration' :: LaunchConfiguration -> Maybe TargetInstanceTypeRightSizingMethod
$sel:sourceServerID:LaunchConfiguration' :: LaunchConfiguration -> Maybe Text
$sel:name:LaunchConfiguration' :: LaunchConfiguration -> Maybe Text
$sel:licensing:LaunchConfiguration' :: LaunchConfiguration -> Maybe Licensing
$sel:launchDisposition:LaunchConfiguration' :: LaunchConfiguration -> Maybe LaunchDisposition
$sel:ec2LaunchTemplateID:LaunchConfiguration' :: LaunchConfiguration -> Maybe Text
$sel:copyTags:LaunchConfiguration' :: LaunchConfiguration -> Maybe Bool
$sel:copyPrivateIp:LaunchConfiguration' :: LaunchConfiguration -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
copyPrivateIp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
copyTags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ec2LaunchTemplateID
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LaunchDisposition
launchDisposition
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Licensing
licensing
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sourceServerID
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TargetInstanceTypeRightSizingMethod
targetInstanceTypeRightSizingMethod

instance Prelude.NFData LaunchConfiguration where
  rnf :: LaunchConfiguration -> ()
rnf LaunchConfiguration' {Maybe Bool
Maybe Text
Maybe LaunchDisposition
Maybe Licensing
Maybe TargetInstanceTypeRightSizingMethod
targetInstanceTypeRightSizingMethod :: Maybe TargetInstanceTypeRightSizingMethod
sourceServerID :: Maybe Text
name :: Maybe Text
licensing :: Maybe Licensing
launchDisposition :: Maybe LaunchDisposition
ec2LaunchTemplateID :: Maybe Text
copyTags :: Maybe Bool
copyPrivateIp :: Maybe Bool
$sel:targetInstanceTypeRightSizingMethod:LaunchConfiguration' :: LaunchConfiguration -> Maybe TargetInstanceTypeRightSizingMethod
$sel:sourceServerID:LaunchConfiguration' :: LaunchConfiguration -> Maybe Text
$sel:name:LaunchConfiguration' :: LaunchConfiguration -> Maybe Text
$sel:licensing:LaunchConfiguration' :: LaunchConfiguration -> Maybe Licensing
$sel:launchDisposition:LaunchConfiguration' :: LaunchConfiguration -> Maybe LaunchDisposition
$sel:ec2LaunchTemplateID:LaunchConfiguration' :: LaunchConfiguration -> Maybe Text
$sel:copyTags:LaunchConfiguration' :: LaunchConfiguration -> Maybe Bool
$sel:copyPrivateIp:LaunchConfiguration' :: LaunchConfiguration -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
copyPrivateIp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
copyTags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
ec2LaunchTemplateID
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe LaunchDisposition
launchDisposition
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Licensing
licensing
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sourceServerID
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TargetInstanceTypeRightSizingMethod
targetInstanceTypeRightSizingMethod