{-# 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.Firehose.Types.AmazonopensearchserviceBufferingHints
-- 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.Firehose.Types.AmazonopensearchserviceBufferingHints where

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

-- | /See:/ 'newAmazonopensearchserviceBufferingHints' smart constructor.
data AmazonopensearchserviceBufferingHints = AmazonopensearchserviceBufferingHints'
  { AmazonopensearchserviceBufferingHints -> Maybe Natural
sizeInMBs :: Prelude.Maybe Prelude.Natural,
    AmazonopensearchserviceBufferingHints -> Maybe Natural
intervalInSeconds :: Prelude.Maybe Prelude.Natural
  }
  deriving (AmazonopensearchserviceBufferingHints
-> AmazonopensearchserviceBufferingHints -> Bool
(AmazonopensearchserviceBufferingHints
 -> AmazonopensearchserviceBufferingHints -> Bool)
-> (AmazonopensearchserviceBufferingHints
    -> AmazonopensearchserviceBufferingHints -> Bool)
-> Eq AmazonopensearchserviceBufferingHints
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AmazonopensearchserviceBufferingHints
-> AmazonopensearchserviceBufferingHints -> Bool
$c/= :: AmazonopensearchserviceBufferingHints
-> AmazonopensearchserviceBufferingHints -> Bool
== :: AmazonopensearchserviceBufferingHints
-> AmazonopensearchserviceBufferingHints -> Bool
$c== :: AmazonopensearchserviceBufferingHints
-> AmazonopensearchserviceBufferingHints -> Bool
Prelude.Eq, ReadPrec [AmazonopensearchserviceBufferingHints]
ReadPrec AmazonopensearchserviceBufferingHints
Int -> ReadS AmazonopensearchserviceBufferingHints
ReadS [AmazonopensearchserviceBufferingHints]
(Int -> ReadS AmazonopensearchserviceBufferingHints)
-> ReadS [AmazonopensearchserviceBufferingHints]
-> ReadPrec AmazonopensearchserviceBufferingHints
-> ReadPrec [AmazonopensearchserviceBufferingHints]
-> Read AmazonopensearchserviceBufferingHints
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AmazonopensearchserviceBufferingHints]
$creadListPrec :: ReadPrec [AmazonopensearchserviceBufferingHints]
readPrec :: ReadPrec AmazonopensearchserviceBufferingHints
$creadPrec :: ReadPrec AmazonopensearchserviceBufferingHints
readList :: ReadS [AmazonopensearchserviceBufferingHints]
$creadList :: ReadS [AmazonopensearchserviceBufferingHints]
readsPrec :: Int -> ReadS AmazonopensearchserviceBufferingHints
$creadsPrec :: Int -> ReadS AmazonopensearchserviceBufferingHints
Prelude.Read, Int -> AmazonopensearchserviceBufferingHints -> ShowS
[AmazonopensearchserviceBufferingHints] -> ShowS
AmazonopensearchserviceBufferingHints -> String
(Int -> AmazonopensearchserviceBufferingHints -> ShowS)
-> (AmazonopensearchserviceBufferingHints -> String)
-> ([AmazonopensearchserviceBufferingHints] -> ShowS)
-> Show AmazonopensearchserviceBufferingHints
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AmazonopensearchserviceBufferingHints] -> ShowS
$cshowList :: [AmazonopensearchserviceBufferingHints] -> ShowS
show :: AmazonopensearchserviceBufferingHints -> String
$cshow :: AmazonopensearchserviceBufferingHints -> String
showsPrec :: Int -> AmazonopensearchserviceBufferingHints -> ShowS
$cshowsPrec :: Int -> AmazonopensearchserviceBufferingHints -> ShowS
Prelude.Show, (forall x.
 AmazonopensearchserviceBufferingHints
 -> Rep AmazonopensearchserviceBufferingHints x)
-> (forall x.
    Rep AmazonopensearchserviceBufferingHints x
    -> AmazonopensearchserviceBufferingHints)
-> Generic AmazonopensearchserviceBufferingHints
forall x.
Rep AmazonopensearchserviceBufferingHints x
-> AmazonopensearchserviceBufferingHints
forall x.
AmazonopensearchserviceBufferingHints
-> Rep AmazonopensearchserviceBufferingHints x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AmazonopensearchserviceBufferingHints x
-> AmazonopensearchserviceBufferingHints
$cfrom :: forall x.
AmazonopensearchserviceBufferingHints
-> Rep AmazonopensearchserviceBufferingHints x
Prelude.Generic)

-- |
-- Create a value of 'AmazonopensearchserviceBufferingHints' 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:
--
-- 'sizeInMBs', 'amazonopensearchserviceBufferingHints_sizeInMBs' - Undocumented member.
--
-- 'intervalInSeconds', 'amazonopensearchserviceBufferingHints_intervalInSeconds' - Undocumented member.
newAmazonopensearchserviceBufferingHints ::
  AmazonopensearchserviceBufferingHints
newAmazonopensearchserviceBufferingHints :: AmazonopensearchserviceBufferingHints
newAmazonopensearchserviceBufferingHints =
  AmazonopensearchserviceBufferingHints' :: Maybe Natural
