{-# 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.LicenseManager.Types.ProvisionalConfiguration
-- 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.LicenseManager.Types.ProvisionalConfiguration where

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

-- | Details about a provisional configuration.
--
-- /See:/ 'newProvisionalConfiguration' smart constructor.
data ProvisionalConfiguration = ProvisionalConfiguration'
  { -- | Maximum time for the provisional configuration, in minutes.
    ProvisionalConfiguration -> Int
maxTimeToLiveInMinutes :: Prelude.Int
  }
  deriving (ProvisionalConfiguration -> ProvisionalConfiguration -> Bool
(ProvisionalConfiguration -> ProvisionalConfiguration -> Bool)
-> (ProvisionalConfiguration -> ProvisionalConfiguration -> Bool)
-> Eq ProvisionalConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProvisionalConfiguration -> ProvisionalConfiguration -> Bool
$c/= :: ProvisionalConfiguration -> ProvisionalConfiguration -> Bool
== :: ProvisionalConfiguration -> ProvisionalConfiguration -> Bool
$c== :: ProvisionalConfiguration -> ProvisionalConfiguration -> Bool
Prelude.Eq, ReadPrec [ProvisionalConfiguration]
ReadPrec ProvisionalConfiguration
Int -> ReadS ProvisionalConfiguration
ReadS [ProvisionalConfiguration]
(Int -> ReadS ProvisionalConfiguration)
-> ReadS [ProvisionalConfiguration]
-> ReadPrec ProvisionalConfiguration
-> ReadPrec [ProvisionalConfiguration]
-> Read ProvisionalConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProvisionalConfiguration]
$creadListPrec :: ReadPrec [ProvisionalConfiguration]
readPrec :: ReadPrec ProvisionalConfiguration
$creadPrec :: ReadPrec ProvisionalConfiguration
readList :: ReadS [ProvisionalConfiguration]
$creadList :: ReadS [ProvisionalConfiguration]
readsPrec :: Int -> ReadS ProvisionalConfiguration
$creadsPrec :: Int -> ReadS ProvisionalConfiguration
Prelude.Read, Int -> ProvisionalConfiguration -> ShowS
[ProvisionalConfiguration] -> ShowS
ProvisionalConfiguration -> String
(Int -> ProvisionalConfiguration -> ShowS)
-> (ProvisionalConfiguration -> String)
-> ([ProvisionalConfiguration] -> ShowS)
-> Show ProvisionalConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProvisionalConfiguration] -> ShowS
$cshowList :: [ProvisionalConfiguration] -> ShowS
show :: ProvisionalConfiguration -> String
$cshow :: ProvisionalConfiguration -> String
showsPrec :: Int -> ProvisionalConfiguration -> ShowS
$cshowsPrec :: Int -> ProvisionalConfiguration -> ShowS
Prelude.Show, (forall x.
 ProvisionalConfiguration -> Rep ProvisionalConfiguration x)
-> (forall x.
    Rep ProvisionalConfiguration x -> ProvisionalConfiguration)
-> Generic ProvisionalConfiguration
forall x.
Rep ProvisionalConfiguration x -> ProvisionalConfiguration
forall x.
ProvisionalConfiguration -> Rep ProvisionalConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ProvisionalConfiguration x -> ProvisionalConfiguration
$cfrom :: forall x.
ProvisionalConfiguration -> Rep ProvisionalConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ProvisionalConfiguration' 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:
--
-- 'maxTimeToLiveInMinutes', 'provisionalConfiguration_maxTimeToLiveInMinutes' - Maximum time for the provisional configuration, in minutes.
newProvisionalConfiguration ::
  -- | 'maxTimeToLiveInMinutes'
  Prelude.Int ->
  ProvisionalConfiguration
newProvisionalConfiguration :: Int -> ProvisionalConfiguration
newProvisionalConfiguration Int
pMaxTimeToLiveInMinutes_ =
  ProvisionalConfiguration' :: Int -> ProvisionalConfiguration
ProvisionalConfiguration'
    { $sel:maxTimeToLiveInMinutes:ProvisionalConfiguration' :: Int
maxTimeToLiveInMinutes =
        Int
pMaxTimeToLiveInMinutes_
    }

-- | Maximum time for the provisional configuration, in minutes.
provisionalConfiguration_maxTimeToLiveInMinutes :: Lens.Lens' ProvisionalConfiguration Prelude.Int
provisionalConfiguration_maxTimeToLiveInMinutes :: (Int -> f Int)
-> ProvisionalConfiguration -> f ProvisionalConfiguration
provisionalConfiguration_maxTimeToLiveInMinutes = (ProvisionalConfiguration -> Int)
-> (ProvisionalConfiguration -> Int -> ProvisionalConfiguration)
-> Lens ProvisionalConfiguration ProvisionalConfiguration Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProvisionalConfiguration' {Int
maxTimeToLiveInMinutes :: Int
$sel:maxTimeToLiveInMinutes:ProvisionalConfiguration' :: ProvisionalConfiguration -> Int
maxTimeToLiveInMinutes} -> Int
maxTimeToLiveInMinutes) (\s :: ProvisionalConfiguration
s@ProvisionalConfiguration' {} Int
a -> ProvisionalConfiguration
s {$sel:maxTimeToLiveInMinutes:ProvisionalConfiguration' :: Int
maxTimeToLiveInMinutes = Int
a} :: ProvisionalConfiguration)

instance Core.FromJSON ProvisionalConfiguration where
  parseJSON :: Value -> Parser ProvisionalConfiguration
parseJSON =
    String
-> (Object -> Parser ProvisionalConfiguration)
-> Value
-> Parser ProvisionalConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ProvisionalConfiguration"
      ( \Object
x ->
          Int -> ProvisionalConfiguration
ProvisionalConfiguration'
            (Int -> ProvisionalConfiguration)
-> Parser Int -> Parser ProvisionalConfiguration
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Int
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"MaxTimeToLiveInMinutes")
      )

instance Prelude.Hashable ProvisionalConfiguration

instance Prelude.NFData ProvisionalConfiguration

instance Core.ToJSON ProvisionalConfiguration where
  toJSON :: ProvisionalConfiguration -> Value
toJSON ProvisionalConfiguration' {Int
maxTimeToLiveInMinutes :: Int
$sel:maxTimeToLiveInMinutes:ProvisionalConfiguration' :: ProvisionalConfiguration -> Int
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"MaxTimeToLiveInMinutes"
                  Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Int
maxTimeToLiveInMinutes
              )
          ]
      )