{-# 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.EC2.Types.FleetLaunchTemplateSpecificationRequest
-- 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.EC2.Types.FleetLaunchTemplateSpecificationRequest where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Internal
import qualified Amazonka.Prelude as Prelude

-- | The Amazon EC2 launch template that can be used by an EC2 Fleet to
-- configure Amazon EC2 instances. You must specify either the ID or name
-- of the launch template in the request, but not both.
--
-- For information about launch templates, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html Launch an instance from a launch template>
-- in the /Amazon EC2 User Guide/.
--
-- /See:/ 'newFleetLaunchTemplateSpecificationRequest' smart constructor.
data FleetLaunchTemplateSpecificationRequest = FleetLaunchTemplateSpecificationRequest'
  { -- | The ID of the launch template.
    --
    -- You must specify the @LaunchTemplateId@ or the @LaunchTemplateName@, but
    -- not both.
    FleetLaunchTemplateSpecificationRequest -> Maybe Text
launchTemplateId :: Prelude.Maybe Prelude.Text,
    -- | The name of the launch template.
    --
    -- You must specify the @LaunchTemplateName@ or the @LaunchTemplateId@, but
    -- not both.
    FleetLaunchTemplateSpecificationRequest -> Maybe Text
launchTemplateName :: Prelude.Maybe Prelude.Text,
    -- | The launch template version number, @$Latest@, or @$Default@. You must
    -- specify a value, otherwise the request fails.
    --
    -- If the value is @$Latest@, Amazon EC2 uses the latest version of the
    -- launch template.
    --
    -- If the value is @$Default@, Amazon EC2 uses the default version of the
    -- launch template.
    FleetLaunchTemplateSpecificationRequest -> Maybe Text
version :: Prelude.Maybe Prelude.Text
  }
  deriving (FleetLaunchTemplateSpecificationRequest
-> FleetLaunchTemplateSpecificationRequest -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FleetLaunchTemplateSpecificationRequest
-> FleetLaunchTemplateSpecificationRequest -> Bool
$c/= :: FleetLaunchTemplateSpecificationRequest
-> FleetLaunchTemplateSpecificationRequest -> Bool
== :: FleetLaunchTemplateSpecificationRequest
-> FleetLaunchTemplateSpecificationRequest -> Bool
$c== :: FleetLaunchTemplateSpecificationRequest
-> FleetLaunchTemplateSpecificationRequest -> Bool
Prelude.Eq, ReadPrec [FleetLaunchTemplateSpecificationRequest]
ReadPrec FleetLaunchTemplateSpecificationRequest
Int -> ReadS FleetLaunchTemplateSpecificationRequest
ReadS [FleetLaunchTemplateSpecificationRequest]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FleetLaunchTemplateSpecificationRequest]
$creadListPrec :: ReadPrec [FleetLaunchTemplateSpecificationRequest]
readPrec :: ReadPrec FleetLaunchTemplateSpecificationRequest
$creadPrec :: ReadPrec FleetLaunchTemplateSpecificationRequest
readList :: ReadS [FleetLaunchTemplateSpecificationRequest]
$creadList :: ReadS [FleetLaunchTemplateSpecificationRequest]
readsPrec :: Int -> ReadS FleetLaunchTemplateSpecificationRequest
$creadsPrec :: Int -> ReadS FleetLaunchTemplateSpecificationRequest
Prelude.Read, Int -> FleetLaunchTemplateSpecificationRequest -> ShowS
[FleetLaunchTemplateSpecificationRequest] -> ShowS
FleetLaunchTemplateSpecificationRequest -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FleetLaunchTemplateSpecificationRequest] -> ShowS
$cshowList :: [FleetLaunchTemplateSpecificationRequest] -> ShowS
show :: FleetLaunchTemplateSpecificationRequest -> String
$cshow :: FleetLaunchTemplateSpecificationRequest -> String
showsPrec :: Int -> FleetLaunchTemplateSpecificationRequest -> ShowS
$cshowsPrec :: Int -> FleetLaunchTemplateSpecificationRequest -> ShowS
Prelude.Show, forall x.
Rep FleetLaunchTemplateSpecificationRequest x
-> FleetLaunchTemplateSpecificationRequest
forall x.
FleetLaunchTemplateSpecificationRequest
-> Rep FleetLaunchTemplateSpecificationRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep FleetLaunchTemplateSpecificationRequest x
-> FleetLaunchTemplateSpecificationRequest
$cfrom :: forall x.
FleetLaunchTemplateSpecificationRequest
-> Rep FleetLaunchTemplateSpecificationRequest x
Prelude.Generic)

