{-# 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.Transfer.Types.PosixProfile 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
data PosixProfile = PosixProfile'
{
PosixProfile -> Maybe [Natural]
secondaryGids :: Prelude.Maybe [Prelude.Natural],
PosixProfile -> Natural
uid :: Prelude.Natural,
PosixProfile -> Natural
gid :: Prelude.Natural
}
deriving (PosixProfile -> PosixProfile -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PosixProfile -> PosixProfile -> Bool
$c/= :: PosixProfile -> PosixProfile -> Bool
== :: PosixProfile -> PosixProfile -> Bool
$c== :: PosixProfile -> PosixProfile -> Bool
Prelude.Eq, ReadPrec [PosixProfile]
ReadPrec PosixProfile
Int -> ReadS PosixProfile
ReadS [PosixProfile]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PosixProfile]
$creadListPrec :: ReadPrec [PosixProfile]
readPrec :: ReadPrec PosixProfile
$creadPrec :: ReadPrec PosixProfile
readList :: ReadS [PosixProfile]
$creadList :: ReadS [PosixProfile]
readsPrec :: Int -> ReadS PosixProfile
$creadsPrec :: Int -> ReadS PosixProfile
Prelude.Read, Int -> PosixProfile -> ShowS
[PosixProfile] -> ShowS
PosixProfile -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PosixProfile] -> ShowS
$cshowList :: [PosixProfile] -> ShowS
show :: PosixProfile -> String
$cshow :: PosixProfile -> String
showsPrec :: Int -> PosixProfile -> ShowS
$cshowsPrec :: Int -> PosixProfile -> ShowS
Prelude.Show, forall x. Rep PosixProfile x -> PosixProfile
forall x. PosixProfile -> Rep PosixProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PosixProfile x -> PosixProfile
$cfrom :: forall x. PosixProfile -> Rep PosixProfile x
Prelude.Generic)
newPosixProfile ::
Prelude.Natural ->
Prelude.Natural ->
PosixProfile
newPosixProfile :: Natural -> Natural -> PosixProfile
newPosixProfile Natural
pUid_ Natural
pGid_ =
PosixProfile'
{ $sel:secondaryGids:PosixProfile' :: Maybe [Natural]
secondaryGids = forall a. Maybe a
Prelude.Nothing,
$sel:uid:PosixProfile' :: Natural
uid = Natural
pUid_,
$sel:gid:PosixProfile' :: Natural
gid = Natural
pGid_
}
posixProfile_secondaryGids :: Lens.Lens' PosixProfile (Prelude.Maybe [Prelude.Natural])
posixProfile_secondaryGids :: Lens' PosixProfile (Maybe [Natural])
posixProfile_secondaryGids = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PosixProfile' {Maybe [Natural]
secondaryGids :: Maybe [Natural]
$sel:secondaryGids:PosixProfile' :: PosixProfile -> Maybe [Natural]
secondaryGids} -> Maybe [Natural]
secondaryGids) (\s :: PosixProfile
s@PosixProfile' {} Maybe [Natural]
a -> PosixProfile
s {$sel:secondaryGids:PosixProfile' :: Maybe [Natural]
secondaryGids = Maybe [Natural]
a} :: PosixProfile) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
posixProfile_uid :: Lens.Lens' PosixProfile Prelude.Natural
posixProfile_uid :: Lens' PosixProfile Natural
posixProfile_uid = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PosixProfile' {Natural
uid :: Natural
$sel:uid:PosixProfile' :: PosixProfile -> Natural
uid} -> Natural
uid) (\s :: PosixProfile
s@PosixProfile' {} Natural
a -> PosixProfile
s {$sel:uid:PosixProfile' :: Natural
uid = Natural
a} :: PosixProfile)
posixProfile_gid :: Lens.Lens' PosixProfile Prelude.Natural
posixProfile_gid :: Lens' PosixProfile Natural
posixProfile_gid = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PosixProfile' {Natural
gid :: Natural
$sel:gid:PosixProfile' :: PosixProfile -> Natural
gid} -> Natural
gid) (\s :: PosixProfile
s@PosixProfile' {} Natural
a -> PosixProfile
s {$sel:gid:PosixProfile' :: Natural
gid = Natural
a} :: PosixProfile)
instance Data.FromJSON PosixProfile where
parseJSON :: Value -> Parser PosixProfile
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"PosixProfile"
( \Object
x ->
Maybe [Natural] -> Natural -> Natural -> PosixProfile
PosixProfile'
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
"SecondaryGids" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
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
"Uid")
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
"Gid")
)
instance Prelude.Hashable PosixProfile where
hashWithSalt :: Int -> PosixProfile -> Int
hashWithSalt Int
_salt PosixProfile' {Natural
Maybe [Natural]
gid :: Natural
uid :: Natural
secondaryGids :: Maybe [Natural]
$sel:gid:PosixProfile' :: PosixProfile -> Natural
$sel:uid:PosixProfile' :: PosixProfile -> Natural
$sel:secondaryGids:PosixProfile' :: PosixProfile -> Maybe [Natural]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Natural]
secondaryGids
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
uid
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
gid
instance Prelude.NFData PosixProfile where
rnf :: PosixProfile -> ()
rnf PosixProfile' {Natural
Maybe [Natural]
gid :: Natural
uid :: Natural
secondaryGids :: Maybe [Natural]
$sel:gid:PosixProfile' :: PosixProfile -> Natural
$sel:uid:PosixProfile' :: PosixProfile -> Natural
$sel:secondaryGids:PosixProfile' :: PosixProfile -> Maybe [Natural]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Natural]
secondaryGids
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
uid
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
gid
instance Data.ToJSON PosixProfile where
toJSON :: PosixProfile -> Value
toJSON PosixProfile' {Natural
Maybe [Natural]
gid :: Natural
uid :: Natural
secondaryGids :: Maybe [Natural]
$sel:gid:PosixProfile' :: PosixProfile -> Natural
$sel:uid:PosixProfile' :: PosixProfile -> Natural
$sel:secondaryGids:PosixProfile' :: PosixProfile -> Maybe [Natural]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"SecondaryGids" 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 [Natural]
secondaryGids,
forall a. a -> Maybe a
Prelude.Just (Key
"Uid" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
uid),
forall a. a -> Maybe a
Prelude.Just (Key
"Gid" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
gid)
]
)