{-# 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.TGWOnDeviceServiceConfiguration
-- 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.TGWOnDeviceServiceConfiguration 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 Storage Gateway service Tape Gateway type on an Amazon Web Services
-- Snow Family device.
--
-- /See:/ 'newTGWOnDeviceServiceConfiguration' smart constructor.
data TGWOnDeviceServiceConfiguration = TGWOnDeviceServiceConfiguration'
  { -- | The maximum number of virtual tapes to store on one Snow Family device.
    -- Due to physical resource limitations, this value must be set to 80 for
    -- Snowball Edge.
    TGWOnDeviceServiceConfiguration -> Maybe Natural
storageLimit :: Prelude.Maybe Prelude.Natural,
    -- | The scale unit of the virtual tapes on the device.
    TGWOnDeviceServiceConfiguration -> Maybe StorageUnit
storageUnit :: Prelude.Maybe StorageUnit
  }
  deriving (TGWOnDeviceServiceConfiguration
-> TGWOnDeviceServiceConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TGWOnDeviceServiceConfiguration
-> TGWOnDeviceServiceConfiguration -> Bool
$c/= :: TGWOnDeviceServiceConfiguration
-> TGWOnDeviceServiceConfiguration -> Bool
== :: TGWOnDeviceServiceConfiguration
-> TGWOnDeviceServiceConfiguration -> Bool
$c== :: TGWOnDeviceServiceConfiguration
-> TGWOnDeviceServiceConfiguration -> Bool
Prelude.Eq, ReadPrec [TGWOnDeviceServiceConfiguration]
ReadPrec TGWOnDeviceServiceConfiguration
Int -> ReadS TGWOnDeviceServiceConfiguration
ReadS [TGWOnDeviceServiceConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TGWOnDeviceServiceConfiguration]
$creadListPrec :: ReadPrec [TGWOnDeviceServiceConfiguration]
readPrec :: ReadPrec TGWOnDeviceServiceConfiguration
$creadPrec :: ReadPrec TGWOnDeviceServiceConfiguration
readList :: ReadS [TGWOnDeviceServiceConfiguration]
$creadList :: ReadS [TGWOnDeviceServiceConfiguration]
readsPrec :: Int -> ReadS TGWOnDeviceServiceConfiguration
$creadsPrec :: Int -> ReadS TGWOnDeviceServiceConfiguration
Prelude.Read, Int -> TGWOnDeviceServiceConfiguration -> ShowS
[TGWOnDeviceServiceConfiguration] -> ShowS
TGWOnDeviceServiceConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TGWOnDeviceServiceConfiguration] -> ShowS
$cshowList :: [TGWOnDeviceServiceConfiguration] -> ShowS
show :: TGWOnDeviceServiceConfiguration -> String
$cshow :: TGWOnDeviceServiceConfiguration -> String
showsPrec :: Int -> TGWOnDeviceServiceConfiguration -> ShowS
$cshowsPrec :: Int -> TGWOnDeviceServiceConfiguration -> ShowS
Prelude.Show, forall x.
Rep TGWOnDeviceServiceConfiguration x
-> TGWOnDeviceServiceConfiguration
forall x.
TGWOnDeviceServiceConfiguration
-> Rep TGWOnDeviceServiceConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TGWOnDeviceServiceConfiguration x
-> TGWOnDeviceServiceConfiguration
$cfrom :: forall x.
TGWOnDeviceServiceConfiguration
-> Rep TGWOnDeviceServiceConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'TGWOnDeviceServiceConfiguration' 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', 'tGWOnDeviceServiceConfiguration_storageLimit' - The maximum number of virtual tapes to store on one Snow Family device.
-- Due to physical resource limitations, this value must be set to 80 for
-- Snowball Edge.
--
-- 'storageUnit', 'tGWOnDeviceServiceConfiguration_storageUnit' - The scale unit of the virtual tapes on the device.
newTGWOnDeviceServiceConfiguration ::
  TGWOnDeviceServiceConfiguration
newTGWOnDeviceServiceConfiguration :: TGWOnDeviceServiceConfiguration
newTGWOnDeviceServiceConfiguration =
  TGWOnDeviceServiceConfiguration'
    { $sel:storageLimit:TGWOnDeviceServiceConfiguration' :: Maybe Natural
storageLimit =
        forall a. Maybe a
Prelude.Nothing,
      $sel:storageUnit:TGWOnDeviceServiceConfiguration' :: Maybe StorageUnit
storageUnit = forall a. Maybe a
Prelude.Nothing
    }

-- | The maximum number of virtual tapes to store on one Snow Family device.
-- Due to physical resource limitations, this value must be set to 80 for
-- Snowball Edge.
tGWOnDeviceServiceConfiguration_storageLimit :: Lens.Lens' TGWOnDeviceServiceConfiguration (Prelude.Maybe Prelude.Natural)
tGWOnDeviceServiceConfiguration_storageLimit :: Lens' TGWOnDeviceServiceConfiguration (Maybe Natural)
tGWOnDeviceServiceConfiguration_storageLimit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TGWOnDeviceServiceConfiguration' {Maybe Natural
storageLimit :: Maybe Natural
$sel:storageLimit:TGWOnDeviceServiceConfiguration' :: TGWOnDeviceServiceConfiguration -> Maybe Natural
storageLimit} -> Maybe Natural
storageLimit) (\s :: TGWOnDeviceServiceConfiguration
s@TGWOnDeviceServiceConfiguration' {} Maybe Natural
a -> TGWOnDeviceServiceConfiguration
s {$sel:storageLimit:TGWOnDeviceServiceConfiguration' :: Maybe Natural
storageLimit = Maybe Natural
a} :: TGWOnDeviceServiceConfiguration)