-- |
-- Create a value of 'FleetLaunchTemplateSpecificationRequest' 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:
--
-- 'launchTemplateId', 'fleetLaunchTemplateSpecificationRequest_launchTemplateId' - The ID of the launch template.
--
-- You must specify the @LaunchTemplateId@ or the @LaunchTemplateName@, but
-- not both.
--
-- 'launchTemplateName', 'fleetLaunchTemplateSpecificationRequest_launchTemplateName' - The name of the launch template.
--
-- You must specify the @LaunchTemplateName@ or the @LaunchTemplateId@, but
-- not both.
--
-- 'version', 'fleetLaunchTemplateSpecificationRequest_version' - The launch template version number, @$Latest@, or @$Default@. You must
-- specify a value, otherwise the request fails.
--
-- If the value is @$Latest@, Amazon EC2 uses the latest version of the
-- launch template.
--
-- If the value is @$Default@, Amazon EC2 uses the default version of the
-- launch template.
newFleetLaunchTemplateSpecificationRequest ::
  FleetLaunchTemplateSpecificationRequest
newFleetLaunchTemplateSpecificationRequest :: FleetLaunchTemplateSpecificationRequest
newFleetLaunchTemplateSpecificationRequest =
  FleetLaunchTemplateSpecificationRequest'
    { $sel:launchTemplateId:FleetLaunchTemplateSpecificationRequest' :: Maybe Text
launchTemplateId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:launchTemplateName:FleetLaunchTemplateSpecificationRequest' :: Maybe Text
launchTemplateName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:version:FleetLaunchTemplateSpecificationRequest' :: Maybe Text
version = forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the launch template.
--
-- You must specify the @LaunchTemplateId@ or the @LaunchTemplateName@, but
-- not both.
fleetLaunchTemplateSpecificationRequest_launchTemplateId :: Lens.Lens' FleetLaunchTemplateSpecificationRequest (Prelude.Maybe Prelude.Text)
fleetLaunchTemplateSpecificationRequest_launchTemplateId :: Lens' FleetLaunchTemplateSpecificationRequest (Maybe Text)
fleetLaunchTemplateSpecificationRequest_launchTemplateId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FleetLaunchTemplateSpecificationRequest' {Maybe Text
launchTemplateId :: Maybe Text
$sel:launchTemplateId:FleetLaunchTemplateSpecificationRequest' :: FleetLaunchTemplateSpecificationRequest -> Maybe Text
launchTemplateId} -> Maybe Text
launchTemplateId) (\s :: FleetLaunchTemplateSpecificationRequest
s@FleetLaunchTemplateSpecificationRequest' {} Maybe Text
a -> FleetLaunchTemplateSpecificationRequest
s {$sel:launchTemplateId:FleetLaunchTemplateSpecificationRequest' :: Maybe Text
launchTemplateId = Maybe Text
a} :: FleetLaunchTemplateSpecificationRequest)

-- | The name of the launch template.
--
-- You must specify the @LaunchTemplateName@ or the @LaunchTemplateId@, but
-- not both.
fleetLaunchTemplateSpecificationRequest_launchTemplateName :: Lens.Lens' FleetLaunchTemplateSpecificationRequest (Prelude.Maybe Prelude.Text)
fleetLaunchTemplateSpecificationRequest_launchTemplateName :: Lens' FleetLaunchTemplateSpecificationRequest (Maybe Text)
fleetLaunchTemplateSpecificationRequest_launchTemplateName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FleetLaunchTemplateSpecificationRequest' {Maybe Text
launchTemplateName :: Maybe Text
$sel:launchTemplateName:FleetLaunchTemplateSpecificationRequest' :: FleetLaunchTemplateSpecificationRequest -> Maybe Text
launchTemplateName} -> Maybe Text
launchTemplateName) (\s :: FleetLaunchTemplateSpecificationRequest
s@FleetLaunchTemplateSpecificationRequest' {} Maybe Text
a -> FleetLaunchTemplateSpecificationRequest
s {$sel:launchTemplateName:FleetLaunchTemplateSpecificationRequest' :: Maybe Text
launchTemplateName = Maybe Text
a} :: FleetLaunchTemplateSpecificationRequest)

