{-# 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.FsxProtocolSmb
-- 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.FsxProtocolSmb 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.SmbMountOptions
import qualified Amazonka.Prelude as Prelude

-- | Specifies the Server Message Block (SMB) protocol configuration that
-- DataSync uses to access your Amazon FSx for NetApp ONTAP file system.
-- For more information, see
-- <https://docs.aws.amazon.com/datasync/latest/userguide/create-ontap-location.html#create-ontap-location-access Accessing FSx for ONTAP file systems>.
--
-- /See:/ 'newFsxProtocolSmb' smart constructor.
data FsxProtocolSmb = FsxProtocolSmb'
  { -- | Specifies the fully qualified domain name (FQDN) of the Microsoft Active
    -- Directory that your storage virtual machine (SVM) belongs to.
    FsxProtocolSmb -> Maybe Text
domain :: Prelude.Maybe Prelude.Text,
    FsxProtocolSmb -> Maybe SmbMountOptions
mountOptions :: Prelude.Maybe SmbMountOptions,
    -- | Specifies the password of a user who has permission to access your SVM.
    FsxProtocolSmb -> Sensitive Text
password :: Data.Sensitive Prelude.Text,
    -- | Specifies a user name that can mount the location and access the files,
    -- folders, and metadata that you need in the SVM.
    --
    -- If you provide a user in your Active Directory, note the following:
    --
    -- -   If you\'re using Directory Service for Microsoft Active Directory,
    --     the user must be a member of the Amazon Web Services Delegated FSx
    --     Administrators group.
    --
    -- -   If you\'re using a self-managed Active Directory, the user must be a
    --     member of either the Domain Admins group or a custom group that you
    --     specified for file system administration when you created your file
    --     system.
    --
    -- Make sure that the user has the permissions it needs to copy the data
    -- you want:
    --
    -- -   @SE_TCB_NAME@: Required to set object ownership and file metadata.
    --     With this privilege, you also can copy NTFS discretionary access
    --     lists (DACLs).
    --
    -- -   @SE_SECURITY_NAME@: May be needed to copy NTFS system access control
    --     lists (SACLs). This operation specifically requires the Windows
    --     privilege, which is granted to members of the Domain Admins group.
    --     If you configure your task to copy SACLs, make sure that the user
    --     has the required privileges. For information about copying SACLs,
    --     see
    --     <https://docs.aws.amazon.com/datasync/latest/userguide/create-task.html#configure-ownership-and-permissions Ownership and permissions-related options>.
    FsxProtocolSmb -> Text
user :: Prelude.Text
  }
  deriving (FsxProtocolSmb -> FsxProtocolSmb -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FsxProtocolSmb -> FsxProtocolSmb -> Bool
$c/= :: FsxProtocolSmb -> FsxProtocolSmb -> Bool
== :: FsxProtocolSmb -> FsxProtocolSmb -> Bool
$c== :: FsxProtocolSmb -> FsxProtocolSmb -> Bool
Prelude.Eq, Int -> FsxProtocolSmb -> ShowS
[FsxProtocolSmb] -> ShowS
FsxProtocolSmb -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FsxProtocolSmb] -> ShowS
$cshowList :: [FsxProtocolSmb] -> ShowS
show :: FsxProtocolSmb -> String
$cshow :: FsxProtocolSmb -> String
showsPrec :: Int -> FsxProtocolSmb -> ShowS
$cshowsPrec :: Int -> FsxProtocolSmb -> ShowS
Prelude.Show, forall x. Rep FsxProtocolSmb x -> FsxProtocolSmb
forall x. FsxProtocolSmb -> Rep FsxProtocolSmb x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FsxProtocolSmb x -> FsxProtocolSmb
$cfrom :: forall x. FsxProtocolSmb -> Rep FsxProtocolSmb x
Prelude.Generic)

