{-# 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.DirectoryService.Types.SnapshotLimits
-- 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.DirectoryService.Types.SnapshotLimits where

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

-- | Contains manual snapshot limit information for a directory.
--
-- /See:/ 'newSnapshotLimits' smart constructor.
data SnapshotLimits = SnapshotLimits'
  { -- | Indicates if the manual snapshot limit has been reached.
    SnapshotLimits -> Maybe Bool
manualSnapshotsLimitReached :: Prelude.Maybe Prelude.Bool,
    -- | The current number of manual snapshots of the directory.
    SnapshotLimits -> Maybe Natural
manualSnapshotsCurrentCount :: Prelude.Maybe Prelude.Natural,
    -- | The maximum number of manual snapshots allowed.
    SnapshotLimits -> Maybe Natural
manualSnapshotsLimit :: Prelude.Maybe Prelude.Natural
  }
  deriving (SnapshotLimits -> SnapshotLimits -> Bool
(SnapshotLimits -> SnapshotLimits -> Bool)
-> (SnapshotLimits -> SnapshotLimits -> Bool) -> Eq SnapshotLimits
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SnapshotLimits -> SnapshotLimits -> Bool
$c/= :: SnapshotLimits -> SnapshotLimits -> Bool
== :: SnapshotLimits -> SnapshotLimits -> Bool
$c== :: SnapshotLimits -> SnapshotLimits -> Bool
Prelude.Eq, ReadPrec [SnapshotLimits]
ReadPrec SnapshotLimits
Int -> ReadS SnapshotLimits
ReadS [SnapshotLimits]
(Int -> ReadS SnapshotLimits)
-> ReadS [SnapshotLimits]
-> ReadPrec SnapshotLimits
-> ReadPrec [SnapshotLimits]
-> Read SnapshotLimits
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SnapshotLimits]
$creadListPrec :: ReadPrec [SnapshotLimits]
readPrec :: ReadPrec SnapshotLimits
$creadPrec :: ReadPrec SnapshotLimits
readList :: ReadS [SnapshotLimits]
$creadList :: ReadS [SnapshotLimits]
readsPrec :: Int -> ReadS SnapshotLimits
$creadsPrec :: Int -> ReadS SnapshotLimits
Prelude.Read, Int -> SnapshotLimits -> ShowS
[SnapshotLimits] -> ShowS
SnapshotLimits -> String
(Int -> SnapshotLimits -> ShowS)
-> (SnapshotLimits -> String)
-> ([SnapshotLimits] -> ShowS)
-> Show SnapshotLimits
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SnapshotLimits] -> ShowS
$cshowList :: [SnapshotLimits] -> ShowS
show :: SnapshotLimits -> String
$cshow :: SnapshotLimits -> String
showsPrec :: Int -> SnapshotLimits -> ShowS
$cshowsPrec :: Int -> SnapshotLimits -> ShowS
Prelude.Show, (forall x. SnapshotLimits -> Rep SnapshotLimits x)
-> (forall x. Rep SnapshotLimits x -> SnapshotLimits)
-> Generic SnapshotLimits
forall x. Rep SnapshotLimits x -> SnapshotLimits
forall x. SnapshotLimits -> Rep SnapshotLimits x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SnapshotLimits x -> SnapshotLimits
$cfrom :: forall x. SnapshotLimits -> Rep SnapshotLimits x
Prelude.Generic)

-- |
-- Create a value of 'SnapshotLimits' 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:
--
-- 'manualSnapshotsLimitReached', 'snapshotLimits_manualSnapshotsLimitReached' - Indicates if the manual snapshot limit has been reached.
--
-- 'manualSnapshotsCurrentCount', 'snapshotLimits_manualSnapshotsCurrentCount' - The current number of manual snapshots of the directory.
--
-- 'manualSnapshotsLimit', 'snapshotLimits_manualSnapshotsLimit' - The maximum number of manual snapshots allowed.
newSnapshotLimits ::
  SnapshotLimits
newSnapshotLimits :: SnapshotLimits
newSnapshotLimits =
  SnapshotLimits' :: Maybe Bool -> Maybe Natural -> Maybe Natural -> SnapshotLimits
