{-# 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.ImageBuilder.Types.FastLaunchSnapshotConfiguration
-- 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.ImageBuilder.Types.FastLaunchSnapshotConfiguration where

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

-- | Configuration settings for creating and managing pre-provisioned
-- snapshots for a fast-launch enabled Windows AMI.
--
-- /See:/ 'newFastLaunchSnapshotConfiguration' smart constructor.
data FastLaunchSnapshotConfiguration = FastLaunchSnapshotConfiguration'
  { -- | The number of pre-provisioned snapshots to keep on hand for a
    -- fast-launch enabled Windows AMI.
    FastLaunchSnapshotConfiguration -> Maybe Natural
targetResourceCount :: Prelude.Maybe Prelude.Natural
  }
  deriving (FastLaunchSnapshotConfiguration
-> FastLaunchSnapshotConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FastLaunchSnapshotConfiguration
-> FastLaunchSnapshotConfiguration -> Bool
$c/= :: FastLaunchSnapshotConfiguration
-> FastLaunchSnapshotConfiguration -> Bool
== :: FastLaunchSnapshotConfiguration
-> FastLaunchSnapshotConfiguration -> Bool
$c== :: FastLaunchSnapshotConfiguration
-> FastLaunchSnapshotConfiguration -> Bool
Prelude.Eq, ReadPrec [FastLaunchSnapshotConfiguration]
ReadPrec FastLaunchSnapshotConfiguration
Int -> ReadS FastLaunchSnapshotConfiguration
ReadS [FastLaunchSnapshotConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FastLaunchSnapshotConfiguration]
$creadListPrec :: ReadPrec [FastLaunchSnapshotConfiguration]
readPrec :: ReadPrec FastLaunchSnapshotConfiguration
$creadPrec :: ReadPrec FastLaunchSnapshotConfiguration
readList :: ReadS [FastLaunchSnapshotConfiguration]
$creadList :: ReadS [FastLaunchSnapshotConfiguration]
readsPrec :: Int -> ReadS FastLaunchSnapshotConfiguration
$creadsPrec :: Int -> ReadS FastLaunchSnapshotConfiguration
Prelude.Read, Int -> FastLaunchSnapshotConfiguration -> ShowS
[FastLaunchSnapshotConfiguration] -> ShowS
FastLaunchSnapshotConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FastLaunchSnapshotConfiguration] -> ShowS
$cshowList :: [FastLaunchSnapshotConfiguration] -> ShowS
show :: FastLaunchSnapshotConfiguration -> String
$cshow :: FastLaunchSnapshotConfiguration -> String
showsPrec :: Int -> FastLaunchSnapshotConfiguration -> ShowS
$cshowsPrec :: Int -> FastLaunchSnapshotConfiguration -> ShowS
Prelude.Show, forall x.
Rep FastLaunchSnapshotConfiguration x
-> FastLaunchSnapshotConfiguration
forall x.
FastLaunchSnapshotConfiguration
-> Rep FastLaunchSnapshotConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep FastLaunchSnapshotConfiguration x
-> FastLaunchSnapshotConfiguration
$cfrom :: forall x.
FastLaunchSnapshotConfiguration
-> Rep FastLaunchSnapshotConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'FastLaunchSnapshotConfiguration' 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:
--
-- 'targetResourceCount', 'fastLaunchSnapshotConfiguration_targetResourceCount' - The number of pre-provisioned snapshots to keep on hand for a
-- fast-launch enabled Windows AMI.
newFastLaunchSnapshotConfiguration ::
  FastLaunchSnapshotConfiguration
newFastLaunchSnapshotConfiguration :: FastLaunchSnapshotConfiguration
newFastLaunchSnapshotConfiguration =
  FastLaunchSnapshotConfiguration'
    { $sel:targetResourceCount:FastLaunchSnapshotConfiguration' :: Maybe Natural
targetResourceCount =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The number of pre-provisioned snapshots to keep on hand for a
-- fast-launch enabled Windows AMI.
fastLaunchSnapshotConfiguration_targetResourceCount :: Lens.Lens' FastLaunchSnapshotConfiguration (Prelude.Maybe Prelude.Natural)
fastLaunchSnapshotConfiguration_targetResourceCount :: Lens' FastLaunchSnapshotConfiguration (Maybe Natural)
fastLaunchSnapshotConfiguration_targetResourceCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FastLaunchSnapshotConfiguration' {Maybe Natural
targetResourceCount :: Maybe Natural
$sel:targetResourceCount:FastLaunchSnapshotConfiguration' :: FastLaunchSnapshotConfiguration -> Maybe Natural
targetResourceCount} -> Maybe Natural
targetResourceCount) (\s :: FastLaunchSnapshotConfiguration
s@FastLaunchSnapshotConfiguration' {} Maybe Natural
a -> FastLaunchSnapshotConfiguration
s {$sel:targetResourceCount:FastLaunchSnapshotConfiguration' :: Maybe Natural
targetResourceCount = Maybe Natural
a} :: FastLaunchSnapshotConfiguration)

instance
  Data.FromJSON
    FastLaunchSnapshotConfiguration
  where
  parseJSON :: Value -> Parser FastLaunchSnapshotConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FastLaunchSnapshotConfiguration"
      ( \Object
x ->
          Maybe Natural -> FastLaunchSnapshotConfiguration
FastLaunchSnapshotConfiguration'
            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
"targetResourceCount")
      )

instance
  Prelude.Hashable
    FastLaunchSnapshotConfiguration
  where
  hashWithSalt :: Int -> FastLaunchSnapshotConfiguration -> Int
hashWithSalt
    Int
_salt
    FastLaunchSnapshotConfiguration' {Maybe Natural
targetResourceCount :: Maybe Natural
$sel:targetResourceCount:FastLaunchSnapshotConfiguration' :: FastLaunchSnapshotConfiguration -> Maybe Natural
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
targetResourceCount

instance
  Prelude.NFData
    FastLaunchSnapshotConfiguration
  where
  rnf :: FastLaunchSnapshotConfiguration -> ()
rnf FastLaunchSnapshotConfiguration' {Maybe Natural
targetResourceCount :: Maybe Natural
$sel:targetResourceCount:FastLaunchSnapshotConfiguration' :: FastLaunchSnapshotConfiguration -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
targetResourceCount

instance Data.ToJSON FastLaunchSnapshotConfiguration where
  toJSON :: FastLaunchSnapshotConfiguration -> Value
toJSON FastLaunchSnapshotConfiguration' {Maybe Natural
targetResourceCount :: Maybe Natural
$sel:targetResourceCount:FastLaunchSnapshotConfiguration' :: FastLaunchSnapshotConfiguration -> Maybe Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"targetResourceCount" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
targetResourceCount
          ]
      )