{-# 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.EFS.Types.BackupPolicyDescription
-- 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.EFS.Types.BackupPolicyDescription where

import qualified Amazonka.Core as Core
import Amazonka.EFS.Types.BackupPolicy
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | /See:/ 'newBackupPolicyDescription' smart constructor.
data BackupPolicyDescription = BackupPolicyDescription'
  { -- | Describes the file system\'s backup policy, indicating whether automatic
    -- backups are turned on or off..
    BackupPolicyDescription -> Maybe BackupPolicy
backupPolicy :: Prelude.Maybe BackupPolicy
  }
  deriving (BackupPolicyDescription -> BackupPolicyDescription -> Bool
(BackupPolicyDescription -> BackupPolicyDescription -> Bool)
-> (BackupPolicyDescription -> BackupPolicyDescription -> Bool)
-> Eq BackupPolicyDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BackupPolicyDescription -> BackupPolicyDescription -> Bool
$c/= :: BackupPolicyDescription -> BackupPolicyDescription -> Bool
== :: BackupPolicyDescription -> BackupPolicyDescription -> Bool
$c== :: BackupPolicyDescription -> BackupPolicyDescription -> Bool
Prelude.Eq, ReadPrec [BackupPolicyDescription]
ReadPrec BackupPolicyDescription
Int -> ReadS BackupPolicyDescription
ReadS [BackupPolicyDescription]
(Int -> ReadS BackupPolicyDescription)
-> ReadS [BackupPolicyDescription]
-> ReadPrec BackupPolicyDescription
-> ReadPrec [BackupPolicyDescription]
-> Read BackupPolicyDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BackupPolicyDescription]
$creadListPrec :: ReadPrec [BackupPolicyDescription]
readPrec :: ReadPrec BackupPolicyDescription
$creadPrec :: ReadPrec BackupPolicyDescription
readList :: ReadS [BackupPolicyDescription]
$creadList :: ReadS [BackupPolicyDescription]
readsPrec :: Int -> ReadS BackupPolicyDescription
$creadsPrec :: Int -> ReadS BackupPolicyDescription
Prelude.Read, Int -> BackupPolicyDescription -> ShowS
[BackupPolicyDescription] -> ShowS
BackupPolicyDescription -> String
(Int -> BackupPolicyDescription -> ShowS)
-> (BackupPolicyDescription -> String)
-> ([BackupPolicyDescription] -> ShowS)
-> Show BackupPolicyDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BackupPolicyDescription] -> ShowS
$cshowList :: [BackupPolicyDescription] -> ShowS
show :: BackupPolicyDescription -> String
$cshow :: BackupPolicyDescription -> String
showsPrec :: Int -> BackupPolicyDescription -> ShowS
$cshowsPrec :: Int -> BackupPolicyDescription -> ShowS
Prelude.Show, (forall x.
 BackupPolicyDescription -> Rep BackupPolicyDescription x)
-> (forall x.
    Rep BackupPolicyDescription x -> BackupPolicyDescription)
-> Generic BackupPolicyDescription
forall x. Rep BackupPolicyDescription x -> BackupPolicyDescription
forall x. BackupPolicyDescription -> Rep BackupPolicyDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BackupPolicyDescription x -> BackupPolicyDescription
$cfrom :: forall x. BackupPolicyDescription -> Rep BackupPolicyDescription x
Prelude.Generic)

-- |
-- Create a value of 'BackupPolicyDescription' 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:
--
-- 'backupPolicy', 'backupPolicyDescription_backupPolicy' - Describes the file system\'s backup policy, indicating whether automatic
-- backups are turned on or off..
newBackupPolicyDescription ::
  BackupPolicyDescription
newBackupPolicyDescription :: BackupPolicyDescription
newBackupPolicyDescription =
  BackupPolicyDescription' :: Maybe BackupPolicy -> BackupPolicyDescription
BackupPolicyDescription'
    { $sel:backupPolicy:BackupPolicyDescription' :: Maybe BackupPolicy
backupPolicy =
        Maybe BackupPolicy
forall a. Maybe a
Prelude.Nothing
    }

-- | Describes the file system\'s backup policy, indicating whether automatic
-- backups are turned on or off..
backupPolicyDescription_backupPolicy :: Lens.Lens' BackupPolicyDescription (Prelude.Maybe BackupPolicy)
backupPolicyDescription_backupPolicy :: (Maybe BackupPolicy -> f (Maybe BackupPolicy))
-> BackupPolicyDescription -> f BackupPolicyDescription
backupPolicyDescription_backupPolicy = (BackupPolicyDescription -> Maybe BackupPolicy)
-> (BackupPolicyDescription
    -> Maybe BackupPolicy -> BackupPolicyDescription)
-> Lens
     BackupPolicyDescription
     BackupPolicyDescription
     (Maybe BackupPolicy)
     (Maybe BackupPolicy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackupPolicyDescription' {Maybe BackupPolicy
backupPolicy :: Maybe BackupPolicy
$sel:backupPolicy:BackupPolicyDescription' :: BackupPolicyDescription -> Maybe BackupPolicy
backupPolicy} -> Maybe BackupPolicy
backupPolicy) (\s :: BackupPolicyDescription
s@BackupPolicyDescription' {} Maybe BackupPolicy
a -> BackupPolicyDescription
s {$sel:backupPolicy:BackupPolicyDescription' :: Maybe BackupPolicy
backupPolicy = Maybe BackupPolicy
a} :: BackupPolicyDescription)

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

instance Prelude.Hashable BackupPolicyDescription

instance Prelude.NFData BackupPolicyDescription