{-# 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.Transfer.Types.EfsFileLocation
-- 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.Transfer.Types.EfsFileLocation where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Reserved for future use.
--
-- /See:/ 'newEfsFileLocation' smart constructor.
data EfsFileLocation = EfsFileLocation'
  { -- | The pathname for the folder being used by a workflow.
    EfsFileLocation -> Maybe Text
path :: Prelude.Maybe Prelude.Text,
    -- | The ID of the file system, assigned by Amazon EFS.
    EfsFileLocation -> Maybe Text
fileSystemId :: Prelude.Maybe Prelude.Text
  }
  deriving (EfsFileLocation -> EfsFileLocation -> Bool
(EfsFileLocation -> EfsFileLocation -> Bool)
-> (EfsFileLocation -> EfsFileLocation -> Bool)
-> Eq EfsFileLocation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EfsFileLocation -> EfsFileLocation -> Bool
$c/= :: EfsFileLocation -> EfsFileLocation -> Bool
== :: EfsFileLocation -> EfsFileLocation -> Bool
$c== :: EfsFileLocation -> EfsFileLocation -> Bool
Prelude.Eq, ReadPrec [EfsFileLocation]
ReadPrec EfsFileLocation
Int -> ReadS EfsFileLocation
ReadS [EfsFileLocation]
(Int -> ReadS EfsFileLocation)
-> ReadS [EfsFileLocation]
-> ReadPrec EfsFileLocation
-> ReadPrec [EfsFileLocation]
-> Read EfsFileLocation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EfsFileLocation]
$creadListPrec :: ReadPrec [EfsFileLocation]
readPrec :: ReadPrec EfsFileLocation
$creadPrec :: ReadPrec EfsFileLocation
readList :: ReadS [EfsFileLocation]
$creadList :: ReadS [EfsFileLocation]
readsPrec :: Int -> ReadS EfsFileLocation
$creadsPrec :: Int -> ReadS EfsFileLocation
Prelude.Read, Int -> EfsFileLocation -> ShowS
[EfsFileLocation] -> ShowS
EfsFileLocation -> String
(Int -> EfsFileLocation -> ShowS)
-> (EfsFileLocation -> String)
-> ([EfsFileLocation] -> ShowS)
-> Show EfsFileLocation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EfsFileLocation] -> ShowS
$cshowList :: [EfsFileLocation] -> ShowS
show :: EfsFileLocation -> String
$cshow :: EfsFileLocation -> String
showsPrec :: Int -> EfsFileLocation -> ShowS
$cshowsPrec :: Int -> EfsFileLocation -> ShowS
Prelude.Show, (forall x. EfsFileLocation -> Rep EfsFileLocation x)
-> (forall x. Rep EfsFileLocation x -> EfsFileLocation)
-> Generic EfsFileLocation
forall x. Rep EfsFileLocation x -> EfsFileLocation
forall x. EfsFileLocation -> Rep EfsFileLocation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EfsFileLocation x -> EfsFileLocation
$cfrom :: forall x. EfsFileLocation -> Rep EfsFileLocation x
Prelude.Generic)

-- |
-- Create a value of 'EfsFileLocation' 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:
--
-- 'path', 'efsFileLocation_path' - The pathname for the folder being used by a workflow.
--
-- 'fileSystemId', 'efsFileLocation_fileSystemId' - The ID of the file system, assigned by Amazon EFS.
newEfsFileLocation ::
  EfsFileLocation
newEfsFileLocation :: EfsFileLocation
newEfsFileLocation =
  EfsFileLocation' :: Maybe Text -> Maybe Text -> EfsFileLocation
EfsFileLocation'
    { $sel:path:EfsFileLocation' :: Maybe Text
path = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:fileSystemId:EfsFileLocation' :: Maybe Text
fileSystemId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The pathname for the folder being used by a workflow.
efsFileLocation_path :: Lens.Lens' EfsFileLocation (Prelude.Maybe Prelude.Text)
efsFileLocation_path :: (Maybe Text -> f (Maybe Text))
-> EfsFileLocation -> f EfsFileLocation
efsFileLocation_path = (EfsFileLocation -> Maybe Text)
-> (EfsFileLocation -> Maybe Text -> EfsFileLocation)
-> Lens EfsFileLocation EfsFileLocation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EfsFileLocation' {Maybe Text
path :: Maybe Text
$sel:path:EfsFileLocation' :: EfsFileLocation -> Maybe Text
path} -> Maybe Text
path) (\s :: EfsFileLocation
s@EfsFileLocation' {} Maybe Text
a -> EfsFileLocation
s {$sel:path:EfsFileLocation' :: Maybe Text
path = Maybe Text
a} :: EfsFileLocation)

-- | The ID of the file system, assigned by Amazon EFS.
efsFileLocation_fileSystemId :: Lens.Lens' EfsFileLocation (Prelude.Maybe Prelude.Text)
efsFileLocation_fileSystemId :: (Maybe Text -> f (Maybe Text))
-> EfsFileLocation -> f EfsFileLocation
efsFileLocation_fileSystemId = (EfsFileLocation -> Maybe Text)
-> (EfsFileLocation -> Maybe Text -> EfsFileLocation)
-> Lens EfsFileLocation EfsFileLocation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EfsFileLocation' {Maybe Text
fileSystemId :: Maybe Text
$sel:fileSystemId:EfsFileLocation' :: EfsFileLocation -> Maybe Text
fileSystemId} -> Maybe Text
fileSystemId) (\s :: EfsFileLocation
s@EfsFileLocation' {} Maybe Text
a -> EfsFileLocation
s {$sel:fileSystemId:EfsFileLocation' :: Maybe Text
fileSystemId = Maybe Text
a} :: EfsFileLocation)

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

instance Prelude.Hashable EfsFileLocation

instance Prelude.NFData EfsFileLocation

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