{-# 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.S3.Types.AccessControlPolicy where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.S3.Internal
import Amazonka.S3.Types.Grant
import Amazonka.S3.Types.Owner
data AccessControlPolicy = AccessControlPolicy'
{
AccessControlPolicy -> Maybe [Grant]
grants :: Prelude.Maybe [Grant],
AccessControlPolicy -> Maybe Owner
owner :: Prelude.Maybe Owner
}
deriving (AccessControlPolicy -> AccessControlPolicy -> Bool
(AccessControlPolicy -> AccessControlPolicy -> Bool)
-> (AccessControlPolicy -> AccessControlPolicy -> Bool)
-> Eq AccessControlPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccessControlPolicy -> AccessControlPolicy -> Bool
$c/= :: AccessControlPolicy -> AccessControlPolicy -> Bool
== :: AccessControlPolicy -> AccessControlPolicy -> Bool
$c== :: AccessControlPolicy -> AccessControlPolicy -> Bool
Prelude.Eq, ReadPrec [AccessControlPolicy]
ReadPrec AccessControlPolicy
Int -> ReadS AccessControlPolicy
ReadS [AccessControlPolicy]
(Int -> ReadS AccessControlPolicy)
-> ReadS [AccessControlPolicy]
-> ReadPrec AccessControlPolicy
-> ReadPrec [AccessControlPolicy]
-> Read AccessControlPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AccessControlPolicy]
$creadListPrec :: ReadPrec [AccessControlPolicy]
readPrec :: ReadPrec AccessControlPolicy
$creadPrec :: ReadPrec AccessControlPolicy
readList :: ReadS [AccessControlPolicy]
$creadList :: ReadS [AccessControlPolicy]
readsPrec :: Int -> ReadS AccessControlPolicy
$creadsPrec :: Int -> ReadS AccessControlPolicy
Prelude.Read, Int -> AccessControlPolicy -> ShowS
[AccessControlPolicy] -> ShowS
AccessControlPolicy -> String
(Int -> AccessControlPolicy -> ShowS)
-> (AccessControlPolicy -> String)
-> ([AccessControlPolicy] -> ShowS)
-> Show AccessControlPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccessControlPolicy] -> ShowS
$cshowList :: [AccessControlPolicy] -> ShowS
show :: AccessControlPolicy -> String
$cshow :: AccessControlPolicy -> String
showsPrec :: Int -> AccessControlPolicy -> ShowS
$cshowsPrec :: Int -> AccessControlPolicy -> ShowS
Prelude.Show, (forall x. AccessControlPolicy -> Rep AccessControlPolicy x)
-> (forall x. Rep AccessControlPolicy x -> AccessControlPolicy)
-> Generic AccessControlPolicy
forall x. Rep AccessControlPolicy x -> AccessControlPolicy
forall x. AccessControlPolicy -> Rep AccessControlPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AccessControlPolicy x -> AccessControlPolicy
$cfrom :: forall x. AccessControlPolicy -> Rep AccessControlPolicy x
Prelude.Generic)
newAccessControlPolicy ::
AccessControlPolicy
newAccessControlPolicy :: AccessControlPolicy
newAccessControlPolicy =
AccessControlPolicy' :: Maybe [Grant] -> Maybe Owner -> AccessControlPolicy
AccessControlPolicy'
{ $sel:grants:AccessControlPolicy' :: Maybe [Grant]
grants = Maybe [Grant]
forall a. Maybe a
Prelude.Nothing,
$sel:owner:AccessControlPolicy' :: Maybe Owner
owner = Maybe Owner
forall a. Maybe a
Prelude.Nothing
}
accessControlPolicy_grants :: Lens.Lens' AccessControlPolicy (Prelude.Maybe [Grant])
accessControlPolicy_grants :: (Maybe [Grant] -> f (Maybe [Grant]))
-> AccessControlPolicy -> f AccessControlPolicy
accessControlPolicy_grants = (AccessControlPolicy -> Maybe [Grant])
-> (AccessControlPolicy -> Maybe [Grant] -> AccessControlPolicy)
-> Lens
AccessControlPolicy
AccessControlPolicy
(Maybe [Grant])
(Maybe [Grant])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccessControlPolicy' {Maybe [Grant]
grants :: Maybe [Grant]
$sel:grants:AccessControlPolicy' :: AccessControlPolicy -> Maybe [Grant]
grants} -> Maybe [Grant]
grants) (\s :: AccessControlPolicy
s@AccessControlPolicy' {} Maybe [Grant]
a -> AccessControlPolicy
s {$sel:grants:AccessControlPolicy' :: Maybe [Grant]
grants = Maybe [Grant]
a} :: AccessControlPolicy) ((Maybe [Grant] -> f (Maybe [Grant]))
-> AccessControlPolicy -> f AccessControlPolicy)
-> ((Maybe [Grant] -> f (Maybe [Grant]))
-> Maybe [Grant] -> f (Maybe [Grant]))
-> (Maybe [Grant] -> f (Maybe [Grant]))
-> AccessControlPolicy
-> f AccessControlPolicy
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Grant] [Grant] [Grant] [Grant]
-> Iso
(Maybe [Grant]) (Maybe [Grant]) (Maybe [Grant]) (Maybe [Grant])
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 [Grant] [Grant] [Grant] [Grant]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
accessControlPolicy_owner :: Lens.Lens' AccessControlPolicy (Prelude.Maybe Owner)
accessControlPolicy_owner :: (Maybe Owner -> f (Maybe Owner))
-> AccessControlPolicy -> f AccessControlPolicy
accessControlPolicy_owner = (AccessControlPolicy -> Maybe Owner)
-> (AccessControlPolicy -> Maybe Owner -> AccessControlPolicy)
-> Lens
AccessControlPolicy AccessControlPolicy (Maybe Owner) (Maybe Owner)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccessControlPolicy' {Maybe Owner
owner :: Maybe Owner
$sel:owner:AccessControlPolicy' :: AccessControlPolicy -> Maybe Owner
owner} -> Maybe Owner
owner) (\s :: AccessControlPolicy
s@AccessControlPolicy' {} Maybe Owner
a -> AccessControlPolicy
s {$sel:owner:AccessControlPolicy' :: Maybe Owner
owner = Maybe Owner
a} :: AccessControlPolicy)
instance Prelude.Hashable AccessControlPolicy
instance Prelude.NFData AccessControlPolicy
instance Core.ToXML AccessControlPolicy where
toXML :: AccessControlPolicy -> XML
toXML AccessControlPolicy' {Maybe [Grant]
Maybe Owner
owner :: Maybe Owner
grants :: Maybe [Grant]
$sel:owner:AccessControlPolicy' :: AccessControlPolicy -> Maybe Owner
$sel:grants:AccessControlPolicy' :: AccessControlPolicy -> Maybe [Grant]
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"AccessControlList"
Name -> XML -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe XML -> XML
forall a. ToXML a => a -> XML
Core.toXML
(Name -> [Grant] -> XML
forall a. (IsList a, ToXML (Item a)) => Name -> a -> XML
Core.toXMLList Name
"Grant" ([Grant] -> XML) -> Maybe [Grant] -> Maybe XML
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Grant]
grants),
Name
"Owner" Name -> Maybe Owner -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Owner
owner
]