{-# 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.DataSync.Types.NfsMountOptions
-- 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.DataSync.Types.NfsMountOptions where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DataSync.Types.NfsVersion
import qualified Amazonka.Prelude as Prelude

-- | Specifies how DataSync can access a location using the NFS protocol.
--
-- /See:/ 'newNfsMountOptions' smart constructor.
data NfsMountOptions = NfsMountOptions'
  { -- | Specifies the NFS version that you want DataSync to use when mounting
    -- your NFS share. If the server refuses to use the version specified, the
    -- task fails.
    --
    -- You can specify the following options:
    --
    -- -   @AUTOMATIC@ (default): DataSync chooses NFS version 4.1.
    --
    -- -   @NFS3@: Stateless protocol version that allows for asynchronous
    --     writes on the server.
    --
    -- -   @NFSv4_0@: Stateful, firewall-friendly protocol version that
    --     supports delegations and pseudo file systems.
    --
    -- -   @NFSv4_1@: Stateful protocol version that supports sessions,
    --     directory delegations, and parallel data processing. NFS version 4.1
    --     also includes all features available in version 4.0.
    --
    -- DataSync currently only supports NFS version 3 with Amazon FSx for
    -- NetApp ONTAP locations.
    NfsMountOptions -> Maybe NfsVersion
version :: Prelude.Maybe NfsVersion
  }
  deriving (NfsMountOptions -> NfsMountOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NfsMountOptions -> NfsMountOptions -> Bool
$c/= :: NfsMountOptions -> NfsMountOptions -> Bool
== :: NfsMountOptions -> NfsMountOptions -> Bool
$c== :: NfsMountOptions -> NfsMountOptions -> Bool
Prelude.Eq, ReadPrec [NfsMountOptions]
ReadPrec NfsMountOptions
Int -> ReadS NfsMountOptions
ReadS [NfsMountOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NfsMountOptions]
$creadListPrec :: ReadPrec [NfsMountOptions]
readPrec :: ReadPrec NfsMountOptions
$creadPrec :: ReadPrec NfsMountOptions
readList :: ReadS [NfsMountOptions]
$creadList :: ReadS [NfsMountOptions]
readsPrec :: Int -> ReadS NfsMountOptions
$creadsPrec :: Int -> ReadS NfsMountOptions
Prelude.Read, Int -> NfsMountOptions -> ShowS
[NfsMountOptions] -> ShowS
NfsMountOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NfsMountOptions] -> ShowS
$cshowList :: [NfsMountOptions] -> ShowS
show :: NfsMountOptions -> String
$cshow :: NfsMountOptions -> String
showsPrec :: Int -> NfsMountOptions -> ShowS
$cshowsPrec :: Int -> NfsMountOptions -> ShowS
Prelude.Show, forall x. Rep NfsMountOptions x -> NfsMountOptions
forall x. NfsMountOptions -> Rep NfsMountOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NfsMountOptions x -> NfsMountOptions
$cfrom :: forall x. NfsMountOptions -> Rep NfsMountOptions x
Prelude.Generic)

-- |
-- Create a value of 'NfsMountOptions' 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:
--
-- 'version', 'nfsMountOptions_version' - Specifies the NFS version that you want DataSync to use when mounting
-- your NFS share. If the server refuses to use the version specified, the
-- task fails.
--
-- You can specify the following options:
--
-- -   @AUTOMATIC@ (default): DataSync chooses NFS version 4.1.
--
-- -   @NFS3@: Stateless protocol version that allows for asynchronous
--     writes on the server.
--
-- -   @NFSv4_0@: Stateful, firewall-friendly protocol version that
--     supports delegations and pseudo file systems.
--
-- -   @NFSv4_1@: Stateful protocol version that supports sessions,
--     directory delegations, and parallel data processing. NFS version 4.1
--     also includes all features available in version 4.0.
--
-- DataSync currently only supports NFS version 3 with Amazon FSx for
-- NetApp ONTAP locations.
newNfsMountOptions ::
  NfsMountOptions
newNfsMountOptions :: NfsMountOptions
newNfsMountOptions =
  NfsMountOptions' {$sel:version:NfsMountOptions' :: Maybe NfsVersion
version = forall a. Maybe a
Prelude.Nothing}

-- | Specifies the NFS version that you want DataSync to use when mounting
-- your NFS share. If the server refuses to use the version specified, the
-- task fails.
--
-- You can specify the following options:
--
-- -   @AUTOMATIC@ (default): DataSync chooses NFS version 4.1.
--
-- -   @NFS3@: Stateless protocol version that allows for asynchronous
--     writes on the server.
--
-- -   @NFSv4_0@: Stateful, firewall-friendly protocol version that
--     supports delegations and pseudo file systems.
--
-- -   @NFSv4_1@: Stateful protocol version that supports sessions,
--     directory delegations, and parallel data processing. NFS version 4.1
--     also includes all features available in version 4.0.
--
-- DataSync currently only supports NFS version 3 with Amazon FSx for
-- NetApp ONTAP locations.
nfsMountOptions_version :: Lens.Lens' NfsMountOptions (Prelude.Maybe NfsVersion)
nfsMountOptions_version :: Lens' NfsMountOptions (Maybe NfsVersion)
nfsMountOptions_version = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NfsMountOptions' {Maybe NfsVersion
version :: Maybe NfsVersion
$sel:version:NfsMountOptions' :: NfsMountOptions -> Maybe NfsVersion
version} -> Maybe NfsVersion
version) (\s :: NfsMountOptions
s@NfsMountOptions' {} Maybe NfsVersion
a -> NfsMountOptions
s {$sel:version:NfsMountOptions' :: Maybe NfsVersion
version = Maybe NfsVersion
a} :: NfsMountOptions)

instance Data.FromJSON NfsMountOptions where
  parseJSON :: Value -> Parser NfsMountOptions
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"NfsMountOptions"
      ( \Object
x ->
          Maybe NfsVersion -> NfsMountOptions
NfsMountOptions' forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Version")
      )

instance Prelude.Hashable NfsMountOptions where
  hashWithSalt :: Int -> NfsMountOptions -> Int
hashWithSalt Int
_salt NfsMountOptions' {Maybe NfsVersion
version :: Maybe NfsVersion
$sel:version:NfsMountOptions' :: NfsMountOptions -> Maybe NfsVersion
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NfsVersion
version

instance Prelude.NFData NfsMountOptions where
  rnf :: NfsMountOptions -> ()
rnf NfsMountOptions' {Maybe NfsVersion
version :: Maybe NfsVersion
$sel:version:NfsMountOptions' :: NfsMountOptions -> Maybe NfsVersion
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe NfsVersion
version

instance Data.ToJSON NfsMountOptions where
  toJSON :: NfsMountOptions -> Value
toJSON NfsMountOptions' {Maybe NfsVersion
version :: Maybe NfsVersion
$sel:version:NfsMountOptions' :: NfsMountOptions -> Maybe NfsVersion
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"Version" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe NfsVersion
version]
      )