{-# 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.AppStream.Types.UserSetting where
import Amazonka.AppStream.Types.Action
import Amazonka.AppStream.Types.Permission
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 UserSetting = UserSetting'
{
UserSetting -> Action
action :: Action,
UserSetting -> Permission
permission :: Permission
}
deriving (UserSetting -> UserSetting -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UserSetting -> UserSetting -> Bool
$c/= :: UserSetting -> UserSetting -> Bool
== :: UserSetting -> UserSetting -> Bool
$c== :: UserSetting -> UserSetting -> Bool
Prelude.Eq, ReadPrec [UserSetting]
ReadPrec UserSetting
Int -> ReadS UserSetting
ReadS [UserSetting]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UserSetting]
$creadListPrec :: ReadPrec [UserSetting]
readPrec :: ReadPrec UserSetting
$creadPrec :: ReadPrec UserSetting
readList :: ReadS [UserSetting]
$creadList :: ReadS [UserSetting]
readsPrec :: Int -> ReadS UserSetting
$creadsPrec :: Int -> ReadS UserSetting
Prelude.Read, Int -> UserSetting -> ShowS
[UserSetting] -> ShowS
UserSetting -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UserSetting] -> ShowS
$cshowList :: [UserSetting] -> ShowS
show :: UserSetting -> String
$cshow :: UserSetting -> String
showsPrec :: Int -> UserSetting -> ShowS
$cshowsPrec :: Int -> UserSetting -> ShowS
Prelude.Show, forall x. Rep UserSetting x -> UserSetting
forall x. UserSetting -> Rep UserSetting x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UserSetting x -> UserSetting
$cfrom :: forall x. UserSetting -> Rep UserSetting x
Prelude.Generic)
newUserSetting ::
Action ->
Permission ->
UserSetting
newUserSetting :: Action -> Permission -> UserSetting
newUserSetting Action
pAction_ Permission
pPermission_ =
UserSetting'
{ $sel:action:UserSetting' :: Action
action = Action
pAction_,
$sel:permission:UserSetting' :: Permission
permission = Permission
pPermission_
}
userSetting_action :: Lens.Lens' UserSetting Action
userSetting_action :: Lens' UserSetting Action
userSetting_action = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserSetting' {Action
action :: Action
$sel:action:UserSetting' :: UserSetting -> Action
action} -> Action
action) (\s :: UserSetting
s@UserSetting' {} Action
a -> UserSetting
s {$sel:action:UserSetting' :: Action
action = Action
a} :: UserSetting)
userSetting_permission :: Lens.Lens' UserSetting Permission
userSetting_permission :: Lens' UserSetting Permission
userSetting_permission = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserSetting' {Permission
permission :: Permission
$sel:permission:UserSetting' :: UserSetting -> Permission
permission} -> Permission
permission) (\s :: UserSetting
s@UserSetting' {} Permission
a -> UserSetting
s {$sel:permission:UserSetting' :: Permission
permission = Permission
a} :: UserSetting)
instance Data.FromJSON UserSetting where
parseJSON :: Value -> Parser UserSetting
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"UserSetting"
( \Object
x ->
Action -> Permission -> UserSetting
UserSetting'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Action")
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
"Permission")
)
instance Prelude.Hashable UserSetting where
hashWithSalt :: Int -> UserSetting -> Int
hashWithSalt Int
_salt UserSetting' {Action
Permission
permission :: Permission
action :: Action
$sel:permission:UserSetting' :: UserSetting -> Permission
$sel:action:UserSetting' :: UserSetting -> Action
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Action
action
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Permission
permission
instance Prelude.NFData UserSetting where
rnf :: UserSetting -> ()
rnf UserSetting' {Action
Permission
permission :: Permission
action :: Action
$sel:permission:UserSetting' :: UserSetting -> Permission
$sel:action:UserSetting' :: UserSetting -> Action
..} =
forall a. NFData a => a -> ()
Prelude.rnf Action
action
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Permission
permission
instance Data.ToJSON UserSetting where
toJSON :: UserSetting -> Value
toJSON UserSetting' {Action
Permission
permission :: Permission
action :: Action
$sel:permission:UserSetting' :: UserSetting -> Permission
$sel:action:UserSetting' :: UserSetting -> Action
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"Action" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Action
action),
forall a. a -> Maybe a
Prelude.Just (Key
"Permission" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Permission
permission)
]
)