{-# 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.IAM.Types.Statement where
import qualified Amazonka.Core as Core
import Amazonka.IAM.Types.PolicySourceType
import Amazonka.IAM.Types.Position
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Statement = Statement'
{
Statement -> Maybe PolicySourceType
sourcePolicyType :: Prelude.Maybe PolicySourceType,
Statement -> Maybe Text
sourcePolicyId :: Prelude.Maybe Prelude.Text,
Statement -> Maybe Position
endPosition :: Prelude.Maybe Position,
Statement -> Maybe Position
startPosition :: Prelude.Maybe Position
}
deriving (Statement -> Statement -> Bool
(Statement -> Statement -> Bool)
-> (Statement -> Statement -> Bool) -> Eq Statement
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Statement -> Statement -> Bool
$c/= :: Statement -> Statement -> Bool
== :: Statement -> Statement -> Bool
$c== :: Statement -> Statement -> Bool
Prelude.Eq, ReadPrec [Statement]
ReadPrec Statement
Int -> ReadS Statement
ReadS [Statement]
(Int -> ReadS Statement)
-> ReadS [Statement]
-> ReadPrec Statement
-> ReadPrec [Statement]
-> Read Statement
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Statement]
$creadListPrec :: ReadPrec [Statement]
readPrec :: ReadPrec Statement
$creadPrec :: ReadPrec Statement
readList :: ReadS [Statement]
$creadList :: ReadS [Statement]
readsPrec :: Int -> ReadS Statement
$creadsPrec :: Int -> ReadS Statement
Prelude.Read, Int -> Statement -> ShowS
[Statement] -> ShowS
Statement -> String
(Int -> Statement -> ShowS)
-> (Statement -> String)
-> ([Statement] -> ShowS)
-> Show Statement
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Statement] -> ShowS
$cshowList :: [Statement] -> ShowS
show :: Statement -> String
$cshow :: Statement -> String
showsPrec :: Int -> Statement -> ShowS
$cshowsPrec :: Int -> Statement -> ShowS
Prelude.Show, (forall x. Statement -> Rep Statement x)
-> (forall x. Rep Statement x -> Statement) -> Generic Statement
forall x. Rep Statement x -> Statement
forall x. Statement -> Rep Statement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Statement x -> Statement
$cfrom :: forall x. Statement -> Rep Statement x
Prelude.Generic)
newStatement ::
Statement
newStatement :: Statement
newStatement =
Statement' :: Maybe PolicySourceType
-> Maybe Text -> Maybe Position -> Maybe Position -> Statement
Statement'
{ $sel:sourcePolicyType:Statement' :: Maybe PolicySourceType
sourcePolicyType = Maybe PolicySourceType
forall a. Maybe a
Prelude.Nothing,
$sel:sourcePolicyId:Statement' :: Maybe Text
sourcePolicyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:endPosition:Statement' :: Maybe Position
endPosition = Maybe Position
forall a. Maybe a
Prelude.Nothing,
$sel:startPosition:Statement' :: Maybe Position
startPosition = Maybe Position
forall a. Maybe a
Prelude.Nothing
}
statement_sourcePolicyType :: Lens.Lens' Statement (Prelude.Maybe PolicySourceType)
statement_sourcePolicyType :: (Maybe PolicySourceType -> f (Maybe PolicySourceType))
-> Statement -> f Statement
statement_sourcePolicyType = (Statement -> Maybe PolicySourceType)
-> (Statement -> Maybe PolicySourceType -> Statement)
-> Lens
Statement
Statement
(Maybe PolicySourceType)
(Maybe PolicySourceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Statement' {Maybe PolicySourceType
sourcePolicyType :: Maybe PolicySourceType
$sel:sourcePolicyType:Statement' :: Statement -> Maybe PolicySourceType
sourcePolicyType} -> Maybe PolicySourceType
sourcePolicyType) (\s :: Statement
s@Statement' {} Maybe PolicySourceType
a -> Statement
s {$sel:sourcePolicyType:Statement' :: Maybe PolicySourceType
sourcePolicyType = Maybe PolicySourceType
a} :: Statement)
statement_sourcePolicyId :: Lens.Lens' Statement (Prelude.Maybe Prelude.Text)
statement_sourcePolicyId :: (Maybe Text -> f (Maybe Text)) -> Statement -> f Statement
statement_sourcePolicyId = (Statement -> Maybe Text)
-> (Statement -> Maybe Text -> Statement)
-> Lens Statement Statement (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Statement' {Maybe Text
sourcePolicyId :: Maybe Text
$sel:sourcePolicyId:Statement' :: Statement -> Maybe Text
sourcePolicyId} -> Maybe Text
sourcePolicyId) (\s :: Statement
s@Statement' {} Maybe Text
a -> Statement
s {$sel:sourcePolicyId:Statement' :: Maybe Text
sourcePolicyId = Maybe Text
a} :: Statement)
statement_endPosition :: Lens.Lens' Statement (Prelude.Maybe Position)
statement_endPosition :: (Maybe Position -> f (Maybe Position)) -> Statement -> f Statement
statement_endPosition = (Statement -> Maybe Position)
-> (Statement -> Maybe Position -> Statement)
-> Lens Statement Statement (Maybe Position) (Maybe Position)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Statement' {Maybe Position
endPosition :: Maybe Position
$sel:endPosition:Statement' :: Statement -> Maybe Position
endPosition} -> Maybe Position
endPosition) (\s :: Statement
s@Statement' {} Maybe Position
a -> Statement
s {$sel:endPosition:Statement' :: Maybe Position
endPosition = Maybe Position
a} :: Statement)
statement_startPosition :: Lens.Lens' Statement (Prelude.Maybe Position)
statement_startPosition :: (Maybe Position -> f (Maybe Position)) -> Statement -> f Statement
statement_startPosition = (Statement -> Maybe Position)
-> (Statement -> Maybe Position -> Statement)
-> Lens Statement Statement (Maybe Position) (Maybe Position)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Statement' {Maybe Position
startPosition :: Maybe Position
$sel:startPosition:Statement' :: Statement -> Maybe Position
startPosition} -> Maybe Position
startPosition) (\s :: Statement
s@Statement' {} Maybe Position
a -> Statement
s {$sel:startPosition:Statement' :: Maybe Position
startPosition = Maybe Position
a} :: Statement)
instance Core.FromXML Statement where
parseXML :: [Node] -> Either String Statement
parseXML [Node]
x =
Maybe PolicySourceType
-> Maybe Text -> Maybe Position -> Maybe Position -> Statement
Statement'
(Maybe PolicySourceType
-> Maybe Text -> Maybe Position -> Maybe Position -> Statement)
-> Either String (Maybe PolicySourceType)
-> Either
String
(Maybe Text -> Maybe Position -> Maybe Position -> Statement)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe PolicySourceType)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SourcePolicyType")
Either
String
(Maybe Text -> Maybe Position -> Maybe Position -> Statement)
-> Either String (Maybe Text)
-> Either String (Maybe Position -> Maybe Position -> Statement)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SourcePolicyId")
Either String (Maybe Position -> Maybe Position -> Statement)
-> Either String (Maybe Position)
-> Either String (Maybe Position -> Statement)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Position)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"EndPosition")
Either String (Maybe Position -> Statement)
-> Either String (Maybe Position) -> Either String Statement
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Position)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"StartPosition")
instance Prelude.Hashable Statement
instance Prelude.NFData Statement