-- |
-- Create a value of 'FsxProtocolSmb' 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:
--
-- 'domain', 'fsxProtocolSmb_domain' - Specifies the fully qualified domain name (FQDN) of the Microsoft Active
-- Directory that your storage virtual machine (SVM) belongs to.
--
-- 'mountOptions', 'fsxProtocolSmb_mountOptions' - Undocumented member.
--
-- 'password', 'fsxProtocolSmb_password' - Specifies the password of a user who has permission to access your SVM.
--
-- 'user', 'fsxProtocolSmb_user' - Specifies a user name that can mount the location and access the files,
-- folders, and metadata that you need in the SVM.
--
-- If you provide a user in your Active Directory, note the following:
--
-- -   If you\'re using Directory Service for Microsoft Active Directory,
--     the user must be a member of the Amazon Web Services Delegated FSx
--     Administrators group.
--
-- -   If you\'re using a self-managed Active Directory, the user must be a
--     member of either the Domain Admins group or a custom group that you
--     specified for file system administration when you created your file
--     system.
--
-- Make sure that the user has the permissions it needs to copy the data
-- you want:
--
-- -   @SE_TCB_NAME@: Required to set object ownership and file metadata.
--     With this privilege, you also can copy NTFS discretionary access
--     lists (DACLs).
--
-- -   @SE_SECURITY_NAME@: May be needed to copy NTFS system access control
--     lists (SACLs). This operation specifically requires the Windows
--     privilege, which is granted to members of the Domain Admins group.
--     If you configure your task to copy SACLs, make sure that the user
--     has the required privileges. For information about copying SACLs,
--     see
--     <https://docs.aws.amazon.com/datasync/latest/userguide/create-task.html#configure-ownership-and-permissions Ownership and permissions-related options>.
newFsxProtocolSmb ::
  -- | 'password'
  Prelude.Text ->
  -- | 'user'
  Prelude.Text ->
  FsxProtocolSmb
newFsxProtocolSmb :: Text -> Text -> FsxProtocolSmb
newFsxProtocolSmb Text
pPassword_ Text
pUser_ =
  FsxProtocolSmb'
    { $sel:domain:FsxProtocolSmb' :: Maybe Text
domain = forall a. Maybe a
Prelude.Nothing,
      $sel:mountOptions:FsxProtocolSmb' :: Maybe SmbMountOptions
mountOptions = forall a. Maybe a
Prelude.Nothing,
      $sel:password:FsxProtocolSmb' :: Sensitive Text
password = forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pPassword_,
      $sel:user:FsxProtocolSmb' :: Text
user = Text
pUser_
    }

-- | Specifies the fully qualified domain name (FQDN) of the Microsoft Active
-- Directory that your storage virtual machine (SVM) belongs to.
fsxProtocolSmb_domain :: Lens.Lens' FsxProtocolSmb (Prelude.Maybe Prelude.Text)
fsxProtocolSmb_domain :: Lens' FsxProtocolSmb (Maybe Text)
fsxProtocolSmb_domain = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FsxProtocolSmb' {Maybe Text
domain :: Maybe Text
$sel:domain:FsxProtocolSmb' :: FsxProtocolSmb -> Maybe Text
domain} -> Maybe Text
domain) (\s :: FsxProtocolSmb
s@FsxProtocolSmb' {} Maybe Text
a -> FsxProtocolSmb
s {$sel:domain:FsxProtocolSmb' :: Maybe Text
domain = Maybe Text
a} :: FsxProtocolSmb)

-- | Undocumented member.
fsxProtocolSmb_mountOptions :: Lens.Lens' FsxProtocolSmb (Prelude.Maybe SmbMountOptions)
fsxProtocolSmb_mountOptions :: Lens' FsxProtocolSmb (Maybe SmbMountOptions)
fsxProtocolSmb_mountOptions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FsxProtocolSmb' {Maybe SmbMountOptions
mountOptions :: Maybe SmbMountOptions
$sel:mountOptions:FsxProtocolSmb' :: FsxProtocolSmb -> Maybe SmbMountOptions
mountOptions} -> Maybe SmbMountOptions
mountOptions) (\s :: FsxProtocolSmb
s@FsxProtocolSmb' {} Maybe SmbMountOptions
a -> FsxProtocolSmb
s {$sel:mountOptions:FsxProtocolSmb' :: Maybe SmbMountOptions
mountOptions = Maybe SmbMountOptions
a} :: FsxProtocolSmb)

