{-# 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.FileSystemDataSource
-- 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.FileSystemDataSource where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.FileSystemAccessMode
import Amazonka.SageMaker.Types.FileSystemType

-- | Specifies a file system data source for a channel.
--
-- /See:/ 'newFileSystemDataSource' smart constructor.
data FileSystemDataSource = FileSystemDataSource'
  { -- | The file system id.
    FileSystemDataSource -> Text
fileSystemId :: Prelude.Text,
    -- | The access mode of the mount of the directory associated with the
    -- channel. A directory can be mounted either in @ro@ (read-only) or @rw@
    -- (read-write) mode.
    FileSystemDataSource -> FileSystemAccessMode
fileSystemAccessMode :: FileSystemAccessMode,
    -- | The file system type.
    FileSystemDataSource -> FileSystemType
fileSystemType :: FileSystemType,
    -- | The full path to the directory to associate with the channel.
    FileSystemDataSource -> Text
directoryPath :: Prelude.Text
  }
  deriving (FileSystemDataSource -> FileSystemDataSource -> Bool
(FileSystemDataSource -> FileSystemDataSource -> Bool)
-> (FileSystemDataSource -> FileSystemDataSource -> Bool)
-> Eq FileSystemDataSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FileSystemDataSource -> FileSystemDataSource -> Bool
$c/= :: FileSystemDataSource -> FileSystemDataSource -> Bool
== :: FileSystemDataSource -> FileSystemDataSource -> Bool
$c== :: FileSystemDataSource -> FileSystemDataSource -> Bool
Prelude.Eq, ReadPrec [FileSystemDataSource]
ReadPrec FileSystemDataSource
Int -> ReadS FileSystemDataSource
ReadS [FileSystemDataSource]
(Int -> ReadS FileSystemDataSource)
-> ReadS [FileSystemDataSource]
-> ReadPrec FileSystemDataSource
-> ReadPrec [FileSystemDataSource]
-> Read FileSystemDataSource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FileSystemDataSource]
$creadListPrec :: ReadPrec [FileSystemDataSource]
readPrec :: ReadPrec FileSystemDataSource
$creadPrec :: ReadPrec FileSystemDataSource
readList :: ReadS [FileSystemDataSource]
$creadList :: ReadS [FileSystemDataSource]
readsPrec :: Int -> ReadS FileSystemDataSource
$creadsPrec :: Int -> ReadS FileSystemDataSource
Prelude.Read, Int -> FileSystemDataSource -> ShowS
[FileSystemDataSource] -> ShowS
FileSystemDataSource -> String
(Int -> FileSystemDataSource -> ShowS)
-> (FileSystemDataSource -> String)
-> ([FileSystemDataSource] -> ShowS)
-> Show FileSystemDataSource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FileSystemDataSource] -> ShowS
$cshowList :: [FileSystemDataSource] -> ShowS
show :: FileSystemDataSource -> String
$cshow :: FileSystemDataSource -> String
showsPrec :: Int -> FileSystemDataSource -> ShowS
$cshowsPrec :: Int -> FileSystemDataSource -> ShowS
Prelude.Show, (forall x. FileSystemDataSource -> Rep FileSystemDataSource x)
-> (forall x. Rep FileSystemDataSource x -> FileSystemDataSource)
-> Generic FileSystemDataSource
forall x. Rep FileSystemDataSource x -> FileSystemDataSource
forall x. FileSystemDataSource -> Rep FileSystemDataSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FileSystemDataSource x -> FileSystemDataSource
$cfrom :: forall x. FileSystemDataSource -> Rep FileSystemDataSource x
Prelude.Generic)

-- |
-- Create a value of 'FileSystemDataSource' 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', 'fileSystemDataSource_fileSystemId' - The file system id.
--
-- 'fileSystemAccessMode', 'fileSystemDataSource_fileSystemAccessMode' - The access mode of the mount of the directory associated with the
-- channel. A directory can be mounted either in @ro@ (read-only) or @rw@
-- (read-write) mode.
--
-- 'fileSystemType', 'fileSystemDataSource_fileSystemType' - The file system type.
--
-- 'directoryPath', 'fileSystemDataSource_directoryPath' - The full path to the directory to associate with the channel.
newFileSystemDataSource ::
  -- | 'fileSystemId'
  Prelude.Text ->
  -- | 'fileSystemAccessMode'
  FileSystemAccessMode ->
  -- | 'fileSystemType'
  FileSystemType ->
  -- | 'directoryPath'
  Prelude.Text ->
  FileSystemDataSource
newFileSystemDataSource :: Text
-> FileSystemAccessMode
-> FileSystemType
-> Text
-> FileSystemDataSource
newFileSystemDataSource
  Text
pFileSystemId_
  FileSystemAccessMode
pFileSystemAccessMode_
  FileSystemType
pFileSystemType_
  Text
pDirectoryPath_ =
    FileSystemDataSource' :: Text
