{-# 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.FleetLaunchTemplateConfigRequest
-- 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.FleetLaunchTemplateConfigRequest 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 Amazonka.EC2.Types.FleetLaunchTemplateOverridesRequest
import Amazonka.EC2.Types.FleetLaunchTemplateSpecificationRequest
import qualified Amazonka.Prelude as Prelude

-- | Describes a launch template and overrides.
--
-- /See:/ 'newFleetLaunchTemplateConfigRequest' smart constructor.
data FleetLaunchTemplateConfigRequest = FleetLaunchTemplateConfigRequest'
  { -- | The launch template to use. You must specify either the launch template
    -- ID or launch template name in the request.
    FleetLaunchTemplateConfigRequest
-> Maybe FleetLaunchTemplateSpecificationRequest
launchTemplateSpecification :: Prelude.Maybe FleetLaunchTemplateSpecificationRequest,
    -- | Any parameters that you specify override the same parameters in the
    -- launch template.
    --
    -- For fleets of type @request@ and @maintain@, a maximum of 300 items is
    -- allowed across all launch templates.
    FleetLaunchTemplateConfigRequest
-> Maybe [FleetLaunchTemplateOverridesRequest]
overrides :: Prelude.Maybe [FleetLaunchTemplateOverridesRequest]
  }
  deriving (FleetLaunchTemplateConfigRequest
-> FleetLaunchTemplateConfigRequest -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FleetLaunchTemplateConfigRequest
-> FleetLaunchTemplateConfigRequest -> Bool
$c/= :: FleetLaunchTemplateConfigRequest
-> FleetLaunchTemplateConfigRequest -> Bool
== :: FleetLaunchTemplateConfigRequest
-> FleetLaunchTemplateConfigRequest -> Bool
$c== :: FleetLaunchTemplateConfigRequest
-> FleetLaunchTemplateConfigRequest -> Bool
Prelude.Eq, ReadPrec [FleetLaunchTemplateConfigRequest]
ReadPrec FleetLaunchTemplateConfigRequest
Int -> ReadS FleetLaunchTemplateConfigRequest
ReadS [FleetLaunchTemplateConfigRequest]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FleetLaunchTemplateConfigRequest]
$creadListPrec :: ReadPrec [FleetLaunchTemplateConfigRequest]
readPrec :: ReadPrec FleetLaunchTemplateConfigRequest
$creadPrec :: ReadPrec FleetLaunchTemplateConfigRequest
readList :: ReadS [FleetLaunchTemplateConfigRequest]
$creadList :: ReadS [FleetLaunchTemplateConfigRequest]
readsPrec :: Int -> ReadS FleetLaunchTemplateConfigRequest
$creadsPrec :: Int -> ReadS FleetLaunchTemplateConfigRequest
Prelude.Read, Int -> FleetLaunchTemplateConfigRequest -> ShowS
[FleetLaunchTemplateConfigRequest] -> ShowS
FleetLaunchTemplateConfigRequest -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FleetLaunchTemplateConfigRequest] -> ShowS
$cshowList :: [FleetLaunchTemplateConfigRequest] -> ShowS
show :: FleetLaunchTemplateConfigRequest -> String
$cshow :: FleetLaunchTemplateConfigRequest -> String
showsPrec :: Int -> FleetLaunchTemplateConfigRequest -> ShowS
$cshowsPrec :: Int -> FleetLaunchTemplateConfigRequest -> ShowS
Prelude.Show, forall x.
Rep FleetLaunchTemplateConfigRequest x
-> FleetLaunchTemplateConfigRequest
forall x.
FleetLaunchTemplateConfigRequest
-> Rep FleetLaunchTemplateConfigRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep FleetLaunchTemplateConfigRequest x
-> FleetLaunchTemplateConfigRequest
$cfrom :: forall x.
FleetLaunchTemplateConfigRequest
-> Rep FleetLaunchTemplateConfigRequest x
Prelude.Generic)

