{-# 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.SageMaker.Types.RetentionPolicy
-- 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.SageMaker.Types.RetentionPolicy where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.RetentionType

-- | The retention policy for data stored on an Amazon Elastic File System
-- (EFS) volume.
--
-- /See:/ 'newRetentionPolicy' smart constructor.
data RetentionPolicy = RetentionPolicy'
  { -- | The default is @Retain@, which specifies to keep the data stored on the
    -- EFS volume.
    --
    -- Specify @Delete@ to delete the data stored on the EFS volume.
    RetentionPolicy -> Maybe RetentionType
homeEfsFileSystem :: Prelude.Maybe RetentionType
  }
  deriving (RetentionPolicy -> RetentionPolicy -> Bool
(RetentionPolicy -> RetentionPolicy -> Bool)
-> (RetentionPolicy -> RetentionPolicy -> Bool)
-> Eq RetentionPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RetentionPolicy -> RetentionPolicy -> Bool
$c/= :: RetentionPolicy -> RetentionPolicy -> Bool
== :: RetentionPolicy -> RetentionPolicy -> Bool
$c== :: RetentionPolicy -> RetentionPolicy -> Bool
Prelude.Eq, ReadPrec [RetentionPolicy]
ReadPrec RetentionPolicy
Int -> ReadS RetentionPolicy
ReadS [RetentionPolicy]
(Int -> ReadS RetentionPolicy)
-> ReadS [RetentionPolicy]
-> ReadPrec RetentionPolicy
-> ReadPrec [RetentionPolicy]
-> Read RetentionPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RetentionPolicy]
$creadListPrec :: ReadPrec [RetentionPolicy]
readPrec :: ReadPrec RetentionPolicy
$creadPrec :: ReadPrec RetentionPolicy
readList :: ReadS [RetentionPolicy]
$creadList :: ReadS [RetentionPolicy]
readsPrec :: Int -> ReadS RetentionPolicy
$creadsPrec :: Int -> ReadS RetentionPolicy
Prelude.Read, Int -> RetentionPolicy -> ShowS
[RetentionPolicy] -> ShowS
RetentionPolicy -> String
(Int -> RetentionPolicy -> ShowS)
-> (RetentionPolicy -> String)
-> ([RetentionPolicy] -> ShowS)
-> Show RetentionPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RetentionPolicy] -> ShowS
$cshowList :: [RetentionPolicy] -> ShowS
show :: RetentionPolicy -> String
$cshow :: RetentionPolicy -> String
showsPrec :: Int -> RetentionPolicy -> ShowS
$cshowsPrec :: Int -> RetentionPolicy -> ShowS
Prelude.Show, (forall x. RetentionPolicy -> Rep RetentionPolicy x)
-> (forall x. Rep RetentionPolicy x -> RetentionPolicy)
-> Generic RetentionPolicy
forall x. Rep RetentionPolicy x -> RetentionPolicy
forall x. RetentionPolicy -> Rep RetentionPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RetentionPolicy x -> RetentionPolicy
$cfrom :: forall x. RetentionPolicy -> Rep RetentionPolicy x
Prelude.Generic)

-- |
-- Create a value of 'RetentionPolicy' 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:
--
-- 'homeEfsFileSystem', 'retentionPolicy_homeEfsFileSystem' - The default is @Retain@, which specifies to keep the data stored on the
-- EFS volume.
--
-- Specify @Delete@ to delete the data stored on the EFS volume.
newRetentionPolicy ::
  RetentionPolicy
newRetentionPolicy :: RetentionPolicy
newRetentionPolicy =
  RetentionPolicy' :: Maybe RetentionType -> RetentionPolicy
RetentionPolicy'
    { $sel:homeEfsFileSystem:RetentionPolicy' :: Maybe RetentionType
homeEfsFileSystem =
        Maybe RetentionType
forall a. Maybe a
Prelude.Nothing
    }

-- | The default is @Retain@, which specifies to keep the data stored on the
-- EFS volume.
--
-- Specify @Delete@ to delete the data stored on the EFS volume.
retentionPolicy_homeEfsFileSystem :: Lens.Lens' RetentionPolicy (Prelude.Maybe RetentionType)
retentionPolicy_homeEfsFileSystem :: (Maybe RetentionType -> f (Maybe RetentionType))
-> RetentionPolicy -> f RetentionPolicy
retentionPolicy_homeEfsFileSystem = (RetentionPolicy -> Maybe RetentionType)
-> (RetentionPolicy -> Maybe RetentionType -> RetentionPolicy)
-> Lens
     RetentionPolicy
     RetentionPolicy
     (Maybe RetentionType)
     (Maybe RetentionType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RetentionPolicy' {Maybe RetentionType
homeEfsFileSystem :: Maybe RetentionType
$sel:homeEfsFileSystem:RetentionPolicy' :: RetentionPolicy -> Maybe RetentionType
homeEfsFileSystem} -> Maybe RetentionType
homeEfsFileSystem) (\s :: RetentionPolicy
s@RetentionPolicy' {} Maybe RetentionType
a -> RetentionPolicy
s {$sel:homeEfsFileSystem:RetentionPolicy' :: Maybe RetentionType
homeEfsFileSystem = Maybe RetentionType
a} :: RetentionPolicy)

instance Prelude.Hashable RetentionPolicy

instance Prelude.NFData RetentionPolicy

instance Core.ToJSON RetentionPolicy where
  toJSON :: RetentionPolicy -> Value
toJSON RetentionPolicy' {Maybe RetentionType
homeEfsFileSystem :: Maybe RetentionType
$sel:homeEfsFileSystem:RetentionPolicy' :: RetentionPolicy -> Maybe RetentionType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"HomeEfsFileSystem" Text -> RetentionType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (RetentionType -> Pair) -> Maybe RetentionType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RetentionType
homeEfsFileSystem
          ]
      )