{-# 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-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.FileSystemDataSource 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.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
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]
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
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. 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'
      { $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 :: Lens' FileSystemDataSource Text
fileSystemDataSource_fileSystemId = 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 :: Lens' FileSystemDataSource FileSystemAccessMode
fileSystemDataSource_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 :: Lens' FileSystemDataSource FileSystemType
fileSystemDataSource_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 :: Lens' FileSystemDataSource Text
fileSystemDataSource_directoryPath = 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 Data.FromJSON FileSystemDataSource where
  parseJSON :: Value -> Parser FileSystemDataSource
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FileSystemDataSource"
      ( \Object
x ->
          Text
-> FileSystemAccessMode
-> FileSystemType
-> Text
-> FileSystemDataSource
FileSystemDataSource'
            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
"FileSystemId")
            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
"FileSystemAccessMode")
            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
"FileSystemType")
            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
"DirectoryPath")
      )

instance Prelude.Hashable FileSystemDataSource where
  hashWithSalt :: Int -> FileSystemDataSource -> Int
hashWithSalt Int
_salt 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
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
fileSystemId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` FileSystemAccessMode
fileSystemAccessMode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` FileSystemType
fileSystemType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
directoryPath

instance Prelude.NFData FileSystemDataSource where
  rnf :: FileSystemDataSource -> ()
rnf 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
..} =
    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 FileSystemAccessMode
fileSystemAccessMode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf FileSystemType
fileSystemType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
directoryPath

instance Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"FileSystemId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
fileSystemId),
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"FileSystemAccessMode"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= FileSystemAccessMode
fileSystemAccessMode
              ),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"FileSystemType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= FileSystemType
fileSystemType),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"DirectoryPath" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
directoryPath)
          ]
      )