{-# 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.SecurityHub.Types.AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
-- 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.SecurityHub.Types.AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Configuration options for zone awareness.
--
-- /See:/ 'newAwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails' smart constructor.
data AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails = AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails'
  { -- | The number of Availability Zones that the domain uses. Valid values are
    -- 2 and 3. The default is 2.
    AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
-> Maybe Int
availabilityZoneCount :: Prelude.Maybe Prelude.Int
  }
  deriving (AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
-> AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
-> Bool
(AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
 -> AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
 -> Bool)
-> (AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
    -> AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
    -> Bool)
-> Eq
     AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
-> AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
-> Bool
$c/= :: AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
-> AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
-> Bool
== :: AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
-> AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
-> Bool
$c== :: AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
-> AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
-> Bool
Prelude.Eq, ReadPrec
  [AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails]
ReadPrec
  AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
Int
-> ReadS
     AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
ReadS
  [AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails]
(Int
 -> ReadS
      AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails)
-> ReadS
     [AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails]
-> ReadPrec
     AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
-> ReadPrec
     [AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails]
-> Read
     AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec
  [AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails]
$creadListPrec :: ReadPrec
  [AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails]
readPrec :: ReadPrec
  AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
$creadPrec :: ReadPrec
  AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
readList :: ReadS
  [AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails]
$creadList :: ReadS
  [AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails]
readsPrec :: Int
-> ReadS
     AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
$creadsPrec :: Int
-> ReadS
     AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
Prelude.Read, Int
-> AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
-> ShowS
[AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails]
-> ShowS
AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
-> String
(Int
 -> AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
 -> ShowS)
-> (AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
    -> String)
-> ([AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails]
    -> ShowS)
-> Show
     AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails]
-> ShowS
$cshowList :: [AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails]
-> ShowS
show :: AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
-> String
$cshow :: AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
-> String
showsPrec :: Int
-> AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
-> ShowS
$cshowsPrec :: Int
-> AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
-> ShowS
Prelude.Show, (forall x.
 AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
 -> Rep
      AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
      x)
-> (forall x.
    Rep
      AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails x
    -> AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails)
-> Generic
     AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
forall x.
Rep
  AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails x
-> AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
forall x.
AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
-> Rep
     AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep
  AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails x
-> AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
$cfrom :: forall x.
AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
-> Rep
     AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails x
Prelude.Generic)

-- |
-- Create a value of 'AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails' 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:
--
-- 'availabilityZoneCount', 'awsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails_availabilityZoneCount' - The number of Availability Zones that the domain uses. Valid values are
-- 2 and 3. The default is 2.
newAwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails ::
  AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
newAwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails :: AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
newAwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails =
  AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails' :: Maybe Int
-> AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails'
    { $sel:availabilityZoneCount:AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails' :: Maybe Int
availabilityZoneCount =
        Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The number of Availability Zones that the domain uses. Valid values are
-- 2 and 3. The default is 2.
awsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails_availabilityZoneCount :: Lens.Lens' AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails (Prelude.Maybe Prelude.Int)
awsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails_availabilityZoneCount :: (Maybe Int -> f (Maybe Int))
-> AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
-> f AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
awsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails_availabilityZoneCount = (AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
 -> Maybe Int)
-> (AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
    -> Maybe Int
    -> AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails)
-> Lens
     AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
     AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails' {Maybe Int
availabilityZoneCount :: Maybe Int
$sel:availabilityZoneCount:AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails' :: AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
-> Maybe Int
availabilityZoneCount} -> Maybe Int
availabilityZoneCount) (\s :: AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
s@AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails' {} Maybe Int
a -> AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
s {$sel:availabilityZoneCount:AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails' :: Maybe Int
availabilityZoneCount = Maybe Int
a} :: AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails)

instance
  Core.FromJSON
    AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
  where
  parseJSON :: Value
-> Parser
     AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
parseJSON =
    String
-> (Object
    -> Parser
         AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails)
-> Value
-> Parser
     AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails"
      ( \Object
x ->
          Maybe Int
-> AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails'
            (Maybe Int
 -> AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails)
-> Parser (Maybe Int)
-> Parser
     AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
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
    AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails

instance
  Prelude.NFData
    AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails

instance
  Core.ToJSON
    AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
  where
  toJSON :: AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
-> Value
toJSON
    AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails' {Maybe Int
availabilityZoneCount :: Maybe Int
$sel:availabilityZoneCount:AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails' :: AwsOpenSearchServiceDomainClusterConfigZoneAwarenessConfigDetails
-> 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
            ]
        )