{-# 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.ElasticTranscoder.Types.Permission where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Permission = Permission'
{
Permission -> Maybe [Text]
access :: Prelude.Maybe [Prelude.Text],
Permission -> Maybe Text
granteeType :: Prelude.Maybe Prelude.Text,
Permission -> Maybe Text
grantee :: Prelude.Maybe Prelude.Text
}
deriving (Permission -> Permission -> Bool
(Permission -> Permission -> Bool)
-> (Permission -> Permission -> Bool) -> Eq Permission
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Permission -> Permission -> Bool
$c/= :: Permission -> Permission -> Bool
== :: Permission -> Permission -> Bool
$c== :: Permission -> Permission -> Bool
Prelude.Eq, ReadPrec [Permission]
ReadPrec Permission
Int -> ReadS Permission
ReadS [Permission]
(Int -> ReadS Permission)
-> ReadS [Permission]
-> ReadPrec Permission
-> ReadPrec [Permission]
-> Read Permission
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Permission]
$creadListPrec :: ReadPrec [Permission]
readPrec :: ReadPrec Permission
$creadPrec :: ReadPrec Permission
readList :: ReadS [Permission]
$creadList :: ReadS [Permission]
readsPrec :: Int -> ReadS Permission
$creadsPrec :: Int -> ReadS Permission
Prelude.Read, Int -> Permission -> ShowS
[Permission] -> ShowS
Permission -> String
(Int -> Permission -> ShowS)
-> (Permission -> String)
-> ([Permission] -> ShowS)
-> Show Permission
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Permission] -> ShowS
$cshowList :: [Permission] -> ShowS
show :: Permission -> String
$cshow :: Permission -> String
showsPrec :: Int -> Permission -> ShowS
$cshowsPrec :: Int -> Permission -> ShowS
Prelude.Show, (forall x. Permission -> Rep Permission x)
-> (forall x. Rep Permission x -> Permission) -> Generic Permission
forall x. Rep Permission x -> Permission
forall x. Permission -> Rep Permission x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Permission x -> Permission
$cfrom :: forall x. Permission -> Rep Permission x
Prelude.Generic)
newPermission ::
Permission
newPermission :: Permission
newPermission =
Permission' :: Maybe [Text] -> Maybe Text -> Maybe Text -> Permission
Permission'
{ $sel:access:Permission' :: Maybe [Text]
access = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:granteeType:Permission' :: Maybe Text
granteeType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:grantee:Permission' :: Maybe Text
grantee = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
permission_access :: Lens.Lens' Permission (Prelude.Maybe [Prelude.Text])
permission_access :: (Maybe [Text] -> f (Maybe [Text])) -> Permission -> f Permission
permission_access = (Permission -> Maybe [Text])
-> (Permission -> Maybe [Text] -> Permission)
-> Lens Permission Permission (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Permission' {Maybe [Text]
access :: Maybe [Text]
$sel:access:Permission' :: Permission -> Maybe [Text]
access} -> Maybe [Text]
access) (\s :: Permission
s@Permission' {} Maybe [Text]
a -> Permission
s {$sel:access:Permission' :: Maybe [Text]
access = Maybe [Text]
a} :: Permission) ((Maybe [Text] -> f (Maybe [Text])) -> Permission -> f Permission)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Permission
-> f Permission
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
permission_granteeType :: Lens.Lens' Permission (Prelude.Maybe Prelude.Text)
permission_granteeType :: (Maybe Text -> f (Maybe Text)) -> Permission -> f Permission
permission_granteeType = (Permission -> Maybe Text)
-> (Permission -> Maybe Text -> Permission)
-> Lens Permission Permission (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Permission' {Maybe Text
granteeType :: Maybe Text
$sel:granteeType:Permission' :: Permission -> Maybe Text
granteeType} -> Maybe Text
granteeType) (\s :: Permission
s@Permission' {} Maybe Text
a -> Permission
s {$sel:granteeType:Permission' :: Maybe Text
granteeType = Maybe Text
a} :: Permission)
permission_grantee :: Lens.Lens' Permission (Prelude.Maybe Prelude.Text)
permission_grantee :: (Maybe Text -> f (Maybe Text)) -> Permission -> f Permission
permission_grantee = (Permission -> Maybe Text)
-> (Permission -> Maybe Text -> Permission)
-> Lens Permission Permission (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Permission' {Maybe Text
grantee :: Maybe Text
$sel:grantee:Permission' :: Permission -> Maybe Text
grantee} -> Maybe Text
grantee) (\s :: Permission
s@Permission' {} Maybe Text
a -> Permission
s {$sel:grantee:Permission' :: Maybe Text
grantee = Maybe Text
a} :: Permission)
instance Core.FromJSON Permission where
parseJSON :: Value -> Parser Permission
parseJSON =
String
-> (Object -> Parser Permission) -> Value -> Parser Permission
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Permission"
( \Object
x ->
Maybe [Text] -> Maybe Text -> Maybe Text -> Permission
Permission'
(Maybe [Text] -> Maybe Text -> Maybe Text -> Permission)
-> Parser (Maybe [Text])
-> Parser (Maybe Text -> Maybe Text -> Permission)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Access" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe Text -> Maybe Text -> Permission)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Permission)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"GranteeType")
Parser (Maybe Text -> Permission)
-> Parser (Maybe Text) -> Parser Permission
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Grantee")
)
instance Prelude.Hashable Permission
instance Prelude.NFData Permission
instance Core.ToJSON Permission where
toJSON :: Permission -> Value
toJSON Permission' {Maybe [Text]
Maybe Text
grantee :: Maybe Text
granteeType :: Maybe Text
access :: Maybe [Text]
$sel:grantee:Permission' :: Permission -> Maybe Text
$sel:granteeType:Permission' :: Permission -> Maybe Text
$sel:access:Permission' :: Permission -> Maybe [Text]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Access" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
access,
(Text
"GranteeType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
granteeType,
(Text
"Grantee" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
grantee
]
)