{-# 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.Snowball.Types.NFSOnDeviceServiceConfiguration
-- 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.Snowball.Types.NFSOnDeviceServiceConfiguration 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
import Amazonka.Snowball.Types.StorageUnit

-- | An object that represents the metadata and configuration settings for
-- the NFS (Network File System) service on an Amazon Web Services Snow
-- Family device.
--
-- /See:/ 'newNFSOnDeviceServiceConfiguration' smart constructor.
data NFSOnDeviceServiceConfiguration = NFSOnDeviceServiceConfiguration'
  { -- | The maximum NFS storage for one Snow Family device.
    NFSOnDeviceServiceConfiguration -> Maybe Natural
storageLimit :: Prelude.Maybe Prelude.Natural,
    -- | The scale unit of the NFS storage on the device.
    --
    -- Valid values: TB.
    NFSOnDeviceServiceConfiguration -> Maybe StorageUnit
storageUnit :: Prelude.Maybe StorageUnit
  }
  deriving (NFSOnDeviceServiceConfiguration
-> NFSOnDeviceServiceConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NFSOnDeviceServiceConfiguration
-> NFSOnDeviceServiceConfiguration -> Bool
$c/= :: NFSOnDeviceServiceConfiguration
-> NFSOnDeviceServiceConfiguration -> Bool
== :: NFSOnDeviceServiceConfiguration
-> NFSOnDeviceServiceConfiguration -> Bool
$c== :: NFSOnDeviceServiceConfiguration
-> NFSOnDeviceServiceConfiguration -> Bool
Prelude.Eq, ReadPrec [NFSOnDeviceServiceConfiguration]
ReadPrec NFSOnDeviceServiceConfiguration
Int -> ReadS NFSOnDeviceServiceConfiguration
ReadS [NFSOnDeviceServiceConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NFSOnDeviceServiceConfiguration]
$creadListPrec :: ReadPrec [NFSOnDeviceServiceConfiguration]
readPrec :: ReadPrec NFSOnDeviceServiceConfiguration
$creadPrec :: ReadPrec NFSOnDeviceServiceConfiguration
readList :: ReadS [NFSOnDeviceServiceConfiguration]
$creadList :: ReadS [NFSOnDeviceServiceConfiguration]
readsPrec :: Int -> ReadS NFSOnDeviceServiceConfiguration
$creadsPrec :: Int -> ReadS NFSOnDeviceServiceConfiguration
Prelude.Read, Int -> NFSOnDeviceServiceConfiguration -> ShowS
[NFSOnDeviceServiceConfiguration] -> ShowS
NFSOnDeviceServiceConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NFSOnDeviceServiceConfiguration] -> ShowS
$cshowList :: [NFSOnDeviceServiceConfiguration] -> ShowS
show :: NFSOnDeviceServiceConfiguration -> String
$cshow :: NFSOnDeviceServiceConfiguration -> String
showsPrec :: Int -> NFSOnDeviceServiceConfiguration -> ShowS
$cshowsPrec :: Int -> NFSOnDeviceServiceConfiguration -> ShowS
Prelude.Show, forall x.
Rep NFSOnDeviceServiceConfiguration x
-> NFSOnDeviceServiceConfiguration
forall x.
NFSOnDeviceServiceConfiguration
-> Rep NFSOnDeviceServiceConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep NFSOnDeviceServiceConfiguration x
-> NFSOnDeviceServiceConfiguration
$cfrom :: forall x.
NFSOnDeviceServiceConfiguration
-> Rep NFSOnDeviceServiceConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'NFSOnDeviceServiceConfiguration' 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:
--
-- 'storageLimit', 'nFSOnDeviceServiceConfiguration_storageLimit' - The maximum NFS storage for one Snow Family device.
--
-- 'storageUnit', 'nFSOnDeviceServiceConfiguration_storageUnit' - The scale unit of the NFS storage on the device.
--
-- Valid values: TB.
newNFSOnDeviceServiceConfiguration ::
  NFSOnDeviceServiceConfiguration
newNFSOnDeviceServiceConfiguration :: NFSOnDeviceServiceConfiguration
newNFSOnDeviceServiceConfiguration =
  NFSOnDeviceServiceConfiguration'
    { $sel:storageLimit:NFSOnDeviceServiceConfiguration' :: Maybe Natural
storageLimit =
        forall a. Maybe a
Prelude.Nothing,
      $sel:storageUnit:NFSOnDeviceServiceConfiguration' :: Maybe StorageUnit
storageUnit = forall a. Maybe a
Prelude.Nothing
    }

-- | The maximum NFS storage for one Snow Family device.
nFSOnDeviceServiceConfiguration_storageLimit :: Lens.Lens' NFSOnDeviceServiceConfiguration (Prelude.Maybe Prelude.Natural)
nFSOnDeviceServiceConfiguration_storageLimit :: Lens' NFSOnDeviceServiceConfiguration (Maybe Natural)
nFSOnDeviceServiceConfiguration_storageLimit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NFSOnDeviceServiceConfiguration' {Maybe Natural
storageLimit :: Maybe Natural
$sel:storageLimit:NFSOnDeviceServiceConfiguration' :: NFSOnDeviceServiceConfiguration -> Maybe Natural
storageLimit} -> Maybe Natural
storageLimit) (\s :: NFSOnDeviceServiceConfiguration
s@NFSOnDeviceServiceConfiguration' {} Maybe Natural
a -> NFSOnDeviceServiceConfiguration
s {$sel:storageLimit:NFSOnDeviceServiceConfiguration' :: Maybe Natural
storageLimit = Maybe Natural
a} :: NFSOnDeviceServiceConfiguration)

