{-# 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 #-}
module Amazonka.StorageGateway.Types.AutomaticTapeCreationRule where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data AutomaticTapeCreationRule = AutomaticTapeCreationRule'
{
AutomaticTapeCreationRule -> Maybe Bool
worm :: Prelude.Maybe Prelude.Bool,
AutomaticTapeCreationRule -> Text
tapeBarcodePrefix :: Prelude.Text,
AutomaticTapeCreationRule -> Text
poolId :: Prelude.Text,
AutomaticTapeCreationRule -> Integer
tapeSizeInBytes :: Prelude.Integer,
AutomaticTapeCreationRule -> Natural
minimumNumTapes :: Prelude.Natural
}
deriving (AutomaticTapeCreationRule -> AutomaticTapeCreationRule -> Bool
(AutomaticTapeCreationRule -> AutomaticTapeCreationRule -> Bool)
-> (AutomaticTapeCreationRule -> AutomaticTapeCreationRule -> Bool)
-> Eq AutomaticTapeCreationRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AutomaticTapeCreationRule -> AutomaticTapeCreationRule -> Bool
$c/= :: AutomaticTapeCreationRule -> AutomaticTapeCreationRule -> Bool
== :: AutomaticTapeCreationRule -> AutomaticTapeCreationRule -> Bool
$c== :: AutomaticTapeCreationRule -> AutomaticTapeCreationRule -> Bool
Prelude.Eq, ReadPrec [AutomaticTapeCreationRule]
ReadPrec AutomaticTapeCreationRule
Int -> ReadS AutomaticTapeCreationRule
ReadS [AutomaticTapeCreationRule]
(Int -> ReadS AutomaticTapeCreationRule)
-> ReadS [AutomaticTapeCreationRule]
-> ReadPrec AutomaticTapeCreationRule
-> ReadPrec [AutomaticTapeCreationRule]
-> Read AutomaticTapeCreationRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AutomaticTapeCreationRule]
$creadListPrec :: ReadPrec [AutomaticTapeCreationRule]
readPrec :: ReadPrec AutomaticTapeCreationRule
$creadPrec :: ReadPrec AutomaticTapeCreationRule
readList :: ReadS [AutomaticTapeCreationRule]
$creadList :: ReadS [AutomaticTapeCreationRule]
readsPrec :: Int -> ReadS AutomaticTapeCreationRule
$creadsPrec :: Int -> ReadS AutomaticTapeCreationRule
Prelude.Read, Int -> AutomaticTapeCreationRule -> ShowS
[AutomaticTapeCreationRule] -> ShowS
AutomaticTapeCreationRule -> String
(Int -> AutomaticTapeCreationRule -> ShowS)
-> (AutomaticTapeCreationRule -> String)
-> ([AutomaticTapeCreationRule] -> ShowS)
-> Show AutomaticTapeCreationRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AutomaticTapeCreationRule] -> ShowS
$cshowList :: [AutomaticTapeCreationRule] -> ShowS
show :: AutomaticTapeCreationRule -> String
$cshow :: AutomaticTapeCreationRule -> String
showsPrec :: Int -> AutomaticTapeCreationRule -> ShowS
$cshowsPrec :: Int -> AutomaticTapeCreationRule -> ShowS
Prelude.Show, (forall x.
AutomaticTapeCreationRule -> Rep AutomaticTapeCreationRule x)
-> (forall x.
Rep AutomaticTapeCreationRule x -> AutomaticTapeCreationRule)
-> Generic AutomaticTapeCreationRule
forall x.
Rep AutomaticTapeCreationRule x -> AutomaticTapeCreationRule
forall x.
AutomaticTapeCreationRule -> Rep AutomaticTapeCreationRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AutomaticTapeCreationRule x -> AutomaticTapeCreationRule
$cfrom :: forall x.
AutomaticTapeCreationRule -> Rep AutomaticTapeCreationRule x
Prelude.Generic)
newAutomaticTapeCreationRule ::
Prelude.Text ->
Prelude.Text ->
Prelude.Integer ->
Prelude.Natural ->
AutomaticTapeCreationRule
newAutomaticTapeCreationRule :: Text -> Text -> Integer -> Natural -> AutomaticTapeCreationRule
newAutomaticTapeCreationRule
Text
pTapeBarcodePrefix_
Text
pPoolId_
Integer
pTapeSizeInBytes_
Natural
pMinimumNumTapes_ =
AutomaticTapeCreationRule' :: Maybe Bool
-> Text -> Text -> Integer -> Natural -> AutomaticTapeCreationRule
AutomaticTapeCreationRule'
{ $sel:worm:AutomaticTapeCreationRule' :: Maybe Bool
worm = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:tapeBarcodePrefix:AutomaticTapeCreationRule' :: Text
tapeBarcodePrefix = Text
pTapeBarcodePrefix_,
$sel:poolId:AutomaticTapeCreationRule' :: Text
poolId = Text
pPoolId_,
$sel:tapeSizeInBytes:AutomaticTapeCreationRule' :: Integer
tapeSizeInBytes = Integer
pTapeSizeInBytes_,
$sel:minimumNumTapes:AutomaticTapeCreationRule' :: Natural
minimumNumTapes = Natural
pMinimumNumTapes_
}
automaticTapeCreationRule_worm :: Lens.Lens' AutomaticTapeCreationRule (Prelude.Maybe Prelude.Bool)
automaticTapeCreationRule_worm :: (Maybe Bool -> f (Maybe Bool))
-> AutomaticTapeCreationRule -> f AutomaticTapeCreationRule
automaticTapeCreationRule_worm = (AutomaticTapeCreationRule -> Maybe Bool)
-> (AutomaticTapeCreationRule
-> Maybe Bool -> AutomaticTapeCreationRule)
-> Lens
AutomaticTapeCreationRule
AutomaticTapeCreationRule
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutomaticTapeCreationRule' {Maybe Bool
worm :: Maybe Bool
$sel:worm:AutomaticTapeCreationRule' :: AutomaticTapeCreationRule -> Maybe Bool
worm} -> Maybe Bool
worm) (\s :: AutomaticTapeCreationRule
s@AutomaticTapeCreationRule' {} Maybe Bool
a -> AutomaticTapeCreationRule
s {$sel:worm:AutomaticTapeCreationRule' :: Maybe Bool
worm = Maybe Bool
a} :: AutomaticTapeCreationRule)
automaticTapeCreationRule_tapeBarcodePrefix :: Lens.Lens' AutomaticTapeCreationRule Prelude.Text
automaticTapeCreationRule_tapeBarcodePrefix :: (Text -> f Text)
-> AutomaticTapeCreationRule -> f AutomaticTapeCreationRule
automaticTapeCreationRule_tapeBarcodePrefix = (AutomaticTapeCreationRule -> Text)
-> (AutomaticTapeCreationRule -> Text -> AutomaticTapeCreationRule)
-> Lens
AutomaticTapeCreationRule AutomaticTapeCreationRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutomaticTapeCreationRule' {Text
tapeBarcodePrefix :: Text
$sel:tapeBarcodePrefix:AutomaticTapeCreationRule' :: AutomaticTapeCreationRule -> Text
tapeBarcodePrefix} -> Text
tapeBarcodePrefix) (\s :: AutomaticTapeCreationRule
s@AutomaticTapeCreationRule' {} Text
a -> AutomaticTapeCreationRule
s {$sel:tapeBarcodePrefix:AutomaticTapeCreationRule' :: Text
tapeBarcodePrefix = Text
a} :: AutomaticTapeCreationRule)
automaticTapeCreationRule_poolId :: Lens.Lens' AutomaticTapeCreationRule Prelude.Text
automaticTapeCreationRule_poolId :: (Text -> f Text)
-> AutomaticTapeCreationRule -> f AutomaticTapeCreationRule
automaticTapeCreationRule_poolId = (AutomaticTapeCreationRule -> Text)
-> (AutomaticTapeCreationRule -> Text -> AutomaticTapeCreationRule)
-> Lens
AutomaticTapeCreationRule AutomaticTapeCreationRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutomaticTapeCreationRule' {Text
poolId :: Text
$sel:poolId:AutomaticTapeCreationRule' :: AutomaticTapeCreationRule -> Text
poolId} -> Text
poolId) (\s :: AutomaticTapeCreationRule
s@AutomaticTapeCreationRule' {} Text
a -> AutomaticTapeCreationRule
s {$sel:poolId:AutomaticTapeCreationRule' :: Text
poolId = Text
a} :: AutomaticTapeCreationRule)
automaticTapeCreationRule_tapeSizeInBytes :: Lens.Lens' AutomaticTapeCreationRule Prelude.Integer
automaticTapeCreationRule_tapeSizeInBytes :: (Integer -> f Integer)
-> AutomaticTapeCreationRule -> f AutomaticTapeCreationRule
automaticTapeCreationRule_tapeSizeInBytes = (AutomaticTapeCreationRule -> Integer)
-> (AutomaticTapeCreationRule
-> Integer -> AutomaticTapeCreationRule)
-> Lens
AutomaticTapeCreationRule AutomaticTapeCreationRule Integer Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutomaticTapeCreationRule' {Integer
tapeSizeInBytes :: Integer
$sel:tapeSizeInBytes:AutomaticTapeCreationRule' :: AutomaticTapeCreationRule -> Integer
tapeSizeInBytes} -> Integer
tapeSizeInBytes) (\s :: AutomaticTapeCreationRule
s@AutomaticTapeCreationRule' {} Integer
a -> AutomaticTapeCreationRule
s {$sel:tapeSizeInBytes:AutomaticTapeCreationRule' :: Integer
tapeSizeInBytes = Integer
a} :: AutomaticTapeCreationRule)
automaticTapeCreationRule_minimumNumTapes :: Lens.Lens' AutomaticTapeCreationRule Prelude.Natural
automaticTapeCreationRule_minimumNumTapes :: (Natural -> f Natural)
-> AutomaticTapeCreationRule -> f AutomaticTapeCreationRule
automaticTapeCreationRule_minimumNumTapes = (AutomaticTapeCreationRule -> Natural)
-> (AutomaticTapeCreationRule
-> Natural -> AutomaticTapeCreationRule)
-> Lens
AutomaticTapeCreationRule AutomaticTapeCreationRule Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutomaticTapeCreationRule' {Natural
minimumNumTapes :: Natural
$sel:minimumNumTapes:AutomaticTapeCreationRule' :: AutomaticTapeCreationRule -> Natural
minimumNumTapes} -> Natural
minimumNumTapes) (\s :: AutomaticTapeCreationRule
s@AutomaticTapeCreationRule' {} Natural
a -> AutomaticTapeCreationRule
s {$sel:minimumNumTapes:AutomaticTapeCreationRule' :: Natural
minimumNumTapes = Natural
a} :: AutomaticTapeCreationRule)
instance Core.FromJSON AutomaticTapeCreationRule where
parseJSON :: Value -> Parser AutomaticTapeCreationRule
parseJSON =
String
-> (Object -> Parser AutomaticTapeCreationRule)
-> Value
-> Parser AutomaticTapeCreationRule
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AutomaticTapeCreationRule"
( \Object
x ->
Maybe Bool
-> Text -> Text -> Integer -> Natural -> AutomaticTapeCreationRule
AutomaticTapeCreationRule'
(Maybe Bool
-> Text -> Text -> Integer -> Natural -> AutomaticTapeCreationRule)
-> Parser (Maybe Bool)
-> Parser
(Text -> Text -> Integer -> Natural -> AutomaticTapeCreationRule)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Worm")
Parser
(Text -> Text -> Integer -> Natural -> AutomaticTapeCreationRule)
-> Parser Text
-> Parser (Text -> Integer -> Natural -> AutomaticTapeCreationRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"TapeBarcodePrefix")
Parser (Text -> Integer -> Natural -> AutomaticTapeCreationRule)
-> Parser Text
-> Parser (Integer -> Natural -> AutomaticTapeCreationRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"PoolId")
Parser (Integer -> Natural -> AutomaticTapeCreationRule)
-> Parser Integer -> Parser (Natural -> AutomaticTapeCreationRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Integer
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"TapeSizeInBytes")
Parser (Natural -> AutomaticTapeCreationRule)
-> Parser Natural -> Parser AutomaticTapeCreationRule
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"MinimumNumTapes")
)
instance Prelude.Hashable AutomaticTapeCreationRule
instance Prelude.NFData AutomaticTapeCreationRule
instance Core.ToJSON AutomaticTapeCreationRule where
toJSON :: AutomaticTapeCreationRule -> Value
toJSON AutomaticTapeCreationRule' {Integer
Natural
Maybe Bool
Text
minimumNumTapes :: Natural
tapeSizeInBytes :: Integer
poolId :: Text
tapeBarcodePrefix :: Text
worm :: Maybe Bool
$sel:minimumNumTapes:AutomaticTapeCreationRule' :: AutomaticTapeCreationRule -> Natural
$sel:tapeSizeInBytes:AutomaticTapeCreationRule' :: AutomaticTapeCreationRule -> Integer
$sel:poolId:AutomaticTapeCreationRule' :: AutomaticTapeCreationRule -> Text
$sel:tapeBarcodePrefix:AutomaticTapeCreationRule' :: AutomaticTapeCreationRule -> Text
$sel:worm:AutomaticTapeCreationRule' :: AutomaticTapeCreationRule -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Worm" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
worm,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"TapeBarcodePrefix" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
tapeBarcodePrefix),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"PoolId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
poolId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"TapeSizeInBytes" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Integer
tapeSizeInBytes),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"MinimumNumTapes" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
minimumNumTapes)
]
)