{-# 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.Lens as Lens
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
(PosixUser -> PosixUser -> Bool)
-> (PosixUser -> PosixUser -> Bool) -> Eq PosixUser
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]
(Int -> ReadS PosixUser)
-> ReadS [PosixUser]
-> ReadPrec PosixUser
-> ReadPrec [PosixUser]
-> Read 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
(Int -> PosixUser -> ShowS)
-> (PosixUser -> String)
-> ([PosixUser] -> ShowS)
-> Show PosixUser
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. PosixUser -> Rep PosixUser x)
-> (forall x. Rep PosixUser x -> PosixUser) -> Generic PosixUser
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' :: Maybe [Natural] -> Natural -> Natural -> PosixUser
PosixUser'
{ $sel:secondaryGids:PosixUser' :: Maybe [Natural]
secondaryGids = Maybe [Natural]
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 :: (Maybe [Natural] -> f (Maybe [Natural]))
-> PosixUser -> f PosixUser
posixUser_secondaryGids = (PosixUser -> Maybe [Natural])
-> (PosixUser -> Maybe [Natural] -> PosixUser)
-> Lens PosixUser PosixUser (Maybe [Natural]) (Maybe [Natural])
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) ((Maybe [Natural] -> f (Maybe [Natural]))
-> PosixUser -> f PosixUser)
-> ((Maybe [Natural] -> f (Maybe [Natural]))
-> Maybe [Natural] -> f (Maybe [Natural]))
-> (Maybe [Natural] -> f (Maybe [Natural]))
-> PosixUser
-> f PosixUser
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Natural] [Natural] [Natural] [Natural]
-> Iso
(Maybe [Natural])
(Maybe [Natural])
(Maybe [Natural])
(Maybe [Natural])
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 AnIso [Natural] [Natural] [Natural] [Natural]
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 :: (Natural -> f Natural) -> PosixUser -> f PosixUser
posixUser_uid = (PosixUser -> Natural)
-> (PosixUser -> Natural -> PosixUser)
-> Lens PosixUser PosixUser Natural Natural
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 :: (Natural -> f Natural) -> PosixUser -> f PosixUser
posixUser_gid = (PosixUser -> Natural)
-> (PosixUser -> Natural -> PosixUser)
-> Lens PosixUser PosixUser Natural Natural
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 Core.FromJSON PosixUser where
parseJSON :: Value -> Parser PosixUser
parseJSON =
String -> (Object -> Parser PosixUser) -> Value -> Parser PosixUser
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"PosixUser"
( \Object
x ->
Maybe [Natural] -> Natural -> Natural -> PosixUser
PosixUser'
(Maybe [Natural] -> Natural -> Natural -> PosixUser)
-> Parser (Maybe [Natural])
-> Parser (Natural -> Natural -> PosixUser)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Natural]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SecondaryGids" Parser (Maybe (Maybe [Natural]))
-> Maybe [Natural] -> Parser (Maybe [Natural])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Natural]
forall a. Monoid a => a
Prelude.mempty)
Parser (Natural -> Natural -> PosixUser)
-> Parser Natural -> Parser (Natural -> PosixUser)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Uid")
Parser (Natural -> PosixUser) -> Parser Natural -> Parser PosixUser
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Gid")
)
instance Prelude.Hashable PosixUser
instance Prelude.NFData PosixUser
instance Core.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
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"SecondaryGids" Text -> [Natural] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Natural] -> Pair) -> Maybe [Natural] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Natural]
secondaryGids,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Uid" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
uid),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Gid" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
gid)
]
)