{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Snowball.Types.NFSOnDeviceServiceConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Snowball.Types.StorageUnit

-- | An object that represents metadata and configuration settings for NFS
-- service on an AWS Snow Family device.
--
-- /See:/ 'newNFSOnDeviceServiceConfiguration' smart constructor.
data NFSOnDeviceServiceConfiguration = NFSOnDeviceServiceConfiguration'
  { -- | The maximum NFS storage for one Snowball 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
(NFSOnDeviceServiceConfiguration
 -> NFSOnDeviceServiceConfiguration -> Bool)
-> (NFSOnDeviceServiceConfiguration
    -> NFSOnDeviceServiceConfiguration -> Bool)
-> Eq NFSOnDeviceServiceConfiguration
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]
(Int -> ReadS NFSOnDeviceServiceConfiguration)
-> ReadS [NFSOnDeviceServiceConfiguration]
-> ReadPrec NFSOnDeviceServiceConfiguration
-> ReadPrec [NFSOnDeviceServiceConfiguration]
-> Read 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
(Int -> NFSOnDeviceServiceConfiguration -> ShowS)
-> (NFSOnDeviceServiceConfiguration -> String)
-> ([NFSOnDeviceServiceConfiguration] -> ShowS)
-> Show NFSOnDeviceServiceConfiguration
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.
 NFSOnDeviceServiceConfiguration
 -> Rep NFSOnDeviceServiceConfiguration x)
-> (forall x.
    Rep NFSOnDeviceServiceConfiguration x
    -> NFSOnDeviceServiceConfiguration)
-> Generic NFSOnDeviceServiceConfiguration
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 Snowball Family device.
--
-- 'storageUnit', 'nFSOnDeviceServiceConfiguration_storageUnit' - The scale unit of the NFS storage on the device.
--
-- Valid values: TB.
newNFSOnDeviceServiceConfiguration ::
  NFSOnDeviceServiceConfiguration
newNFSOnDeviceServiceConfiguration :: NFSOnDeviceServiceConfiguration
newNFSOnDeviceServiceConfiguration =
  NFSOnDeviceServiceConfiguration' :: Maybe Natural
-> Maybe StorageUnit -> NFSOnDeviceServiceConfiguration
NFSOnDeviceServiceConfiguration'
    { $sel:storageLimit:NFSOnDeviceServiceConfiguration' :: Maybe Natural
storageLimit =
        Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:storageUnit:NFSOnDeviceServiceConfiguration' :: Maybe StorageUnit
storageUnit = Maybe StorageUnit
forall a. Maybe a
Prelude.Nothing
    }

-- | The maximum NFS storage for one Snowball Family device.
nFSOnDeviceServiceConfiguration_storageLimit :: Lens.Lens' NFSOnDeviceServiceConfiguration (Prelude.Maybe Prelude.Natural)
nFSOnDeviceServiceConfiguration_storageLimit :: (Maybe Natural -> f (Maybe Natural))
-> NFSOnDeviceServiceConfiguration
-> f NFSOnDeviceServiceConfiguration
nFSOnDeviceServiceConfiguration_storageLimit = (NFSOnDeviceServiceConfiguration -> Maybe Natural)
-> (NFSOnDeviceServiceConfiguration
    -> Maybe Natural -> NFSOnDeviceServiceConfiguration)
-> Lens
     NFSOnDeviceServiceConfiguration
     NFSOnDeviceServiceConfiguration
     (Maybe Natural)
     (Maybe Natural)
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 :: (Maybe StorageUnit -> f (Maybe StorageUnit))
-> NFSOnDeviceServiceConfiguration
-> f NFSOnDeviceServiceConfiguration
nFSOnDeviceServiceConfiguration_storageUnit = (NFSOnDeviceServiceConfiguration -> Maybe StorageUnit)
-> (NFSOnDeviceServiceConfiguration
    -> Maybe StorageUnit -> NFSOnDeviceServiceConfiguration)
-> Lens
     NFSOnDeviceServiceConfiguration
     NFSOnDeviceServiceConfiguration
     (Maybe StorageUnit)
     (Maybe 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
  Core.FromJSON
    NFSOnDeviceServiceConfiguration
  where
  parseJSON :: Value -> Parser NFSOnDeviceServiceConfiguration
parseJSON =
    String
-> (Object -> Parser NFSOnDeviceServiceConfiguration)
-> Value
-> Parser NFSOnDeviceServiceConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"NFSOnDeviceServiceConfiguration"
      ( \Object
x ->
          Maybe Natural
-> Maybe StorageUnit -> NFSOnDeviceServiceConfiguration
NFSOnDeviceServiceConfiguration'
            (Maybe Natural
 -> Maybe StorageUnit -> NFSOnDeviceServiceConfiguration)
-> Parser (Maybe Natural)
-> Parser (Maybe StorageUnit -> NFSOnDeviceServiceConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StorageLimit")
            Parser (Maybe StorageUnit -> NFSOnDeviceServiceConfiguration)
-> Parser (Maybe StorageUnit)
-> Parser NFSOnDeviceServiceConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe StorageUnit)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StorageUnit")
      )

instance
  Prelude.Hashable
    NFSOnDeviceServiceConfiguration

instance
  Prelude.NFData
    NFSOnDeviceServiceConfiguration

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"StorageLimit" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
storageLimit,
            (Text
"StorageUnit" Text -> StorageUnit -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (StorageUnit -> Pair) -> Maybe StorageUnit -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe StorageUnit
storageUnit
          ]
      )