{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SageMaker.Types.RetentionPolicy where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
    { $sel:homeEfsFileSystem:RetentionPolicy' :: Maybe RetentionType
homeEfsFileSystem =
        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 :: Lens' RetentionPolicy (Maybe RetentionType)
retentionPolicy_homeEfsFileSystem = 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 where
  hashWithSalt :: Int -> RetentionPolicy -> Int
hashWithSalt Int
_salt RetentionPolicy' {Maybe RetentionType
homeEfsFileSystem :: Maybe RetentionType
$sel:homeEfsFileSystem:RetentionPolicy' :: RetentionPolicy -> Maybe RetentionType
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RetentionType
homeEfsFileSystem

instance Prelude.NFData RetentionPolicy where
  rnf :: RetentionPolicy -> ()
rnf RetentionPolicy' {Maybe RetentionType
homeEfsFileSystem :: Maybe RetentionType
$sel:homeEfsFileSystem:RetentionPolicy' :: RetentionPolicy -> Maybe RetentionType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe RetentionType
homeEfsFileSystem

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