{-# 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.CodeCommit.Types.Approval where
import Amazonka.CodeCommit.Types.ApprovalState
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Approval = Approval'
{
Approval -> Maybe ApprovalState
approvalState :: Prelude.Maybe ApprovalState,
Approval -> Maybe Text
userArn :: Prelude.Maybe Prelude.Text
}
deriving (Approval -> Approval -> Bool
(Approval -> Approval -> Bool)
-> (Approval -> Approval -> Bool) -> Eq Approval
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Approval -> Approval -> Bool
$c/= :: Approval -> Approval -> Bool
== :: Approval -> Approval -> Bool
$c== :: Approval -> Approval -> Bool
Prelude.Eq, ReadPrec [Approval]
ReadPrec Approval
Int -> ReadS Approval
ReadS [Approval]
(Int -> ReadS Approval)
-> ReadS [Approval]
-> ReadPrec Approval
-> ReadPrec [Approval]
-> Read Approval
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Approval]
$creadListPrec :: ReadPrec [Approval]
readPrec :: ReadPrec Approval
$creadPrec :: ReadPrec Approval
readList :: ReadS [Approval]
$creadList :: ReadS [Approval]
readsPrec :: Int -> ReadS Approval
$creadsPrec :: Int -> ReadS Approval
Prelude.Read, Int -> Approval -> ShowS
[Approval] -> ShowS
Approval -> String
(Int -> Approval -> ShowS)
-> (Approval -> String) -> ([Approval] -> ShowS) -> Show Approval
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Approval] -> ShowS
$cshowList :: [Approval] -> ShowS
show :: Approval -> String
$cshow :: Approval -> String
showsPrec :: Int -> Approval -> ShowS
$cshowsPrec :: Int -> Approval -> ShowS
Prelude.Show, (forall x. Approval -> Rep Approval x)
-> (forall x. Rep Approval x -> Approval) -> Generic Approval
forall x. Rep Approval x -> Approval
forall x. Approval -> Rep Approval x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Approval x -> Approval
$cfrom :: forall x. Approval -> Rep Approval x
Prelude.Generic)
newApproval ::
Approval
newApproval :: Approval
newApproval =
Approval' :: Maybe ApprovalState -> Maybe Text -> Approval
Approval'
{ $sel:approvalState:Approval' :: Maybe ApprovalState
approvalState = Maybe ApprovalState
forall a. Maybe a
Prelude.Nothing,
$sel:userArn:Approval' :: Maybe Text
userArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
approval_approvalState :: Lens.Lens' Approval (Prelude.Maybe ApprovalState)
approval_approvalState :: (Maybe ApprovalState -> f (Maybe ApprovalState))
-> Approval -> f Approval
approval_approvalState = (Approval -> Maybe ApprovalState)
-> (Approval -> Maybe ApprovalState -> Approval)
-> Lens
Approval Approval (Maybe ApprovalState) (Maybe ApprovalState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Approval' {Maybe ApprovalState
approvalState :: Maybe ApprovalState
$sel:approvalState:Approval' :: Approval -> Maybe ApprovalState
approvalState} -> Maybe ApprovalState
approvalState) (\s :: Approval
s@Approval' {} Maybe ApprovalState
a -> Approval
s {$sel:approvalState:Approval' :: Maybe ApprovalState
approvalState = Maybe ApprovalState
a} :: Approval)
approval_userArn :: Lens.Lens' Approval (Prelude.Maybe Prelude.Text)
approval_userArn :: (Maybe Text -> f (Maybe Text)) -> Approval -> f Approval
approval_userArn = (Approval -> Maybe Text)
-> (Approval -> Maybe Text -> Approval)
-> Lens Approval Approval (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Approval' {Maybe Text
userArn :: Maybe Text
$sel:userArn:Approval' :: Approval -> Maybe Text
userArn} -> Maybe Text
userArn) (\s :: Approval
s@Approval' {} Maybe Text
a -> Approval
s {$sel:userArn:Approval' :: Maybe Text
userArn = Maybe Text
a} :: Approval)
instance Core.FromJSON Approval where
parseJSON :: Value -> Parser Approval
parseJSON =
String -> (Object -> Parser Approval) -> Value -> Parser Approval
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Approval"
( \Object
x ->
Maybe ApprovalState -> Maybe Text -> Approval
Approval'
(Maybe ApprovalState -> Maybe Text -> Approval)
-> Parser (Maybe ApprovalState) -> Parser (Maybe Text -> Approval)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ApprovalState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"approvalState")
Parser (Maybe Text -> Approval)
-> Parser (Maybe Text) -> Parser Approval
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
"userArn")
)
instance Prelude.Hashable Approval
instance Prelude.NFData Approval