{-# 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.IoTAnalytics.Types.VersioningConfiguration where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data VersioningConfiguration = VersioningConfiguration'
{
VersioningConfiguration -> Maybe Bool
unlimited :: Prelude.Maybe Prelude.Bool,
VersioningConfiguration -> Maybe Natural
maxVersions :: Prelude.Maybe Prelude.Natural
}
deriving (VersioningConfiguration -> VersioningConfiguration -> Bool
(VersioningConfiguration -> VersioningConfiguration -> Bool)
-> (VersioningConfiguration -> VersioningConfiguration -> Bool)
-> Eq VersioningConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VersioningConfiguration -> VersioningConfiguration -> Bool
$c/= :: VersioningConfiguration -> VersioningConfiguration -> Bool
== :: VersioningConfiguration -> VersioningConfiguration -> Bool
$c== :: VersioningConfiguration -> VersioningConfiguration -> Bool
Prelude.Eq, ReadPrec [VersioningConfiguration]
ReadPrec VersioningConfiguration
Int -> ReadS VersioningConfiguration
ReadS [VersioningConfiguration]
(Int -> ReadS VersioningConfiguration)
-> ReadS [VersioningConfiguration]
-> ReadPrec VersioningConfiguration
-> ReadPrec [VersioningConfiguration]
-> Read VersioningConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VersioningConfiguration]
$creadListPrec :: ReadPrec [VersioningConfiguration]
readPrec :: ReadPrec VersioningConfiguration
$creadPrec :: ReadPrec VersioningConfiguration
readList :: ReadS [VersioningConfiguration]
$creadList :: ReadS [VersioningConfiguration]
readsPrec :: Int -> ReadS VersioningConfiguration
$creadsPrec :: Int -> ReadS VersioningConfiguration
Prelude.Read, Int -> VersioningConfiguration -> ShowS
[VersioningConfiguration] -> ShowS
VersioningConfiguration -> String
(Int -> VersioningConfiguration -> ShowS)
-> (VersioningConfiguration -> String)
-> ([VersioningConfiguration] -> ShowS)
-> Show VersioningConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VersioningConfiguration] -> ShowS
$cshowList :: [VersioningConfiguration] -> ShowS
show :: VersioningConfiguration -> String
$cshow :: VersioningConfiguration -> String
showsPrec :: Int -> VersioningConfiguration -> ShowS
$cshowsPrec :: Int -> VersioningConfiguration -> ShowS
Prelude.Show, (forall x.
VersioningConfiguration -> Rep VersioningConfiguration x)
-> (forall x.
Rep VersioningConfiguration x -> VersioningConfiguration)
-> Generic VersioningConfiguration
forall x. Rep VersioningConfiguration x -> VersioningConfiguration
forall x. VersioningConfiguration -> Rep VersioningConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VersioningConfiguration x -> VersioningConfiguration
$cfrom :: forall x. VersioningConfiguration -> Rep VersioningConfiguration x
Prelude.Generic)
newVersioningConfiguration ::
VersioningConfiguration
newVersioningConfiguration :: VersioningConfiguration
newVersioningConfiguration =
VersioningConfiguration' :: Maybe Bool -> Maybe Natural -> VersioningConfiguration
VersioningConfiguration'
{ $sel:unlimited:VersioningConfiguration' :: Maybe Bool
unlimited =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:maxVersions:VersioningConfiguration' :: Maybe Natural
maxVersions = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
versioningConfiguration_unlimited :: Lens.Lens' VersioningConfiguration (Prelude.Maybe Prelude.Bool)
versioningConfiguration_unlimited :: (Maybe Bool -> f (Maybe Bool))
-> VersioningConfiguration -> f VersioningConfiguration
versioningConfiguration_unlimited = (VersioningConfiguration -> Maybe Bool)
-> (VersioningConfiguration
-> Maybe Bool -> VersioningConfiguration)
-> Lens
VersioningConfiguration
VersioningConfiguration
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VersioningConfiguration' {Maybe Bool
unlimited :: Maybe Bool
$sel:unlimited:VersioningConfiguration' :: VersioningConfiguration -> Maybe Bool
unlimited} -> Maybe Bool
unlimited) (\s :: VersioningConfiguration
s@VersioningConfiguration' {} Maybe Bool
a -> VersioningConfiguration
s {$sel:unlimited:VersioningConfiguration' :: Maybe Bool
unlimited = Maybe Bool
a} :: VersioningConfiguration)
versioningConfiguration_maxVersions :: Lens.Lens' VersioningConfiguration (Prelude.Maybe Prelude.Natural)
versioningConfiguration_maxVersions :: (Maybe Natural -> f (Maybe Natural))
-> VersioningConfiguration -> f VersioningConfiguration
versioningConfiguration_maxVersions = (VersioningConfiguration -> Maybe Natural)
-> (VersioningConfiguration
-> Maybe Natural -> VersioningConfiguration)
-> Lens
VersioningConfiguration
VersioningConfiguration
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VersioningConfiguration' {Maybe Natural
maxVersions :: Maybe Natural
$sel:maxVersions:VersioningConfiguration' :: VersioningConfiguration -> Maybe Natural
maxVersions} -> Maybe Natural
maxVersions) (\s :: VersioningConfiguration
s@VersioningConfiguration' {} Maybe Natural
a -> VersioningConfiguration
s {$sel:maxVersions:VersioningConfiguration' :: Maybe Natural
maxVersions = Maybe Natural
a} :: VersioningConfiguration)
instance Core.FromJSON VersioningConfiguration where
parseJSON :: Value -> Parser VersioningConfiguration
parseJSON =
String
-> (Object -> Parser VersioningConfiguration)
-> Value
-> Parser VersioningConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"VersioningConfiguration"
( \Object
x ->
Maybe Bool -> Maybe Natural -> VersioningConfiguration
VersioningConfiguration'
(Maybe Bool -> Maybe Natural -> VersioningConfiguration)
-> Parser (Maybe Bool)
-> Parser (Maybe Natural -> VersioningConfiguration)
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
"unlimited")
Parser (Maybe Natural -> VersioningConfiguration)
-> Parser (Maybe Natural) -> Parser VersioningConfiguration
forall (f :: * -> *) a b. Applicative f => 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
"maxVersions")
)
instance Prelude.Hashable VersioningConfiguration
instance Prelude.NFData VersioningConfiguration
instance Core.ToJSON VersioningConfiguration where
toJSON :: VersioningConfiguration -> Value
toJSON VersioningConfiguration' {Maybe Bool
Maybe Natural
maxVersions :: Maybe Natural
unlimited :: Maybe Bool
$sel:maxVersions:VersioningConfiguration' :: VersioningConfiguration -> Maybe Natural
$sel:unlimited:VersioningConfiguration' :: VersioningConfiguration -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"unlimited" 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
unlimited,
(Text
"maxVersions" 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
maxVersions
]
)