-- |
-- Create a value of 'FleetLaunchTemplateConfigRequest' 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:
--
-- 'launchTemplateSpecification', 'fleetLaunchTemplateConfigRequest_launchTemplateSpecification' - The launch template to use. You must specify either the launch template
-- ID or launch template name in the request.
--
-- 'overrides', 'fleetLaunchTemplateConfigRequest_overrides' - Any parameters that you specify override the same parameters in the
-- launch template.
--
-- For fleets of type @request@ and @maintain@, a maximum of 300 items is
-- allowed across all launch templates.
newFleetLaunchTemplateConfigRequest ::
  FleetLaunchTemplateConfigRequest
newFleetLaunchTemplateConfigRequest :: FleetLaunchTemplateConfigRequest
newFleetLaunchTemplateConfigRequest =
  FleetLaunchTemplateConfigRequest'
    { $sel:launchTemplateSpecification:FleetLaunchTemplateConfigRequest' :: Maybe FleetLaunchTemplateSpecificationRequest
launchTemplateSpecification =
        forall a. Maybe a
Prelude.Nothing,
      $sel:overrides:FleetLaunchTemplateConfigRequest' :: Maybe [FleetLaunchTemplateOverridesRequest]
overrides = forall a. Maybe a
Prelude.Nothing
    }

-- | The launch template to use. You must specify either the launch template
-- ID or launch template name in the request.
fleetLaunchTemplateConfigRequest_launchTemplateSpecification :: Lens.Lens' FleetLaunchTemplateConfigRequest (Prelude.Maybe FleetLaunchTemplateSpecificationRequest)
fleetLaunchTemplateConfigRequest_launchTemplateSpecification :: Lens'
  FleetLaunchTemplateConfigRequest
  (Maybe FleetLaunchTemplateSpecificationRequest)
fleetLaunchTemplateConfigRequest_launchTemplateSpecification = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FleetLaunchTemplateConfigRequest' {Maybe FleetLaunchTemplateSpecificationRequest
launchTemplateSpecification :: Maybe FleetLaunchTemplateSpecificationRequest
$sel:launchTemplateSpecification:FleetLaunchTemplateConfigRequest' :: FleetLaunchTemplateConfigRequest
-> Maybe FleetLaunchTemplateSpecificationRequest
launchTemplateSpecification} -> Maybe FleetLaunchTemplateSpecificationRequest
launchTemplateSpecification) (\s :: FleetLaunchTemplateConfigRequest
s@FleetLaunchTemplateConfigRequest' {} Maybe FleetLaunchTemplateSpecificationRequest
a -> FleetLaunchTemplateConfigRequest
s {$sel:launchTemplateSpecification:FleetLaunchTemplateConfigRequest' :: Maybe FleetLaunchTemplateSpecificationRequest
launchTemplateSpecification = Maybe FleetLaunchTemplateSpecificationRequest
a} :: FleetLaunchTemplateConfigRequest)

-- | Any parameters that you specify override the same parameters in the
-- launch template.
--
-- For fleets of type @request@ and @maintain@, a maximum of 300 items is
-- allowed across all launch templates.
fleetLaunchTemplateConfigRequest_overrides :: Lens.Lens' FleetLaunchTemplateConfigRequest (Prelude.Maybe [FleetLaunchTemplateOverridesRequest])
fleetLaunchTemplateConfigRequest_overrides :: Lens'
  FleetLaunchTemplateConfigRequest
  (Maybe [FleetLaunchTemplateOverridesRequest])
