{-# 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.Lambda.Types.FileSystemConfig
-- 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.Lambda.Types.FileSystemConfig 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

-- | Details about the connection between a Lambda function and an
-- <https://docs.aws.amazon.com/lambda/latest/dg/configuration-filesystem.html Amazon EFS file system>.
--
-- /See:/ 'newFileSystemConfig' smart constructor.
data FileSystemConfig = FileSystemConfig'
  { -- | The Amazon Resource Name (ARN) of the Amazon EFS access point that
    -- provides access to the file system.
    FileSystemConfig -> Text
arn :: Prelude.Text,
    -- | The path where the function can access the file system, starting with
    -- @\/mnt\/@.
    FileSystemConfig -> Text
localMountPath :: Prelude.Text
  }
  deriving (FileSystemConfig -> FileSystemConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FileSystemConfig -> FileSystemConfig -> Bool
$c/= :: FileSystemConfig -> FileSystemConfig -> Bool
== :: FileSystemConfig -> FileSystemConfig -> Bool
$c== :: FileSystemConfig -> FileSystemConfig -> Bool
Prelude.Eq, ReadPrec [FileSystemConfig]
ReadPrec FileSystemConfig
Int -> ReadS FileSystemConfig
ReadS [FileSystemConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FileSystemConfig]
$creadListPrec :: ReadPrec [FileSystemConfig]
readPrec :: ReadPrec FileSystemConfig
$creadPrec :: ReadPrec FileSystemConfig
readList :: ReadS [FileSystemConfig]
$creadList :: ReadS [FileSystemConfig]
readsPrec :: Int -> ReadS FileSystemConfig
$creadsPrec :: Int -> ReadS FileSystemConfig
Prelude.Read, Int -> FileSystemConfig -> ShowS
[FileSystemConfig] -> ShowS
FileSystemConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FileSystemConfig] -> ShowS
$cshowList :: [FileSystemConfig] -> ShowS
show :: FileSystemConfig -> String
$cshow :: FileSystemConfig -> String
showsPrec :: Int -> FileSystemConfig -> ShowS
$cshowsPrec :: Int -> FileSystemConfig -> ShowS
Prelude.Show, forall x. Rep FileSystemConfig x -> FileSystemConfig
forall x. FileSystemConfig -> Rep FileSystemConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FileSystemConfig x -> FileSystemConfig
$cfrom :: forall x. FileSystemConfig -> Rep FileSystemConfig x
Prelude.Generic)

-- |
-- Create a value of 'FileSystemConfig' 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:
--
-- 'arn', 'fileSystemConfig_arn' - The Amazon Resource Name (ARN) of the Amazon EFS access point that
-- provides access to the file system.
--
-- 'localMountPath', 'fileSystemConfig_localMountPath' - The path where the function can access the file system, starting with
-- @\/mnt\/@.
newFileSystemConfig ::
  -- | 'arn'
  Prelude.Text ->
  -- | 'localMountPath'
  Prelude.Text ->
  FileSystemConfig
newFileSystemConfig :: Text -> Text -> FileSystemConfig
newFileSystemConfig Text
pArn_ Text
pLocalMountPath_ =
  FileSystemConfig'
    { $sel:arn:FileSystemConfig' :: Text
arn = Text
pArn_,
      $sel:localMountPath:FileSystemConfig' :: Text
localMountPath = Text
pLocalMountPath_
    }

-- | The Amazon Resource Name (ARN) of the Amazon EFS access point that
-- provides access to the file system.
fileSystemConfig_arn :: Lens.Lens' FileSystemConfig Prelude.Text
fileSystemConfig_arn :: Lens' FileSystemConfig Text
fileSystemConfig_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FileSystemConfig' {Text
arn :: Text
$sel:arn:FileSystemConfig' :: FileSystemConfig -> Text
arn} -> Text
arn) (\s :: FileSystemConfig
s@FileSystemConfig' {} Text
a -> FileSystemConfig
s {$sel:arn:FileSystemConfig' :: Text
arn = Text
a} :: FileSystemConfig)

-- | The path where the function can access the file system, starting with
-- @\/mnt\/@.
fileSystemConfig_localMountPath :: Lens.Lens' FileSystemConfig Prelude.Text
fileSystemConfig_localMountPath :: Lens' FileSystemConfig Text
fileSystemConfig_localMountPath = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FileSystemConfig' {Text
localMountPath :: Text
$sel:localMountPath:FileSystemConfig' :: FileSystemConfig -> Text
localMountPath} -> Text
localMountPath) (\s :: FileSystemConfig
s@FileSystemConfig' {} Text
a -> FileSystemConfig
s {$sel:localMountPath:FileSystemConfig' :: Text
localMountPath = Text
a} :: FileSystemConfig)

instance Data.FromJSON FileSystemConfig where
  parseJSON :: Value -> Parser FileSystemConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FileSystemConfig"
      ( \Object
x ->
          Text -> Text -> FileSystemConfig
FileSystemConfig'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Arn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"LocalMountPath")
      )

instance Prelude.Hashable FileSystemConfig where
  hashWithSalt :: Int -> FileSystemConfig -> Int
hashWithSalt Int
_salt FileSystemConfig' {Text
localMountPath :: Text
arn :: Text
$sel:localMountPath:FileSystemConfig' :: FileSystemConfig -> Text
$sel:arn:FileSystemConfig' :: FileSystemConfig -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
localMountPath

instance Prelude.NFData FileSystemConfig where
  rnf :: FileSystemConfig -> ()
rnf FileSystemConfig' {Text
localMountPath :: Text
arn :: Text
$sel:localMountPath:FileSystemConfig' :: FileSystemConfig -> Text
$sel:arn:FileSystemConfig' :: FileSystemConfig -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
localMountPath

instance Data.ToJSON FileSystemConfig where
  toJSON :: FileSystemConfig -> Value
toJSON FileSystemConfig' {Text
localMountPath :: Text
arn :: Text
$sel:localMountPath:FileSystemConfig' :: FileSystemConfig -> Text
$sel:arn:FileSystemConfig' :: FileSystemConfig -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"Arn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
arn),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"LocalMountPath" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
localMountPath)
          ]
      )