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

-- | Launch template disk configuration.
--
-- /See:/ 'newLaunchTemplateDiskConf' smart constructor.
data LaunchTemplateDiskConf = LaunchTemplateDiskConf'
  { -- | Launch template disk iops configuration.
    LaunchTemplateDiskConf -> Maybe Natural
iops :: Prelude.Maybe Prelude.Natural,
    -- | Launch template disk throughput configuration.
    LaunchTemplateDiskConf -> Maybe Natural
throughput :: Prelude.Maybe Prelude.Natural,
    -- | Launch template disk volume type configuration.
    LaunchTemplateDiskConf -> Maybe VolumeType
volumeType :: Prelude.Maybe VolumeType
  }
  deriving (LaunchTemplateDiskConf -> LaunchTemplateDiskConf -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LaunchTemplateDiskConf -> LaunchTemplateDiskConf -> Bool
$c/= :: LaunchTemplateDiskConf -> LaunchTemplateDiskConf -> Bool
== :: LaunchTemplateDiskConf -> LaunchTemplateDiskConf -> Bool
$c== :: LaunchTemplateDiskConf -> LaunchTemplateDiskConf -> Bool
Prelude.Eq, ReadPrec [LaunchTemplateDiskConf]
ReadPrec LaunchTemplateDiskConf
Int -> ReadS LaunchTemplateDiskConf
ReadS [LaunchTemplateDiskConf]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LaunchTemplateDiskConf]
$creadListPrec :: ReadPrec [LaunchTemplateDiskConf]
readPrec :: ReadPrec LaunchTemplateDiskConf
$creadPrec :: ReadPrec LaunchTemplateDiskConf
readList :: ReadS [LaunchTemplateDiskConf]
$creadList :: ReadS [LaunchTemplateDiskConf]
readsPrec :: Int -> ReadS LaunchTemplateDiskConf
$creadsPrec :: Int -> ReadS LaunchTemplateDiskConf
Prelude.Read, Int -> LaunchTemplateDiskConf -> ShowS
[LaunchTemplateDiskConf] -> ShowS
LaunchTemplateDiskConf -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LaunchTemplateDiskConf] -> ShowS
$cshowList :: [LaunchTemplateDiskConf] -> ShowS
show :: LaunchTemplateDiskConf -> String
$cshow :: LaunchTemplateDiskConf -> String
showsPrec :: Int -> LaunchTemplateDiskConf -> ShowS
$cshowsPrec :: Int -> LaunchTemplateDiskConf -> ShowS
Prelude.Show, forall x. Rep LaunchTemplateDiskConf x -> LaunchTemplateDiskConf
forall x. LaunchTemplateDiskConf -> Rep LaunchTemplateDiskConf x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LaunchTemplateDiskConf x -> LaunchTemplateDiskConf
$cfrom :: forall x. LaunchTemplateDiskConf -> Rep LaunchTemplateDiskConf x
Prelude.Generic)

-- |
-- Create a value of 'LaunchTemplateDiskConf' 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:
--
-- 'iops', 'launchTemplateDiskConf_iops' - Launch template disk iops configuration.
--
-- 'throughput', 'launchTemplateDiskConf_throughput' - Launch template disk throughput configuration.
--
-- 'volumeType', 'launchTemplateDiskConf_volumeType' - Launch template disk volume type configuration.
newLaunchTemplateDiskConf ::
  LaunchTemplateDiskConf
newLaunchTemplateDiskConf :: LaunchTemplateDiskConf
newLaunchTemplateDiskConf =
  LaunchTemplateDiskConf'
    { $sel:iops:LaunchTemplateDiskConf' :: Maybe Natural
iops = forall a. Maybe a
Prelude.Nothing,
      $sel:throughput:LaunchTemplateDiskConf' :: Maybe Natural
throughput = forall a. Maybe a
Prelude.Nothing,
      $sel:volumeType:LaunchTemplateDiskConf' :: Maybe VolumeType
volumeType = forall a. Maybe a
Prelude.Nothing
    }

-- | Launch template disk iops configuration.
launchTemplateDiskConf_iops :: Lens.Lens' LaunchTemplateDiskConf (Prelude.Maybe Prelude.Natural)
launchTemplateDiskConf_iops :: Lens' LaunchTemplateDiskConf (Maybe Natural)
launchTemplateDiskConf_iops = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchTemplateDiskConf' {Maybe Natural
iops :: Maybe Natural
$sel:iops:LaunchTemplateDiskConf' :: LaunchTemplateDiskConf -> Maybe Natural
iops} -> Maybe Natural
iops) (\s :: LaunchTemplateDiskConf
s@LaunchTemplateDiskConf' {} Maybe Natural
a -> LaunchTemplateDiskConf
s {$sel:iops:LaunchTemplateDiskConf' :: Maybe Natural
iops = Maybe Natural
a} :: LaunchTemplateDiskConf)

