{-# 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.Nimble.Types.VolumeConfiguration
-- 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.Nimble.Types.VolumeConfiguration 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

-- | Custom volume configuration for the root volumes that are attached to
-- streaming sessions.
--
-- This parameter is only allowed when @sessionPersistenceMode@ is
-- @ACTIVATED@.
--
-- /See:/ 'newVolumeConfiguration' smart constructor.
data VolumeConfiguration = VolumeConfiguration'
  { -- | The number of I\/O operations per second for the root volume that is
    -- attached to streaming session.
    VolumeConfiguration -> Maybe Natural
iops :: Prelude.Maybe Prelude.Natural,
    -- | The size of the root volume that is attached to the streaming session.
    -- The root volume size is measured in GiBs.
    VolumeConfiguration -> Maybe Natural
size :: Prelude.Maybe Prelude.Natural,
    -- | The throughput to provision for the root volume that is attached to the
    -- streaming session. The throughput is measured in MiB\/s.
    VolumeConfiguration -> Maybe Natural
throughput :: Prelude.Maybe Prelude.Natural
  }
  deriving (VolumeConfiguration -> VolumeConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VolumeConfiguration -> VolumeConfiguration -> Bool
$c/= :: VolumeConfiguration -> VolumeConfiguration -> Bool
== :: VolumeConfiguration -> VolumeConfiguration -> Bool
$c== :: VolumeConfiguration -> VolumeConfiguration -> Bool
Prelude.Eq, ReadPrec [VolumeConfiguration]
ReadPrec VolumeConfiguration
Int -> ReadS VolumeConfiguration
ReadS [VolumeConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VolumeConfiguration]
$creadListPrec :: ReadPrec [VolumeConfiguration]
readPrec :: ReadPrec VolumeConfiguration
$creadPrec :: ReadPrec VolumeConfiguration
readList :: ReadS [VolumeConfiguration]
$creadList :: ReadS [VolumeConfiguration]
readsPrec :: Int -> ReadS VolumeConfiguration
$creadsPrec :: Int -> ReadS VolumeConfiguration
Prelude.Read, Int -> VolumeConfiguration -> ShowS
[VolumeConfiguration] -> ShowS
VolumeConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VolumeConfiguration] -> ShowS
$cshowList :: [VolumeConfiguration] -> ShowS
show :: VolumeConfiguration -> String
$cshow :: VolumeConfiguration -> String
showsPrec :: Int -> VolumeConfiguration -> ShowS
$cshowsPrec :: Int -> VolumeConfiguration -> ShowS
Prelude.Show, forall x. Rep VolumeConfiguration x -> VolumeConfiguration
forall x. VolumeConfiguration -> Rep VolumeConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VolumeConfiguration x -> VolumeConfiguration
$cfrom :: forall x. VolumeConfiguration -> Rep VolumeConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'VolumeConfiguration' 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', 'volumeConfiguration_iops' - The number of I\/O operations per second for the root volume that is
-- attached to streaming session.
--
-- 'size', 'volumeConfiguration_size' - The size of the root volume that is attached to the streaming session.
-- The root volume size is measured in GiBs.
--
-- 'throughput', 'volumeConfiguration_throughput' - The throughput to provision for the root volume that is attached to the
-- streaming session. The throughput is measured in MiB\/s.
newVolumeConfiguration ::
  VolumeConfiguration
newVolumeConfiguration :: VolumeConfiguration
newVolumeConfiguration =
  VolumeConfiguration'
    { $sel:iops:VolumeConfiguration' :: Maybe Natural
iops = forall a. Maybe a
Prelude.Nothing,
      $sel:size:VolumeConfiguration' :: Maybe Natural
size = forall a. Maybe a
Prelude.Nothing,
      $sel:throughput:VolumeConfiguration' :: Maybe Natural
throughput = forall a. Maybe a
Prelude.Nothing
    }

-- | The number of I\/O operations per second for the root volume that is
-- attached to streaming session.
volumeConfiguration_iops :: Lens.Lens' VolumeConfiguration (Prelude.Maybe Prelude.Natural)
volumeConfiguration_iops :: Lens' VolumeConfiguration (Maybe Natural)
volumeConfiguration_iops = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VolumeConfiguration' {Maybe Natural
iops :: Maybe Natural
$sel:iops:VolumeConfiguration' :: VolumeConfiguration -> Maybe Natural
iops} -> Maybe Natural
iops) (\s :: VolumeConfiguration
s@VolumeConfiguration' {} Maybe Natural
a -> VolumeConfiguration
s {$sel:iops:VolumeConfiguration' :: Maybe Natural
iops = Maybe Natural
a} :: VolumeConfiguration)

