{-# 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.EFS.Types.PosixUser 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 PosixUser = PosixUser'
{
PosixUser -> Maybe [Natural]
secondaryGids :: Prelude.Maybe [Prelude.Natural],
PosixUser -> Natural
uid :: Prelude.Natural,
PosixUser -> Natural
gid :: Prelude.Natural
}
deriving (PosixUser -> PosixUser -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PosixUser -> PosixUser -> Bool
$c/= :: PosixUser -> PosixUser -> Bool
== :: PosixUser -> PosixUser -> Bool
$c== :: PosixUser -> PosixUser -> Bool
Prelude.Eq, ReadPrec [PosixUser]
ReadPrec PosixUser
Int -> ReadS PosixUser
ReadS [PosixUser]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PosixUser]
$creadListPrec :: ReadPrec [PosixUser]
readPrec :: ReadPrec PosixUser
$creadPrec :: ReadPrec PosixUser
readList :: ReadS [PosixUser]
$creadList :: ReadS [PosixUser]
readsPrec :: Int -> ReadS PosixUser
$creadsPrec :: Int -> ReadS PosixUser
Prelude.Read, Int -> PosixUser -> ShowS
[PosixUser] -> ShowS
PosixUser -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PosixUser] -> ShowS
$cshowList :: [PosixUser] -> ShowS
show :: PosixUser -> String
$cshow :: PosixUser -> String
showsPrec :: Int -> PosixUser -> ShowS
$cshowsPrec :: Int -> PosixUser -> ShowS
Prelude.Show, forall x. Rep PosixUser x -> PosixUser
forall x. PosixUser -> Rep PosixUser x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PosixUser x -> PosixUser
$cfrom :: forall x. PosixUser -> Rep PosixUser x
Prelude.Generic)
newPosixUser ::
Prelude.Natural ->
Prelude.Natural ->
PosixUser
newPosixUser :: Natural -> Natural -> PosixUser
newPosixUser Natural
pUid_ Natural
pGid_ =
PosixUser'
{ $sel:secondaryGids:PosixUser' :: Maybe [Natural]
secondaryGids = forall a. Maybe a
Prelude.Nothing,
$sel:uid:PosixUser' :: Natural
uid = Natural
pUid_,
$sel:gid:PosixUser' :: Natural
gid = Natural
pGid_
}
posixUser_secondaryGids :: Lens.Lens' PosixUser (Prelude.Maybe [Prelude.Natural])
posixUser_secondaryGids :: Lens' PosixUser (Maybe [Natural])
posixUser_secondaryGids = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PosixUser' {Maybe [Natural]
secondaryGids :: Maybe [Natural]
$sel:secondaryGids:PosixUser' :: PosixUser -> Maybe [Natural]
secondaryGids} -> Maybe [Natural]
secondaryGids) (\s :: PosixUser
s@PosixUser' {} Maybe [Natural]
a -> PosixUser
s {$sel:secondaryGids:PosixUser' :: Maybe [Natural]
secondaryGids = Maybe [Natural]
a} :: PosixUser) 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
posixUser_uid :: Lens.Lens' PosixUser Prelude.Natural
posixUser_uid :: Lens' PosixUser Natural
posixUser_uid = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PosixUser' {Natural
uid :: Natural
$sel:uid:PosixUser' :: PosixUser -> Natural
uid} -> Natural
uid) (\s :: PosixUser
s@PosixUser' {} Natural
a -> PosixUser
s {$sel:uid:PosixUser' :: Natural
uid = Natural
a} :: PosixUser)
posixUser_gid :: Lens.Lens' PosixUser Prelude.Natural
posixUser_gid :: Lens' PosixUser Natural
posixUser_gid = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PosixUser' {Natural
gid :: Natural
$sel:gid:PosixUser' :: PosixUser -> Natural
gid} -> Natural
gid) (\s :: PosixUser
s@PosixUser' {} Natural
a -> PosixUser
s {$sel:gid:PosixUser' :: Natural
gid = Natural
a} :: PosixUser)
instance Data.FromJSON PosixUser where
parseJSON :: Value -> Parser PosixUser
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"PosixUser"
( \Object
x ->
Maybe [Natural] -> Natural -> Natural -> PosixUser
PosixUser'
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 PosixUser where
hashWithSalt :: Int -> PosixUser -> Int
hashWithSalt Int
_salt PosixUser' {Natural
Maybe [Natural]
gid :: Natural
uid :: Natural
secondaryGids :: Maybe [Natural]
$sel:gid:PosixUser' :: PosixUser -> Natural
$sel:uid:PosixUser' :: PosixUser -> Natural
$sel:secondaryGids:PosixUser' :: PosixUser -> 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 PosixUser where
rnf :: PosixUser -> ()
rnf PosixUser' {Natural
Maybe [Natural]
gid :: Natural
uid :: Natural
secondaryGids :: Maybe [Natural]
$sel:gid:PosixUser' :: PosixUser -> Natural
$sel:uid:PosixUser' :: PosixUser -> Natural
$sel:secondaryGids:PosixUser' :: PosixUser -> 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 PosixUser where
toJSON :: PosixUser -> Value
toJSON PosixUser' {Natural
Maybe [Natural]
gid :: Natural
uid :: Natural
secondaryGids :: Maybe [Natural]
$sel:gid:PosixUser' :: PosixUser -> Natural
$sel:uid:PosixUser' :: PosixUser -> Natural
$sel:secondaryGids:PosixUser' :: PosixUser -> 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)
]
)