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