-- | The size of the root volume that is attached to the streaming session.
-- The root volume size is measured in GiBs.
volumeConfiguration_size :: Lens.Lens' VolumeConfiguration (Prelude.Maybe Prelude.Natural)
volumeConfiguration_size :: Lens' VolumeConfiguration (Maybe Natural)
volumeConfiguration_size = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VolumeConfiguration' {Maybe Natural
size :: Maybe Natural
$sel:size:VolumeConfiguration' :: VolumeConfiguration -> Maybe Natural
size} -> Maybe Natural
size) (\s :: VolumeConfiguration
s@VolumeConfiguration' {} Maybe Natural
a -> VolumeConfiguration
s {$sel:size:VolumeConfiguration' :: Maybe Natural
size = Maybe Natural
a} :: VolumeConfiguration)

-- | The throughput to provision for the root volume that is attached to the
-- streaming session. The throughput is measured in MiB\/s.
volumeConfiguration_throughput :: Lens.Lens' VolumeConfiguration (Prelude.Maybe Prelude.Natural)
volumeConfiguration_throughput :: Lens' VolumeConfiguration (Maybe Natural)
volumeConfiguration_throughput = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VolumeConfiguration' {Maybe Natural
throughput :: Maybe Natural
$sel:throughput:VolumeConfiguration' :: VolumeConfiguration -> Maybe Natural
throughput} -> Maybe Natural
throughput) (\s :: VolumeConfiguration
s@VolumeConfiguration' {} Maybe Natural
a -> VolumeConfiguration
s {$sel:throughput:VolumeConfiguration' :: Maybe Natural
throughput = Maybe Natural
a} :: VolumeConfiguration)

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

instance Prelude.Hashable VolumeConfiguration where
  hashWithSalt :: Int -> VolumeConfiguration -> Int
hashWithSalt Int
_salt VolumeConfiguration' {Maybe Natural
throughput :: Maybe Natural
size :: Maybe Natural
iops :: Maybe Natural
$sel:throughput:VolumeConfiguration' :: VolumeConfiguration -> Maybe Natural
$sel:size:VolumeConfiguration' :: VolumeConfiguration -> Maybe Natural
$sel:iops:VolumeConfiguration' :: VolumeConfiguration -> 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
size
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
throughput

instance Prelude.NFData VolumeConfiguration where
  rnf :: VolumeConfiguration -> ()
rnf VolumeConfiguration' {Maybe Natural
throughput :: Maybe Natural
size :: Maybe Natural
iops :: Maybe Natural
$sel:throughput:VolumeConfiguration' :: VolumeConfiguration -> Maybe Natural
$sel:size:VolumeConfiguration' :: VolumeConfiguration -> Maybe Natural
$sel:iops:VolumeConfiguration' :: VolumeConfiguration -> 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
size
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
throughput

instance Data.ToJSON VolumeConfiguration where
  toJSON :: VolumeConfiguration -> Value
toJSON VolumeConfiguration' {Maybe Natural
throughput :: Maybe Natural
size :: Maybe Natural
iops :: Maybe Natural
$sel:throughput:VolumeConfiguration' :: VolumeConfiguration -> Maybe Natural
$sel:size:VolumeConfiguration' :: VolumeConfiguration -> Maybe Natural
$sel:iops:VolumeConfiguration' :: VolumeConfiguration -> 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
"size" 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
size,
            (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
          ]
      )