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

import qualified Amazonka.Core as Core
import Amazonka.DataSync.Types.SmbVersion
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents the mount options that are available for DataSync to access
-- an SMB location.
--
-- /See:/ 'newSmbMountOptions' smart constructor.
data SmbMountOptions = SmbMountOptions'
  { -- | The specific SMB version that you want DataSync to use to mount your SMB
    -- share. If you don\'t specify a version, DataSync defaults to
    -- @AUTOMATIC@. That is, DataSync automatically selects a version based on
    -- negotiation with the SMB server.
    SmbMountOptions -> Maybe SmbVersion
version :: Prelude.Maybe SmbVersion
  }
  deriving (SmbMountOptions -> SmbMountOptions -> Bool
(SmbMountOptions -> SmbMountOptions -> Bool)
-> (SmbMountOptions -> SmbMountOptions -> Bool)
-> Eq SmbMountOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SmbMountOptions -> SmbMountOptions -> Bool
$c/= :: SmbMountOptions -> SmbMountOptions -> Bool
== :: SmbMountOptions -> SmbMountOptions -> Bool
$c== :: SmbMountOptions -> SmbMountOptions -> Bool
Prelude.Eq, ReadPrec [SmbMountOptions]
ReadPrec SmbMountOptions
Int -> ReadS SmbMountOptions
ReadS [SmbMountOptions]
(Int -> ReadS SmbMountOptions)
-> ReadS [SmbMountOptions]
-> ReadPrec SmbMountOptions
-> ReadPrec [SmbMountOptions]
-> Read SmbMountOptions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SmbMountOptions]
$creadListPrec :: ReadPrec [SmbMountOptions]
readPrec :: ReadPrec SmbMountOptions
$creadPrec :: ReadPrec SmbMountOptions
readList :: ReadS [SmbMountOptions]
$creadList :: ReadS [SmbMountOptions]
readsPrec :: Int -> ReadS SmbMountOptions
$creadsPrec :: Int -> ReadS SmbMountOptions
Prelude.Read, Int -> SmbMountOptions -> ShowS
[SmbMountOptions] -> ShowS
SmbMountOptions -> String
(Int -> SmbMountOptions -> ShowS)
-> (SmbMountOptions -> String)
-> ([SmbMountOptions] -> ShowS)
-> Show SmbMountOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SmbMountOptions] -> ShowS
$cshowList :: [SmbMountOptions] -> ShowS
show :: SmbMountOptions -> String
$cshow :: SmbMountOptions -> String
showsPrec :: Int -> SmbMountOptions -> ShowS
$cshowsPrec :: Int -> SmbMountOptions -> ShowS
Prelude.Show, (forall x. SmbMountOptions -> Rep SmbMountOptions x)
-> (forall x. Rep SmbMountOptions x -> SmbMountOptions)
-> Generic SmbMountOptions
forall x. Rep SmbMountOptions x -> SmbMountOptions
forall x. SmbMountOptions -> Rep SmbMountOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SmbMountOptions x -> SmbMountOptions
$cfrom :: forall x. SmbMountOptions -> Rep SmbMountOptions x
Prelude.Generic)

-- |
-- Create a value of 'SmbMountOptions' 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', 'smbMountOptions_version' - The specific SMB version that you want DataSync to use to mount your SMB
-- share. If you don\'t specify a version, DataSync defaults to
-- @AUTOMATIC@. That is, DataSync automatically selects a version based on
-- negotiation with the SMB server.
newSmbMountOptions ::
  SmbMountOptions
newSmbMountOptions :: SmbMountOptions
newSmbMountOptions =
  SmbMountOptions' :: Maybe SmbVersion -> SmbMountOptions
SmbMountOptions' {$sel:version:SmbMountOptions' :: Maybe SmbVersion
version = Maybe SmbVersion
forall a. Maybe a
Prelude.Nothing}

-- | The specific SMB version that you want DataSync to use to mount your SMB
-- share. If you don\'t specify a version, DataSync defaults to
-- @AUTOMATIC@. That is, DataSync automatically selects a version based on
-- negotiation with the SMB server.
smbMountOptions_version :: Lens.Lens' SmbMountOptions (Prelude.Maybe SmbVersion)
smbMountOptions_version :: (Maybe SmbVersion -> f (Maybe SmbVersion))
-> SmbMountOptions -> f SmbMountOptions
smbMountOptions_version = (SmbMountOptions -> Maybe SmbVersion)
-> (SmbMountOptions -> Maybe SmbVersion -> SmbMountOptions)
-> Lens
     SmbMountOptions
     SmbMountOptions
     (Maybe SmbVersion)
     (Maybe SmbVersion)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SmbMountOptions' {Maybe SmbVersion
version :: Maybe SmbVersion
$sel:version:SmbMountOptions' :: SmbMountOptions -> Maybe SmbVersion
version} -> Maybe SmbVersion
version) (\s :: SmbMountOptions
s@SmbMountOptions' {} Maybe SmbVersion
a -> SmbMountOptions
s {$sel:version:SmbMountOptions' :: Maybe SmbVersion
version = Maybe SmbVersion
a} :: SmbMountOptions)

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

instance Prelude.Hashable SmbMountOptions

instance Prelude.NFData SmbMountOptions

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