SnapshotLimits'
    { $sel:manualSnapshotsLimitReached:SnapshotLimits' :: Maybe Bool
manualSnapshotsLimitReached =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:manualSnapshotsCurrentCount:SnapshotLimits' :: Maybe Natural
manualSnapshotsCurrentCount = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:manualSnapshotsLimit:SnapshotLimits' :: Maybe Natural
manualSnapshotsLimit = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Indicates if the manual snapshot limit has been reached.
snapshotLimits_manualSnapshotsLimitReached :: Lens.Lens' SnapshotLimits (Prelude.Maybe Prelude.Bool)
snapshotLimits_manualSnapshotsLimitReached :: (Maybe Bool -> f (Maybe Bool))
-> SnapshotLimits -> f SnapshotLimits
snapshotLimits_manualSnapshotsLimitReached = (SnapshotLimits -> Maybe Bool)
-> (SnapshotLimits -> Maybe Bool -> SnapshotLimits)
-> Lens SnapshotLimits SnapshotLimits (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnapshotLimits' {Maybe Bool
manualSnapshotsLimitReached :: Maybe Bool
$sel:manualSnapshotsLimitReached:SnapshotLimits' :: SnapshotLimits -> Maybe Bool
manualSnapshotsLimitReached} -> Maybe Bool
manualSnapshotsLimitReached) (\s :: SnapshotLimits
s@SnapshotLimits' {} Maybe Bool
a -> SnapshotLimits
s {$sel:manualSnapshotsLimitReached:SnapshotLimits' :: Maybe Bool
manualSnapshotsLimitReached = Maybe Bool
a} :: SnapshotLimits)

-- | The current number of manual snapshots of the directory.
snapshotLimits_manualSnapshotsCurrentCount :: Lens.Lens' SnapshotLimits (Prelude.Maybe Prelude.Natural)
snapshotLimits_manualSnapshotsCurrentCount :: (Maybe Natural -> f (Maybe Natural))
-> SnapshotLimits -> f SnapshotLimits
snapshotLimits_manualSnapshotsCurrentCount = (SnapshotLimits -> Maybe Natural)
-> (SnapshotLimits -> Maybe Natural -> SnapshotLimits)
-> Lens
     SnapshotLimits SnapshotLimits (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnapshotLimits' {Maybe Natural
manualSnapshotsCurrentCount :: Maybe Natural
$sel:manualSnapshotsCurrentCount:SnapshotLimits' :: SnapshotLimits -> Maybe Natural
manualSnapshotsCurrentCount} -> Maybe Natural
manualSnapshotsCurrentCount) (\s :: SnapshotLimits
s@SnapshotLimits' {} Maybe Natural
a -> SnapshotLimits
s {$sel:manualSnapshotsCurrentCount:SnapshotLimits' :: Maybe Natural
manualSnapshotsCurrentCount = Maybe Natural
a} :: SnapshotLimits)

-- | The maximum number of manual snapshots allowed.
snapshotLimits_manualSnapshotsLimit :: Lens.Lens' SnapshotLimits (Prelude.Maybe Prelude.Natural)
snapshotLimits_manualSnapshotsLimit :: (Maybe Natural -> f (Maybe Natural))
-> SnapshotLimits -> f SnapshotLimits
snapshotLimits_manualSnapshotsLimit = (SnapshotLimits -> Maybe Natural)
-> (SnapshotLimits -> Maybe Natural -> SnapshotLimits)
-> Lens
     SnapshotLimits SnapshotLimits (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnapshotLimits' {Maybe Natural
manualSnapshotsLimit :: Maybe Natural
$sel:manualSnapshotsLimit:SnapshotLimits' :: SnapshotLimits -> Maybe Natural
manualSnapshotsLimit} -> Maybe Natural
manualSnapshotsLimit) (\s :: SnapshotLimits
s@SnapshotLimits' {} Maybe Natural
a -> SnapshotLimits
s {$sel:manualSnapshotsLimit:SnapshotLimits' :: Maybe Natural
manualSnapshotsLimit = Maybe Natural
a} :: SnapshotLimits)

instance Core.FromJSON SnapshotLimits where
  parseJSON :: Value -> Parser SnapshotLimits
parseJSON =
    String
-> (Object -> Parser SnapshotLimits)
-> Value
-> Parser SnapshotLimits
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SnapshotLimits"
      ( \Object
x ->
          Maybe Bool -> Maybe Natural -> Maybe Natural -> SnapshotLimits
SnapshotLimits'
            (Maybe Bool -> Maybe Natural -> Maybe Natural -> SnapshotLimits)
-> Parser (Maybe Bool)
-> Parser (Maybe Natural -> Maybe Natural -> SnapshotLimits)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ManualSnapshotsLimitReached")
            Parser (Maybe Natural -> Maybe Natural -> SnapshotLimits)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> SnapshotLimits)
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
"ManualSnapshotsCurrentCount")
            Parser (Maybe Natural -> SnapshotLimits)
-> Parser (Maybe Natural) -> Parser SnapshotLimits
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
"ManualSnapshotsLimit")
      )

instance Prelude.Hashable SnapshotLimits

instance Prelude.NFData SnapshotLimits