-- | The scale unit of the virtual tapes on the device.
tGWOnDeviceServiceConfiguration_storageUnit :: Lens.Lens' TGWOnDeviceServiceConfiguration (Prelude.Maybe StorageUnit)
tGWOnDeviceServiceConfiguration_storageUnit :: Lens' TGWOnDeviceServiceConfiguration (Maybe StorageUnit)
tGWOnDeviceServiceConfiguration_storageUnit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TGWOnDeviceServiceConfiguration' {Maybe StorageUnit
storageUnit :: Maybe StorageUnit
$sel:storageUnit:TGWOnDeviceServiceConfiguration' :: TGWOnDeviceServiceConfiguration -> Maybe StorageUnit
storageUnit} -> Maybe StorageUnit
storageUnit) (\s :: TGWOnDeviceServiceConfiguration
s@TGWOnDeviceServiceConfiguration' {} Maybe StorageUnit
a -> TGWOnDeviceServiceConfiguration
s {$sel:storageUnit:TGWOnDeviceServiceConfiguration' :: Maybe StorageUnit
storageUnit = Maybe StorageUnit
a} :: TGWOnDeviceServiceConfiguration)

instance
  Data.FromJSON
    TGWOnDeviceServiceConfiguration
  where
  parseJSON :: Value -> Parser TGWOnDeviceServiceConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TGWOnDeviceServiceConfiguration"
      ( \Object
x ->
          Maybe Natural
-> Maybe StorageUnit -> TGWOnDeviceServiceConfiguration
TGWOnDeviceServiceConfiguration'
            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
    TGWOnDeviceServiceConfiguration
  where
  hashWithSalt :: Int -> TGWOnDeviceServiceConfiguration -> Int
hashWithSalt
    Int
_salt
    TGWOnDeviceServiceConfiguration' {Maybe Natural
Maybe StorageUnit
storageUnit :: Maybe StorageUnit
storageLimit :: Maybe Natural
$sel:storageUnit:TGWOnDeviceServiceConfiguration' :: TGWOnDeviceServiceConfiguration -> Maybe StorageUnit
$sel:storageLimit:TGWOnDeviceServiceConfiguration' :: TGWOnDeviceServiceConfiguration -> 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
    TGWOnDeviceServiceConfiguration
  where
  rnf :: TGWOnDeviceServiceConfiguration -> ()
rnf TGWOnDeviceServiceConfiguration' {Maybe Natural
Maybe StorageUnit
storageUnit :: Maybe StorageUnit
storageLimit :: Maybe Natural
$sel:storageUnit:TGWOnDeviceServiceConfiguration' :: TGWOnDeviceServiceConfiguration -> Maybe StorageUnit
$sel:storageLimit:TGWOnDeviceServiceConfiguration' :: TGWOnDeviceServiceConfiguration -> 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 TGWOnDeviceServiceConfiguration where
  toJSON :: TGWOnDeviceServiceConfiguration -> Value
toJSON TGWOnDeviceServiceConfiguration' {Maybe Natural
Maybe StorageUnit
storageUnit :: Maybe StorageUnit
storageLimit :: Maybe Natural
$sel:storageUnit:TGWOnDeviceServiceConfiguration' :: TGWOnDeviceServiceConfiguration -> Maybe StorageUnit
$sel:storageLimit:TGWOnDeviceServiceConfiguration' :: TGWOnDeviceServiceConfiguration -> 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
          ]
      )