-> FileSystemAccessMode
-> FileSystemType
-> Text
-> FileSystemDataSource
FileSystemDataSource'
      { $sel:fileSystemId:FileSystemDataSource' :: Text
fileSystemId =
          Text
pFileSystemId_,
        $sel:fileSystemAccessMode:FileSystemDataSource' :: FileSystemAccessMode
fileSystemAccessMode = FileSystemAccessMode
pFileSystemAccessMode_,
        $sel:fileSystemType:FileSystemDataSource' :: FileSystemType
fileSystemType = FileSystemType
pFileSystemType_,
        $sel:directoryPath:FileSystemDataSource' :: Text
directoryPath = Text
pDirectoryPath_
      }

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

-- | The access mode of the mount of the directory associated with the
-- channel. A directory can be mounted either in @ro@ (read-only) or @rw@
-- (read-write) mode.
fileSystemDataSource_fileSystemAccessMode :: Lens.Lens' FileSystemDataSource FileSystemAccessMode
fileSystemDataSource_fileSystemAccessMode :: (FileSystemAccessMode -> f FileSystemAccessMode)
-> FileSystemDataSource -> f FileSystemDataSource
fileSystemDataSource_fileSystemAccessMode = (FileSystemDataSource -> FileSystemAccessMode)
-> (FileSystemDataSource
    -> FileSystemAccessMode -> FileSystemDataSource)
-> Lens
     FileSystemDataSource
     FileSystemDataSource
     FileSystemAccessMode
     FileSystemAccessMode
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FileSystemDataSource' {FileSystemAccessMode
fileSystemAccessMode :: FileSystemAccessMode
$sel:fileSystemAccessMode:FileSystemDataSource' :: FileSystemDataSource -> FileSystemAccessMode
fileSystemAccessMode} -> FileSystemAccessMode
fileSystemAccessMode) (\s :: FileSystemDataSource
s@FileSystemDataSource' {} FileSystemAccessMode
a -> FileSystemDataSource
s {$sel:fileSystemAccessMode:FileSystemDataSource' :: FileSystemAccessMode
fileSystemAccessMode = FileSystemAccessMode
a} :: FileSystemDataSource)

-- | The file system type.
fileSystemDataSource_fileSystemType :: Lens.Lens' FileSystemDataSource FileSystemType
fileSystemDataSource_fileSystemType :: (FileSystemType -> f FileSystemType)
-> FileSystemDataSource -> f FileSystemDataSource
fileSystemDataSource_fileSystemType = (FileSystemDataSource -> FileSystemType)
-> (FileSystemDataSource -> FileSystemType -> FileSystemDataSource)
-> Lens
     FileSystemDataSource
     FileSystemDataSource
     FileSystemType
     FileSystemType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FileSystemDataSource' {FileSystemType
fileSystemType :: FileSystemType
$sel:fileSystemType:FileSystemDataSource' :: FileSystemDataSource -> FileSystemType
fileSystemType} -> FileSystemType
fileSystemType) (\s :: FileSystemDataSource
s@FileSystemDataSource' {} FileSystemType
a -> FileSystemDataSource
s {$sel:fileSystemType:FileSystemDataSource' :: FileSystemType
fileSystemType = FileSystemType
a} :: FileSystemDataSource)

-- | The full path to the directory to associate with the channel.
fileSystemDataSource_directoryPath :: Lens.Lens' FileSystemDataSource Prelude.Text
fileSystemDataSource_directoryPath :: (Text -> f Text) -> FileSystemDataSource -> f FileSystemDataSource
fileSystemDataSource_directoryPath = (FileSystemDataSource -> Text)
-> (FileSystemDataSource -> Text -> FileSystemDataSource)
-> Lens FileSystemDataSource FileSystemDataSource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FileSystemDataSource' {Text
directoryPath :: Text
$sel:directoryPath:FileSystemDataSource' :: FileSystemDataSource -> Text
directoryPath} -> Text
directoryPath) (\s :: FileSystemDataSource
s@FileSystemDataSource' {} Text
a -> FileSystemDataSource
s {$sel:directoryPath:FileSystemDataSource' :: Text
directoryPath = Text
a} :: FileSystemDataSource)

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

instance Prelude.Hashable FileSystemDataSource

instance Prelude.NFData FileSystemDataSource

instance Core.ToJSON FileSystemDataSource where
  toJSON :: FileSystemDataSource -> Value
toJSON FileSystemDataSource' {Text
FileSystemAccessMode
FileSystemType
directoryPath :: Text
fileSystemType :: FileSystemType
fileSystemAccessMode :: FileSystemAccessMode
fileSystemId :: Text
$sel:directoryPath:FileSystemDataSource' :: FileSystemDataSource -> Text
$sel:fileSystemType:FileSystemDataSource' :: FileSystemDataSource -> FileSystemType
$sel:fileSystemAccessMode:FileSystemDataSource' :: FileSystemDataSource -> FileSystemAccessMode
$sel:fileSystemId:FileSystemDataSource' :: FileSystemDataSource -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"FileSystemId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
fileSystemId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"FileSystemAccessMode"
                  Text -> FileSystemAccessMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= FileSystemAccessMode
fileSystemAccessMode
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"FileSystemType" Text -> FileSystemType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= FileSystemType
fileSystemType),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"DirectoryPath" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
directoryPath)
          ]
      )