-- | The launch template version number, @$Latest@, or @$Default@. You must
-- specify a value, otherwise the request fails.
--
-- If the value is @$Latest@, Amazon EC2 uses the latest version of the
-- launch template.
--
-- If the value is @$Default@, Amazon EC2 uses the default version of the
-- launch template.
fleetLaunchTemplateSpecificationRequest_version :: Lens.Lens' FleetLaunchTemplateSpecificationRequest (Prelude.Maybe Prelude.Text)
fleetLaunchTemplateSpecificationRequest_version :: Lens' FleetLaunchTemplateSpecificationRequest (Maybe Text)
fleetLaunchTemplateSpecificationRequest_version = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FleetLaunchTemplateSpecificationRequest' {Maybe Text
version :: Maybe Text
$sel:version:FleetLaunchTemplateSpecificationRequest' :: FleetLaunchTemplateSpecificationRequest -> Maybe Text
version} -> Maybe Text
version) (\s :: FleetLaunchTemplateSpecificationRequest
s@FleetLaunchTemplateSpecificationRequest' {} Maybe Text
a -> FleetLaunchTemplateSpecificationRequest
s {$sel:version:FleetLaunchTemplateSpecificationRequest' :: Maybe Text
version = Maybe Text
a} :: FleetLaunchTemplateSpecificationRequest)

instance
  Prelude.Hashable
    FleetLaunchTemplateSpecificationRequest
  where
  hashWithSalt :: Int -> FleetLaunchTemplateSpecificationRequest -> Int
hashWithSalt
    Int
_salt
    FleetLaunchTemplateSpecificationRequest' {Maybe Text
version :: Maybe Text
launchTemplateName :: Maybe Text
launchTemplateId :: Maybe Text
$sel:version:FleetLaunchTemplateSpecificationRequest' :: FleetLaunchTemplateSpecificationRequest -> Maybe Text
$sel:launchTemplateName:FleetLaunchTemplateSpecificationRequest' :: FleetLaunchTemplateSpecificationRequest -> Maybe Text
$sel:launchTemplateId:FleetLaunchTemplateSpecificationRequest' :: FleetLaunchTemplateSpecificationRequest -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
launchTemplateId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
launchTemplateName
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
version

instance
  Prelude.NFData
    FleetLaunchTemplateSpecificationRequest
  where
  rnf :: FleetLaunchTemplateSpecificationRequest -> ()
rnf FleetLaunchTemplateSpecificationRequest' {Maybe Text
version :: Maybe Text
launchTemplateName :: Maybe Text
launchTemplateId :: Maybe Text
$sel:version:FleetLaunchTemplateSpecificationRequest' :: FleetLaunchTemplateSpecificationRequest -> Maybe Text
$sel:launchTemplateName:FleetLaunchTemplateSpecificationRequest' :: FleetLaunchTemplateSpecificationRequest -> Maybe Text
$sel:launchTemplateId:FleetLaunchTemplateSpecificationRequest' :: FleetLaunchTemplateSpecificationRequest -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
launchTemplateId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
launchTemplateName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
version

instance
  Data.ToQuery
    FleetLaunchTemplateSpecificationRequest
  where
  toQuery :: FleetLaunchTemplateSpecificationRequest -> QueryString
toQuery FleetLaunchTemplateSpecificationRequest' {Maybe Text
version :: Maybe Text
launchTemplateName :: Maybe Text
launchTemplateId :: Maybe Text
$sel:version:FleetLaunchTemplateSpecificationRequest' :: FleetLaunchTemplateSpecificationRequest -> Maybe Text
$sel:launchTemplateName:FleetLaunchTemplateSpecificationRequest' :: FleetLaunchTemplateSpecificationRequest -> Maybe Text
$sel:launchTemplateId:FleetLaunchTemplateSpecificationRequest' :: FleetLaunchTemplateSpecificationRequest -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"LaunchTemplateId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
launchTemplateId,
        ByteString
"LaunchTemplateName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
launchTemplateName,
        ByteString
"Version" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
version
      ]