-- | Specifies the password of a user who has permission to access your SVM.
fsxProtocolSmb_password :: Lens.Lens' FsxProtocolSmb Prelude.Text
fsxProtocolSmb_password :: Lens' FsxProtocolSmb Text
fsxProtocolSmb_password = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FsxProtocolSmb' {Sensitive Text
password :: Sensitive Text
$sel:password:FsxProtocolSmb' :: FsxProtocolSmb -> Sensitive Text
password} -> Sensitive Text
password) (\s :: FsxProtocolSmb
s@FsxProtocolSmb' {} Sensitive Text
a -> FsxProtocolSmb
s {$sel:password:FsxProtocolSmb' :: Sensitive Text
password = Sensitive Text
a} :: FsxProtocolSmb) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | Specifies a user name that can mount the location and access the files,
-- folders, and metadata that you need in the SVM.
--
-- If you provide a user in your Active Directory, note the following:
--
-- -   If you\'re using Directory Service for Microsoft Active Directory,
--     the user must be a member of the Amazon Web Services Delegated FSx
--     Administrators group.
--
-- -   If you\'re using a self-managed Active Directory, the user must be a
--     member of either the Domain Admins group or a custom group that you
--     specified for file system administration when you created your file
--     system.
--
-- Make sure that the user has the permissions it needs to copy the data
-- you want:
--
-- -   @SE_TCB_NAME@: Required to set object ownership and file metadata.
--     With this privilege, you also can copy NTFS discretionary access
--     lists (DACLs).
--
-- -   @SE_SECURITY_NAME@: May be needed to copy NTFS system access control
--     lists (SACLs). This operation specifically requires the Windows
--     privilege, which is granted to members of the Domain Admins group.
--     If you configure your task to copy SACLs, make sure that the user
--     has the required privileges. For information about copying SACLs,
--     see
--     <https://docs.aws.amazon.com/datasync/latest/userguide/create-task.html#configure-ownership-and-permissions Ownership and permissions-related options>.
fsxProtocolSmb_user :: Lens.Lens' FsxProtocolSmb Prelude.Text
fsxProtocolSmb_user :: Lens' FsxProtocolSmb Text
fsxProtocolSmb_user = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FsxProtocolSmb' {Text
user :: Text
$sel:user:FsxProtocolSmb' :: FsxProtocolSmb -> Text
user} -> Text
user) (\s :: FsxProtocolSmb
s@FsxProtocolSmb' {} Text
a -> FsxProtocolSmb
s {$sel:user:FsxProtocolSmb' :: Text
user = Text
a} :: FsxProtocolSmb)

instance Data.FromJSON FsxProtocolSmb where
  parseJSON :: Value -> Parser FsxProtocolSmb
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FsxProtocolSmb"
      ( \Object
x ->
          Maybe Text
-> Maybe SmbMountOptions
-> Sensitive Text
-> Text
-> FsxProtocolSmb
FsxProtocolSmb'
            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
"Domain")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"MountOptions")
            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
"Password")
            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
"User")
      )

instance Prelude.Hashable FsxProtocolSmb where
  hashWithSalt :: Int -> FsxProtocolSmb -> Int
hashWithSalt Int
_salt FsxProtocolSmb' {Maybe Text
Maybe SmbMountOptions
Text
Sensitive Text
user :: Text
password :: Sensitive Text
mountOptions :: Maybe SmbMountOptions
domain :: Maybe Text
$sel:user:FsxProtocolSmb' :: FsxProtocolSmb -> Text
$sel:password:FsxProtocolSmb' :: FsxProtocolSmb -> Sensitive Text
$sel:mountOptions:FsxProtocolSmb' :: FsxProtocolSmb -> Maybe SmbMountOptions
$sel:domain:FsxProtocolSmb' :: FsxProtocolSmb -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
domain
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SmbMountOptions
mountOptions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
password
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
user

instance Prelude.NFData FsxProtocolSmb where
  rnf :: FsxProtocolSmb -> ()
rnf FsxProtocolSmb' {Maybe Text
Maybe SmbMountOptions
Text
Sensitive Text
user :: Text
password :: Sensitive Text
mountOptions :: Maybe SmbMountOptions
domain :: Maybe Text
$sel:user:FsxProtocolSmb' :: FsxProtocolSmb -> Text
$sel:password:FsxProtocolSmb' :: FsxProtocolSmb -> Sensitive Text
$sel:mountOptions:FsxProtocolSmb' :: FsxProtocolSmb -> Maybe SmbMountOptions
$sel:domain:FsxProtocolSmb' :: FsxProtocolSmb -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
domain
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SmbMountOptions
mountOptions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
password
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
user

instance Data.ToJSON FsxProtocolSmb where
  toJSON :: FsxProtocolSmb -> Value
toJSON FsxProtocolSmb' {Maybe Text
Maybe SmbMountOptions
Text
Sensitive Text
user :: Text
password :: Sensitive Text
mountOptions :: Maybe SmbMountOptions
domain :: Maybe Text
$sel:user:FsxProtocolSmb' :: FsxProtocolSmb -> Text
$sel:password:FsxProtocolSmb' :: FsxProtocolSmb -> Sensitive Text
$sel:mountOptions:FsxProtocolSmb' :: FsxProtocolSmb -> Maybe SmbMountOptions
$sel:domain:FsxProtocolSmb' :: FsxProtocolSmb -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Domain" 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 Text
domain,
            (Key
"MountOptions" 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 SmbMountOptions
mountOptions,
            forall a. a -> Maybe a
Prelude.Just (Key
"Password" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive Text
password),
            forall a. a -> Maybe a
Prelude.Just (Key
"User" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
user)
          ]
      )