{-# 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.M2.Types.EfsStorageConfiguration
-- 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.M2.Types.EfsStorageConfiguration 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

-- | Defines the storage configuration for an Amazon EFS file system.
--
-- /See:/ 'newEfsStorageConfiguration' smart constructor.
data EfsStorageConfiguration = EfsStorageConfiguration'
  { -- | The file system identifier.
    EfsStorageConfiguration -> Text
fileSystemId :: Prelude.Text,
    -- | The mount point for the file system.
    EfsStorageConfiguration -> Text
mountPoint :: Prelude.Text
  }
  deriving (EfsStorageConfiguration -> EfsStorageConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EfsStorageConfiguration -> EfsStorageConfiguration -> Bool
$c/= :: EfsStorageConfiguration -> EfsStorageConfiguration -> Bool
== :: EfsStorageConfiguration -> EfsStorageConfiguration -> Bool
$c== :: EfsStorageConfiguration -> EfsStorageConfiguration -> Bool
Prelude.Eq, ReadPrec [EfsStorageConfiguration]
ReadPrec EfsStorageConfiguration
Int -> ReadS EfsStorageConfiguration
ReadS [EfsStorageConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EfsStorageConfiguration]
$creadListPrec :: ReadPrec [EfsStorageConfiguration]
readPrec :: ReadPrec EfsStorageConfiguration
$creadPrec :: ReadPrec EfsStorageConfiguration
readList :: ReadS [EfsStorageConfiguration]
$creadList :: ReadS [EfsStorageConfiguration]
readsPrec :: Int -> ReadS EfsStorageConfiguration
$creadsPrec :: Int -> ReadS EfsStorageConfiguration
Prelude.Read, Int -> EfsStorageConfiguration -> ShowS
[EfsStorageConfiguration] -> ShowS
EfsStorageConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EfsStorageConfiguration] -> ShowS
$cshowList :: [EfsStorageConfiguration] -> ShowS
show :: EfsStorageConfiguration -> String
$cshow :: EfsStorageConfiguration -> String
showsPrec :: Int -> EfsStorageConfiguration -> ShowS
$cshowsPrec :: Int -> EfsStorageConfiguration -> ShowS
Prelude.Show, forall x. Rep EfsStorageConfiguration x -> EfsStorageConfiguration
forall x. EfsStorageConfiguration -> Rep EfsStorageConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EfsStorageConfiguration x -> EfsStorageConfiguration
$cfrom :: forall x. EfsStorageConfiguration -> Rep EfsStorageConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'EfsStorageConfiguration' 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:
--
-- 'fileSystemId', 'efsStorageConfiguration_fileSystemId' - The file system identifier.
--
-- 'mountPoint', 'efsStorageConfiguration_mountPoint' - The mount point for the file system.
newEfsStorageConfiguration ::
  -- | 'fileSystemId'
  Prelude.Text ->
  -- | 'mountPoint'
  Prelude.Text ->
  EfsStorageConfiguration
newEfsStorageConfiguration :: Text -> Text -> EfsStorageConfiguration
newEfsStorageConfiguration
  Text
pFileSystemId_
  Text
pMountPoint_ =
    EfsStorageConfiguration'
      { $sel:fileSystemId:EfsStorageConfiguration' :: Text
fileSystemId =
          Text
pFileSystemId_,
        $sel:mountPoint:EfsStorageConfiguration' :: Text
mountPoint = Text
pMountPoint_
      }

-- | The file system identifier.
efsStorageConfiguration_fileSystemId :: Lens.Lens' EfsStorageConfiguration Prelude.Text
efsStorageConfiguration_fileSystemId :: Lens' EfsStorageConfiguration Text
efsStorageConfiguration_fileSystemId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EfsStorageConfiguration' {Text
fileSystemId :: Text
$sel:fileSystemId:EfsStorageConfiguration' :: EfsStorageConfiguration -> Text
fileSystemId} -> Text
fileSystemId) (\s :: EfsStorageConfiguration
s@EfsStorageConfiguration' {} Text
a -> EfsStorageConfiguration
s {$sel:fileSystemId:EfsStorageConfiguration' :: Text
fileSystemId = Text
a} :: EfsStorageConfiguration)

-- | The mount point for the file system.
efsStorageConfiguration_mountPoint :: Lens.Lens' EfsStorageConfiguration Prelude.Text
efsStorageConfiguration_mountPoint :: Lens' EfsStorageConfiguration Text
efsStorageConfiguration_mountPoint = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EfsStorageConfiguration' {Text
mountPoint :: Text
$sel:mountPoint:EfsStorageConfiguration' :: EfsStorageConfiguration -> Text
mountPoint} -> Text
mountPoint) (\s :: EfsStorageConfiguration
s@EfsStorageConfiguration' {} Text
a -> EfsStorageConfiguration
s {$sel:mountPoint:EfsStorageConfiguration' :: Text
mountPoint = Text
a} :: EfsStorageConfiguration)

instance Data.FromJSON EfsStorageConfiguration where
  parseJSON :: Value -> Parser EfsStorageConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EfsStorageConfiguration"
      ( \Object
x ->
          Text -> Text -> EfsStorageConfiguration
EfsStorageConfiguration'
            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
"file-system-id")
            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
"mount-point")
      )

instance Prelude.Hashable EfsStorageConfiguration where
  hashWithSalt :: Int -> EfsStorageConfiguration -> Int
hashWithSalt Int
_salt EfsStorageConfiguration' {Text
mountPoint :: Text
fileSystemId :: Text
$sel:mountPoint:EfsStorageConfiguration' :: EfsStorageConfiguration -> Text
$sel:fileSystemId:EfsStorageConfiguration' :: EfsStorageConfiguration -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
fileSystemId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
mountPoint

instance Prelude.NFData EfsStorageConfiguration where
  rnf :: EfsStorageConfiguration -> ()
rnf EfsStorageConfiguration' {Text
mountPoint :: Text
fileSystemId :: Text
$sel:mountPoint:EfsStorageConfiguration' :: EfsStorageConfiguration -> Text
$sel:fileSystemId:EfsStorageConfiguration' :: EfsStorageConfiguration -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
fileSystemId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
mountPoint

instance Data.ToJSON EfsStorageConfiguration where
  toJSON :: EfsStorageConfiguration -> Value
toJSON EfsStorageConfiguration' {Text
mountPoint :: Text
fileSystemId :: Text
$sel:mountPoint:EfsStorageConfiguration' :: EfsStorageConfiguration -> Text
$sel:fileSystemId:EfsStorageConfiguration' :: EfsStorageConfiguration -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"file-system-id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
fileSystemId),
            forall a. a -> Maybe a
Prelude.Just (Key
"mount-point" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
mountPoint)
          ]
      )