{-# 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 #-}
module Amazonka.DataSync.Types.FsxProtocol 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.FsxProtocolNfs
import Amazonka.DataSync.Types.FsxProtocolSmb
import qualified Amazonka.Prelude as Prelude
data FsxProtocol = FsxProtocol'
{
FsxProtocol -> Maybe FsxProtocolNfs
nfs :: Prelude.Maybe FsxProtocolNfs,
FsxProtocol -> Maybe FsxProtocolSmb
smb :: Prelude.Maybe FsxProtocolSmb
}
deriving (FsxProtocol -> FsxProtocol -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FsxProtocol -> FsxProtocol -> Bool
$c/= :: FsxProtocol -> FsxProtocol -> Bool
== :: FsxProtocol -> FsxProtocol -> Bool
$c== :: FsxProtocol -> FsxProtocol -> Bool
Prelude.Eq, Int -> FsxProtocol -> ShowS
[FsxProtocol] -> ShowS
FsxProtocol -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FsxProtocol] -> ShowS
$cshowList :: [FsxProtocol] -> ShowS
show :: FsxProtocol -> String
$cshow :: FsxProtocol -> String
showsPrec :: Int -> FsxProtocol -> ShowS
$cshowsPrec :: Int -> FsxProtocol -> ShowS
Prelude.Show, forall x. Rep FsxProtocol x -> FsxProtocol
forall x. FsxProtocol -> Rep FsxProtocol x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FsxProtocol x -> FsxProtocol
$cfrom :: forall x. FsxProtocol -> Rep FsxProtocol x
Prelude.Generic)
newFsxProtocol ::
FsxProtocol
newFsxProtocol :: FsxProtocol
newFsxProtocol =
FsxProtocol'
{ $sel:nfs:FsxProtocol' :: Maybe FsxProtocolNfs
nfs = forall a. Maybe a
Prelude.Nothing,
$sel:smb:FsxProtocol' :: Maybe FsxProtocolSmb
smb = forall a. Maybe a
Prelude.Nothing
}
fsxProtocol_nfs :: Lens.Lens' FsxProtocol (Prelude.Maybe FsxProtocolNfs)
fsxProtocol_nfs :: Lens' FsxProtocol (Maybe FsxProtocolNfs)
fsxProtocol_nfs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FsxProtocol' {Maybe FsxProtocolNfs
nfs :: Maybe FsxProtocolNfs
$sel:nfs:FsxProtocol' :: FsxProtocol -> Maybe FsxProtocolNfs
nfs} -> Maybe FsxProtocolNfs
nfs) (\s :: FsxProtocol
s@FsxProtocol' {} Maybe FsxProtocolNfs
a -> FsxProtocol
s {$sel:nfs:FsxProtocol' :: Maybe FsxProtocolNfs
nfs = Maybe FsxProtocolNfs
a} :: FsxProtocol)
fsxProtocol_smb :: Lens.Lens' FsxProtocol (Prelude.Maybe FsxProtocolSmb)
fsxProtocol_smb :: Lens' FsxProtocol (Maybe FsxProtocolSmb)
fsxProtocol_smb = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FsxProtocol' {Maybe FsxProtocolSmb
smb :: Maybe FsxProtocolSmb
$sel:smb:FsxProtocol' :: FsxProtocol -> Maybe FsxProtocolSmb
smb} -> Maybe FsxProtocolSmb
smb) (\s :: FsxProtocol
s@FsxProtocol' {} Maybe FsxProtocolSmb
a -> FsxProtocol
s {$sel:smb:FsxProtocol' :: Maybe FsxProtocolSmb
smb = Maybe FsxProtocolSmb
a} :: FsxProtocol)
instance Data.FromJSON FsxProtocol where
parseJSON :: Value -> Parser FsxProtocol
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"FsxProtocol"
( \Object
x ->
Maybe FsxProtocolNfs -> Maybe FsxProtocolSmb -> FsxProtocol
FsxProtocol'
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
"NFS")
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
"SMB")
)
instance Prelude.Hashable FsxProtocol where
hashWithSalt :: Int -> FsxProtocol -> Int
hashWithSalt Int
_salt FsxProtocol' {Maybe FsxProtocolNfs
Maybe FsxProtocolSmb
smb :: Maybe FsxProtocolSmb
nfs :: Maybe FsxProtocolNfs
$sel:smb:FsxProtocol' :: FsxProtocol -> Maybe FsxProtocolSmb
$sel:nfs:FsxProtocol' :: FsxProtocol -> Maybe FsxProtocolNfs
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FsxProtocolNfs
nfs
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FsxProtocolSmb
smb
instance Prelude.NFData FsxProtocol where
rnf :: FsxProtocol -> ()
rnf FsxProtocol' {Maybe FsxProtocolNfs
Maybe FsxProtocolSmb
smb :: Maybe FsxProtocolSmb
nfs :: Maybe FsxProtocolNfs
$sel:smb:FsxProtocol' :: FsxProtocol -> Maybe FsxProtocolSmb
$sel:nfs:FsxProtocol' :: FsxProtocol -> Maybe FsxProtocolNfs
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe FsxProtocolNfs
nfs seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe FsxProtocolSmb
smb
instance Data.ToJSON FsxProtocol where
toJSON :: FsxProtocol -> Value
toJSON FsxProtocol' {Maybe FsxProtocolNfs
Maybe FsxProtocolSmb
smb :: Maybe FsxProtocolSmb
nfs :: Maybe FsxProtocolNfs
$sel:smb:FsxProtocol' :: FsxProtocol -> Maybe FsxProtocolSmb
$sel:nfs:FsxProtocol' :: FsxProtocol -> Maybe FsxProtocolNfs
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"NFS" 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 FsxProtocolNfs
nfs,
(Key
"SMB" 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 FsxProtocolSmb
smb
]
)