-- | The scale unit of the NFS storage on the device.
--
-- Valid values: TB.
nFSOnDeviceServiceConfiguration_storageUnit :: Lens.Lens' NFSOnDeviceServiceConfiguration (Prelude.Maybe StorageUnit)
nFSOnDeviceServiceConfiguration_storageUnit :: Lens' NFSOnDeviceServiceConfiguration (Maybe StorageUnit)
nFSOnDeviceServiceConfiguration_storageUnit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NFSOnDeviceServiceConfiguration' {Maybe StorageUnit
storageUnit :: Maybe StorageUnit
$sel:storageUnit:NFSOnDeviceServiceConfiguration' :: NFSOnDeviceServiceConfiguration -> Maybe StorageUnit
storageUnit} -> Maybe StorageUnit
storageUnit) (\s :: NFSOnDeviceServiceConfiguration
s@NFSOnDeviceServiceConfiguration' {} Maybe StorageUnit
a -> NFSOnDeviceServiceConfiguration
s {$sel:storageUnit:NFSOnDeviceServiceConfiguration' :: Maybe StorageUnit
storageUnit = Maybe StorageUnit
a} :: NFSOnDeviceServiceConfiguration)

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

instance
  Prelude.Hashable
    NFSOnDeviceServiceConfiguration
  where
  hashWithSalt :: Int -> NFSOnDeviceServiceConfiguration -> Int
hashWithSalt
    Int
_salt
    NFSOnDeviceServiceConfiguration' {Maybe Natural
Maybe StorageUnit
storageUnit :: Maybe StorageUnit
storageLimit :: Maybe Natural
$sel:storageUnit:NFSOnDeviceServiceConfiguration' :: NFSOnDeviceServiceConfiguration -> Maybe StorageUnit
$sel:storageLimit:NFSOnDeviceServiceConfiguration' :: NFSOnDeviceServiceConfiguration -> Maybe Natural
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
storageLimit
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe StorageUnit
storageUnit

instance
  Prelude.NFData
    NFSOnDeviceServiceConfiguration
  where
  rnf :: NFSOnDeviceServiceConfiguration -> ()
rnf NFSOnDeviceServiceConfiguration' {Maybe Natural
Maybe StorageUnit
storageUnit :: Maybe StorageUnit
storageLimit :: Maybe Natural
$sel:storageUnit:NFSOnDeviceServiceConfiguration' :: NFSOnDeviceServiceConfiguration -> Maybe StorageUnit
$sel:storageLimit:NFSOnDeviceServiceConfiguration' :: NFSOnDeviceServiceConfiguration -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
storageLimit
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe StorageUnit
storageUnit

instance Data.ToJSON NFSOnDeviceServiceConfiguration where
  toJSON :: NFSOnDeviceServiceConfiguration -> Value
toJSON NFSOnDeviceServiceConfiguration' {Maybe Natural
Maybe StorageUnit
storageUnit :: Maybe StorageUnit
storageLimit :: Maybe Natural
$sel:storageUnit:NFSOnDeviceServiceConfiguration' :: NFSOnDeviceServiceConfiguration -> Maybe StorageUnit
$sel:storageLimit:NFSOnDeviceServiceConfiguration' :: NFSOnDeviceServiceConfiguration -> Maybe Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"StorageLimit" 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
storageLimit,
            (Key
"StorageUnit" 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 StorageUnit
storageUnit
          ]
      )