-- | Launch template disk throughput configuration.
launchTemplateDiskConf_throughput :: Lens.Lens' LaunchTemplateDiskConf (Prelude.Maybe Prelude.Natural)
launchTemplateDiskConf_throughput :: Lens' LaunchTemplateDiskConf (Maybe Natural)
launchTemplateDiskConf_throughput = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchTemplateDiskConf' {Maybe Natural
throughput :: Maybe Natural
$sel:throughput:LaunchTemplateDiskConf' :: LaunchTemplateDiskConf -> Maybe Natural
throughput} -> Maybe Natural
throughput) (\s :: LaunchTemplateDiskConf
s@LaunchTemplateDiskConf' {} Maybe Natural
a -> LaunchTemplateDiskConf
s {$sel:throughput:LaunchTemplateDiskConf' :: Maybe Natural
throughput = Maybe Natural
a} :: LaunchTemplateDiskConf)

-- | Launch template disk volume type configuration.
launchTemplateDiskConf_volumeType :: Lens.Lens' LaunchTemplateDiskConf (Prelude.Maybe VolumeType)
launchTemplateDiskConf_volumeType :: Lens' LaunchTemplateDiskConf (Maybe VolumeType)
launchTemplateDiskConf_volumeType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchTemplateDiskConf' {Maybe VolumeType
volumeType :: Maybe VolumeType
$sel:volumeType:LaunchTemplateDiskConf' :: LaunchTemplateDiskConf -> Maybe VolumeType
volumeType} -> Maybe VolumeType
volumeType) (\s :: LaunchTemplateDiskConf
s@LaunchTemplateDiskConf' {} Maybe VolumeType
a -> LaunchTemplateDiskConf
s {$sel:volumeType:LaunchTemplateDiskConf' :: Maybe VolumeType
volumeType = Maybe VolumeType
a} :: LaunchTemplateDiskConf)

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

instance Prelude.Hashable LaunchTemplateDiskConf where
  hashWithSalt :: Int -> LaunchTemplateDiskConf -> Int
hashWithSalt Int
_salt LaunchTemplateDiskConf' {Maybe Natural
Maybe VolumeType
volumeType :: Maybe VolumeType
throughput :: Maybe Natural
iops :: Maybe Natural
$sel:volumeType:LaunchTemplateDiskConf' :: LaunchTemplateDiskConf -> Maybe VolumeType
$sel:throughput:LaunchTemplateDiskConf' :: LaunchTemplateDiskConf -> Maybe Natural
$sel:iops:LaunchTemplateDiskConf' :: LaunchTemplateDiskConf -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
iops
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
throughput
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VolumeType
volumeType

instance Prelude.NFData LaunchTemplateDiskConf where
  rnf :: LaunchTemplateDiskConf -> ()
rnf LaunchTemplateDiskConf' {Maybe Natural
Maybe VolumeType
volumeType :: Maybe VolumeType
throughput :: Maybe Natural
iops :: Maybe Natural
$sel:volumeType:LaunchTemplateDiskConf' :: LaunchTemplateDiskConf -> Maybe VolumeType
$sel:throughput:LaunchTemplateDiskConf' :: LaunchTemplateDiskConf -> Maybe Natural
$sel:iops:LaunchTemplateDiskConf' :: LaunchTemplateDiskConf -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
iops
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
throughput
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VolumeType
volumeType

instance Data.ToJSON LaunchTemplateDiskConf where
  toJSON :: LaunchTemplateDiskConf -> Value
toJSON LaunchTemplateDiskConf' {Maybe Natural
Maybe VolumeType
volumeType :: Maybe VolumeType
throughput :: Maybe Natural
iops :: Maybe Natural
$sel:volumeType:LaunchTemplateDiskConf' :: LaunchTemplateDiskConf -> Maybe VolumeType
$sel:throughput:LaunchTemplateDiskConf' :: LaunchTemplateDiskConf -> Maybe Natural
$sel:iops:LaunchTemplateDiskConf' :: LaunchTemplateDiskConf -> Maybe Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"iops" 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
iops,
            (Key
"throughput" 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
throughput,
            (Key
"volumeType" 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 VolumeType
volumeType
          ]
      )