-> Maybe Natural -> AmazonopensearchserviceBufferingHints
AmazonopensearchserviceBufferingHints'
    { $sel:sizeInMBs:AmazonopensearchserviceBufferingHints' :: Maybe Natural
sizeInMBs =
        Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:intervalInSeconds:AmazonopensearchserviceBufferingHints' :: Maybe Natural
intervalInSeconds = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
amazonopensearchserviceBufferingHints_sizeInMBs :: Lens.Lens' AmazonopensearchserviceBufferingHints (Prelude.Maybe Prelude.Natural)
amazonopensearchserviceBufferingHints_sizeInMBs :: (Maybe Natural -> f (Maybe Natural))
-> AmazonopensearchserviceBufferingHints
-> f AmazonopensearchserviceBufferingHints
amazonopensearchserviceBufferingHints_sizeInMBs = (AmazonopensearchserviceBufferingHints -> Maybe Natural)
-> (AmazonopensearchserviceBufferingHints
    -> Maybe Natural -> AmazonopensearchserviceBufferingHints)
-> Lens
     AmazonopensearchserviceBufferingHints
     AmazonopensearchserviceBufferingHints
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AmazonopensearchserviceBufferingHints' {Maybe Natural
sizeInMBs :: Maybe Natural
$sel:sizeInMBs:AmazonopensearchserviceBufferingHints' :: AmazonopensearchserviceBufferingHints -> Maybe Natural
sizeInMBs} -> Maybe Natural
sizeInMBs) (\s :: AmazonopensearchserviceBufferingHints
s@AmazonopensearchserviceBufferingHints' {} Maybe Natural
a -> AmazonopensearchserviceBufferingHints
s {$sel:sizeInMBs:AmazonopensearchserviceBufferingHints' :: Maybe Natural
sizeInMBs = Maybe Natural
a} :: AmazonopensearchserviceBufferingHints)

-- | Undocumented member.
amazonopensearchserviceBufferingHints_intervalInSeconds :: Lens.Lens' AmazonopensearchserviceBufferingHints (Prelude.Maybe Prelude.Natural)
amazonopensearchserviceBufferingHints_intervalInSeconds :: (Maybe Natural -> f (Maybe Natural))
-> AmazonopensearchserviceBufferingHints
-> f AmazonopensearchserviceBufferingHints
amazonopensearchserviceBufferingHints_intervalInSeconds = (AmazonopensearchserviceBufferingHints -> Maybe Natural)
-> (AmazonopensearchserviceBufferingHints
    -> Maybe Natural -> AmazonopensearchserviceBufferingHints)
-> Lens
     AmazonopensearchserviceBufferingHints
     AmazonopensearchserviceBufferingHints
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AmazonopensearchserviceBufferingHints' {Maybe Natural
intervalInSeconds :: Maybe Natural
$sel:intervalInSeconds:AmazonopensearchserviceBufferingHints' :: AmazonopensearchserviceBufferingHints -> Maybe Natural
intervalInSeconds} -> Maybe Natural
intervalInSeconds) (\s :: AmazonopensearchserviceBufferingHints
s@AmazonopensearchserviceBufferingHints' {} Maybe Natural
a -> AmazonopensearchserviceBufferingHints
s {$sel:intervalInSeconds:AmazonopensearchserviceBufferingHints' :: Maybe Natural
intervalInSeconds = Maybe Natural
a} :: AmazonopensearchserviceBufferingHints)

instance
  Core.FromJSON
    AmazonopensearchserviceBufferingHints
  where
  parseJSON :: Value -> Parser AmazonopensearchserviceBufferingHints
parseJSON =
    String
-> (Object -> Parser AmazonopensearchserviceBufferingHints)
-> Value
-> Parser AmazonopensearchserviceBufferingHints
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AmazonopensearchserviceBufferingHints"
      ( \Object
x ->
          Maybe Natural
-> Maybe Natural -> AmazonopensearchserviceBufferingHints
AmazonopensearchserviceBufferingHints'
            (Maybe Natural
 -> Maybe Natural -> AmazonopensearchserviceBufferingHints)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> AmazonopensearchserviceBufferingHints)
forall (f :: * -> *) a b. Functor 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
"SizeInMBs")
            Parser (Maybe Natural -> AmazonopensearchserviceBufferingHints)
-> Parser (Maybe Natural)
-> Parser AmazonopensearchserviceBufferingHints
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
"IntervalInSeconds")
      )

instance
  Prelude.Hashable
    AmazonopensearchserviceBufferingHints

instance
  Prelude.NFData
    AmazonopensearchserviceBufferingHints

instance
  Core.ToJSON
    AmazonopensearchserviceBufferingHints
  where
  toJSON :: AmazonopensearchserviceBufferingHints -> Value
toJSON AmazonopensearchserviceBufferingHints' {Maybe Natural
intervalInSeconds :: Maybe Natural
sizeInMBs :: Maybe Natural
$sel:intervalInSeconds:AmazonopensearchserviceBufferingHints' :: AmazonopensearchserviceBufferingHints -> Maybe Natural
$sel:sizeInMBs:AmazonopensearchserviceBufferingHints' :: AmazonopensearchserviceBufferingHints -> Maybe Natural
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"SizeInMBs" 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
sizeInMBs,
            (Text
"IntervalInSeconds" 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
intervalInSeconds
          ]
      )