fleetLaunchTemplateConfigRequest_overrides = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FleetLaunchTemplateConfigRequest' {Maybe [FleetLaunchTemplateOverridesRequest]
overrides :: Maybe [FleetLaunchTemplateOverridesRequest]
$sel:overrides:FleetLaunchTemplateConfigRequest' :: FleetLaunchTemplateConfigRequest
-> Maybe [FleetLaunchTemplateOverridesRequest]
overrides} -> Maybe [FleetLaunchTemplateOverridesRequest]
overrides) (\s :: FleetLaunchTemplateConfigRequest
s@FleetLaunchTemplateConfigRequest' {} Maybe [FleetLaunchTemplateOverridesRequest]
a -> FleetLaunchTemplateConfigRequest
s {$sel:overrides:FleetLaunchTemplateConfigRequest' :: Maybe [FleetLaunchTemplateOverridesRequest]
overrides = Maybe [FleetLaunchTemplateOverridesRequest]
a} :: FleetLaunchTemplateConfigRequest) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Prelude.Hashable
    FleetLaunchTemplateConfigRequest
  where
  hashWithSalt :: Int -> FleetLaunchTemplateConfigRequest -> Int
hashWithSalt
    Int
_salt
    FleetLaunchTemplateConfigRequest' {Maybe [FleetLaunchTemplateOverridesRequest]
Maybe FleetLaunchTemplateSpecificationRequest
overrides :: Maybe [FleetLaunchTemplateOverridesRequest]
launchTemplateSpecification :: Maybe FleetLaunchTemplateSpecificationRequest
$sel:overrides:FleetLaunchTemplateConfigRequest' :: FleetLaunchTemplateConfigRequest
-> Maybe [FleetLaunchTemplateOverridesRequest]
$sel:launchTemplateSpecification:FleetLaunchTemplateConfigRequest' :: FleetLaunchTemplateConfigRequest
-> Maybe FleetLaunchTemplateSpecificationRequest
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FleetLaunchTemplateSpecificationRequest
launchTemplateSpecification
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [FleetLaunchTemplateOverridesRequest]
overrides

instance
  Prelude.NFData
    FleetLaunchTemplateConfigRequest
  where
  rnf :: FleetLaunchTemplateConfigRequest -> ()
rnf FleetLaunchTemplateConfigRequest' {Maybe [FleetLaunchTemplateOverridesRequest]
Maybe FleetLaunchTemplateSpecificationRequest
overrides :: Maybe [FleetLaunchTemplateOverridesRequest]
launchTemplateSpecification :: Maybe FleetLaunchTemplateSpecificationRequest
$sel:overrides:FleetLaunchTemplateConfigRequest' :: FleetLaunchTemplateConfigRequest
-> Maybe [FleetLaunchTemplateOverridesRequest]
$sel:launchTemplateSpecification:FleetLaunchTemplateConfigRequest' :: FleetLaunchTemplateConfigRequest
-> Maybe FleetLaunchTemplateSpecificationRequest
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe FleetLaunchTemplateSpecificationRequest
launchTemplateSpecification
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [FleetLaunchTemplateOverridesRequest]
overrides

instance
  Data.ToQuery
    FleetLaunchTemplateConfigRequest
  where
  toQuery :: FleetLaunchTemplateConfigRequest -> QueryString
toQuery FleetLaunchTemplateConfigRequest' {Maybe [FleetLaunchTemplateOverridesRequest]
Maybe FleetLaunchTemplateSpecificationRequest
overrides :: Maybe [FleetLaunchTemplateOverridesRequest]
launchTemplateSpecification :: Maybe FleetLaunchTemplateSpecificationRequest
$sel:overrides:FleetLaunchTemplateConfigRequest' :: FleetLaunchTemplateConfigRequest
-> Maybe [FleetLaunchTemplateOverridesRequest]
$sel:launchTemplateSpecification:FleetLaunchTemplateConfigRequest' :: FleetLaunchTemplateConfigRequest
-> Maybe FleetLaunchTemplateSpecificationRequest
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"LaunchTemplateSpecification"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe FleetLaunchTemplateSpecificationRequest
launchTemplateSpecification,
        forall a. ToQuery a => a -> QueryString
Data.toQuery
          (forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"Overrides" forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [FleetLaunchTemplateOverridesRequest]
overrides)
      ]