{-# 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.AmazonopensearchserviceRetryOptions
-- 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.AmazonopensearchserviceRetryOptions where

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

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

-- |
-- Create a value of 'AmazonopensearchserviceRetryOptions' 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:
--
-- 'durationInSeconds', 'amazonopensearchserviceRetryOptions_durationInSeconds' - Undocumented member.
newAmazonopensearchserviceRetryOptions ::
  AmazonopensearchserviceRetryOptions
newAmazonopensearchserviceRetryOptions :: AmazonopensearchserviceRetryOptions
newAmazonopensearchserviceRetryOptions =
  AmazonopensearchserviceRetryOptions' :: Maybe Natural -> AmazonopensearchserviceRetryOptions
AmazonopensearchserviceRetryOptions'
    { $sel:durationInSeconds:AmazonopensearchserviceRetryOptions' :: Maybe Natural
durationInSeconds =
        Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

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

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

instance
  Prelude.Hashable
    AmazonopensearchserviceRetryOptions

instance
  Prelude.NFData
    AmazonopensearchserviceRetryOptions

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