{-# 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.AccessAnalyzer.Types.S3BucketConfiguration where
import Amazonka.AccessAnalyzer.Types.S3AccessPointConfiguration
import Amazonka.AccessAnalyzer.Types.S3BucketAclGrantConfiguration
import Amazonka.AccessAnalyzer.Types.S3PublicAccessBlockConfiguration
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data S3BucketConfiguration = S3BucketConfiguration'
{
S3BucketConfiguration
-> Maybe (HashMap Text S3AccessPointConfiguration)
accessPoints :: Prelude.Maybe (Prelude.HashMap Prelude.Text S3AccessPointConfiguration),
S3BucketConfiguration -> Maybe S3PublicAccessBlockConfiguration
bucketPublicAccessBlock :: Prelude.Maybe S3PublicAccessBlockConfiguration,
S3BucketConfiguration -> Maybe [S3BucketAclGrantConfiguration]
bucketAclGrants :: Prelude.Maybe [S3BucketAclGrantConfiguration],
S3BucketConfiguration -> Maybe Text
bucketPolicy :: Prelude.Maybe Prelude.Text
}
deriving (S3BucketConfiguration -> S3BucketConfiguration -> Bool
(S3BucketConfiguration -> S3BucketConfiguration -> Bool)
-> (S3BucketConfiguration -> S3BucketConfiguration -> Bool)
-> Eq S3BucketConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3BucketConfiguration -> S3BucketConfiguration -> Bool
$c/= :: S3BucketConfiguration -> S3BucketConfiguration -> Bool
== :: S3BucketConfiguration -> S3BucketConfiguration -> Bool
$c== :: S3BucketConfiguration -> S3BucketConfiguration -> Bool
Prelude.Eq, ReadPrec [S3BucketConfiguration]
ReadPrec S3BucketConfiguration
Int -> ReadS S3BucketConfiguration
ReadS [S3BucketConfiguration]
(Int -> ReadS S3BucketConfiguration)
-> ReadS [S3BucketConfiguration]
-> ReadPrec S3BucketConfiguration
-> ReadPrec [S3BucketConfiguration]
-> Read S3BucketConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3BucketConfiguration]
$creadListPrec :: ReadPrec [S3BucketConfiguration]
readPrec :: ReadPrec S3BucketConfiguration
$creadPrec :: ReadPrec S3BucketConfiguration
readList :: ReadS [S3BucketConfiguration]
$creadList :: ReadS [S3BucketConfiguration]
readsPrec :: Int -> ReadS S3BucketConfiguration
$creadsPrec :: Int -> ReadS S3BucketConfiguration
Prelude.Read, Int -> S3BucketConfiguration -> ShowS
[S3BucketConfiguration] -> ShowS
S3BucketConfiguration -> String
(Int -> S3BucketConfiguration -> ShowS)
-> (S3BucketConfiguration -> String)
-> ([S3BucketConfiguration] -> ShowS)
-> Show S3BucketConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3BucketConfiguration] -> ShowS
$cshowList :: [S3BucketConfiguration] -> ShowS
show :: S3BucketConfiguration -> String
$cshow :: S3BucketConfiguration -> String
showsPrec :: Int -> S3BucketConfiguration -> ShowS
$cshowsPrec :: Int -> S3BucketConfiguration -> ShowS
Prelude.Show, (forall x. S3BucketConfiguration -> Rep S3BucketConfiguration x)
-> (forall x. Rep S3BucketConfiguration x -> S3BucketConfiguration)
-> Generic S3BucketConfiguration
forall x. Rep S3BucketConfiguration x -> S3BucketConfiguration
forall x. S3BucketConfiguration -> Rep S3BucketConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3BucketConfiguration x -> S3BucketConfiguration
$cfrom :: forall x. S3BucketConfiguration -> Rep S3BucketConfiguration x
Prelude.Generic)
newS3BucketConfiguration ::
S3BucketConfiguration
newS3BucketConfiguration :: S3BucketConfiguration
newS3BucketConfiguration =
S3BucketConfiguration' :: Maybe (HashMap Text S3AccessPointConfiguration)
-> Maybe S3PublicAccessBlockConfiguration
-> Maybe [S3BucketAclGrantConfiguration]
-> Maybe Text
-> S3BucketConfiguration
S3BucketConfiguration'
{ $sel:accessPoints:S3BucketConfiguration' :: Maybe (HashMap Text S3AccessPointConfiguration)
accessPoints =
Maybe (HashMap Text S3AccessPointConfiguration)
forall a. Maybe a
Prelude.Nothing,
$sel:bucketPublicAccessBlock:S3BucketConfiguration' :: Maybe S3PublicAccessBlockConfiguration
bucketPublicAccessBlock = Maybe S3PublicAccessBlockConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:bucketAclGrants:S3BucketConfiguration' :: Maybe [S3BucketAclGrantConfiguration]
bucketAclGrants = Maybe [S3BucketAclGrantConfiguration]
forall a. Maybe a
Prelude.Nothing,
$sel:bucketPolicy:S3BucketConfiguration' :: Maybe Text
bucketPolicy = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
s3BucketConfiguration_accessPoints :: Lens.Lens' S3BucketConfiguration (Prelude.Maybe (Prelude.HashMap Prelude.Text S3AccessPointConfiguration))
s3BucketConfiguration_accessPoints :: (Maybe (HashMap Text S3AccessPointConfiguration)
-> f (Maybe (HashMap Text S3AccessPointConfiguration)))
-> S3BucketConfiguration -> f S3BucketConfiguration
s3BucketConfiguration_accessPoints = (S3BucketConfiguration
-> Maybe (HashMap Text S3AccessPointConfiguration))
-> (S3BucketConfiguration
-> Maybe (HashMap Text S3AccessPointConfiguration)
-> S3BucketConfiguration)
-> Lens
S3BucketConfiguration
S3BucketConfiguration
(Maybe (HashMap Text S3AccessPointConfiguration))
(Maybe (HashMap Text S3AccessPointConfiguration))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3BucketConfiguration' {Maybe (HashMap Text S3AccessPointConfiguration)
accessPoints :: Maybe (HashMap Text S3AccessPointConfiguration)
$sel:accessPoints:S3BucketConfiguration' :: S3BucketConfiguration
-> Maybe (HashMap Text S3AccessPointConfiguration)
accessPoints} -> Maybe (HashMap Text S3AccessPointConfiguration)
accessPoints) (\s :: S3BucketConfiguration
s@S3BucketConfiguration' {} Maybe (HashMap Text S3AccessPointConfiguration)
a -> S3BucketConfiguration
s {$sel:accessPoints:S3BucketConfiguration' :: Maybe (HashMap Text S3AccessPointConfiguration)
accessPoints = Maybe (HashMap Text S3AccessPointConfiguration)
a} :: S3BucketConfiguration) ((Maybe (HashMap Text S3AccessPointConfiguration)
-> f (Maybe (HashMap Text S3AccessPointConfiguration)))
-> S3BucketConfiguration -> f S3BucketConfiguration)
-> ((Maybe (HashMap Text S3AccessPointConfiguration)
-> f (Maybe (HashMap Text S3AccessPointConfiguration)))
-> Maybe (HashMap Text S3AccessPointConfiguration)
-> f (Maybe (HashMap Text S3AccessPointConfiguration)))
-> (Maybe (HashMap Text S3AccessPointConfiguration)
-> f (Maybe (HashMap Text S3AccessPointConfiguration)))
-> S3BucketConfiguration
-> f S3BucketConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text S3AccessPointConfiguration)
(HashMap Text S3AccessPointConfiguration)
(HashMap Text S3AccessPointConfiguration)
(HashMap Text S3AccessPointConfiguration)
-> Iso
(Maybe (HashMap Text S3AccessPointConfiguration))
(Maybe (HashMap Text S3AccessPointConfiguration))
(Maybe (HashMap Text S3AccessPointConfiguration))
(Maybe (HashMap Text S3AccessPointConfiguration))
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
(HashMap Text S3AccessPointConfiguration)
(HashMap Text S3AccessPointConfiguration)
(HashMap Text S3AccessPointConfiguration)
(HashMap Text S3AccessPointConfiguration)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
s3BucketConfiguration_bucketPublicAccessBlock :: Lens.Lens' S3BucketConfiguration (Prelude.Maybe S3PublicAccessBlockConfiguration)
s3BucketConfiguration_bucketPublicAccessBlock :: (Maybe S3PublicAccessBlockConfiguration
-> f (Maybe S3PublicAccessBlockConfiguration))
-> S3BucketConfiguration -> f S3BucketConfiguration
s3BucketConfiguration_bucketPublicAccessBlock = (S3BucketConfiguration -> Maybe S3PublicAccessBlockConfiguration)
-> (S3BucketConfiguration
-> Maybe S3PublicAccessBlockConfiguration -> S3BucketConfiguration)
-> Lens
S3BucketConfiguration
S3BucketConfiguration
(Maybe S3PublicAccessBlockConfiguration)
(Maybe S3PublicAccessBlockConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3BucketConfiguration' {Maybe S3PublicAccessBlockConfiguration
bucketPublicAccessBlock :: Maybe S3PublicAccessBlockConfiguration
$sel:bucketPublicAccessBlock:S3BucketConfiguration' :: S3BucketConfiguration -> Maybe S3PublicAccessBlockConfiguration
bucketPublicAccessBlock} -> Maybe S3PublicAccessBlockConfiguration
bucketPublicAccessBlock) (\s :: S3BucketConfiguration
s@S3BucketConfiguration' {} Maybe S3PublicAccessBlockConfiguration
a -> S3BucketConfiguration
s {$sel:bucketPublicAccessBlock:S3BucketConfiguration' :: Maybe S3PublicAccessBlockConfiguration
bucketPublicAccessBlock = Maybe S3PublicAccessBlockConfiguration
a} :: S3BucketConfiguration)
s3BucketConfiguration_bucketAclGrants :: Lens.Lens' S3BucketConfiguration (Prelude.Maybe [S3BucketAclGrantConfiguration])
s3BucketConfiguration_bucketAclGrants :: (Maybe [S3BucketAclGrantConfiguration]
-> f (Maybe [S3BucketAclGrantConfiguration]))
-> S3BucketConfiguration -> f S3BucketConfiguration
s3BucketConfiguration_bucketAclGrants = (S3BucketConfiguration -> Maybe [S3BucketAclGrantConfiguration])
-> (S3BucketConfiguration
-> Maybe [S3BucketAclGrantConfiguration] -> S3BucketConfiguration)
-> Lens
S3BucketConfiguration
S3BucketConfiguration
(Maybe [S3BucketAclGrantConfiguration])
(Maybe [S3BucketAclGrantConfiguration])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3BucketConfiguration' {Maybe [S3BucketAclGrantConfiguration]
bucketAclGrants :: Maybe [S3BucketAclGrantConfiguration]
$sel:bucketAclGrants:S3BucketConfiguration' :: S3BucketConfiguration -> Maybe [S3BucketAclGrantConfiguration]
bucketAclGrants} -> Maybe [S3BucketAclGrantConfiguration]
bucketAclGrants) (\s :: S3BucketConfiguration
s@S3BucketConfiguration' {} Maybe [S3BucketAclGrantConfiguration]
a -> S3BucketConfiguration
s {$sel:bucketAclGrants:S3BucketConfiguration' :: Maybe [S3BucketAclGrantConfiguration]
bucketAclGrants = Maybe [S3BucketAclGrantConfiguration]
a} :: S3BucketConfiguration) ((Maybe [S3BucketAclGrantConfiguration]
-> f (Maybe [S3BucketAclGrantConfiguration]))
-> S3BucketConfiguration -> f S3BucketConfiguration)
-> ((Maybe [S3BucketAclGrantConfiguration]
-> f (Maybe [S3BucketAclGrantConfiguration]))
-> Maybe [S3BucketAclGrantConfiguration]
-> f (Maybe [S3BucketAclGrantConfiguration]))
-> (Maybe [S3BucketAclGrantConfiguration]
-> f (Maybe [S3BucketAclGrantConfiguration]))
-> S3BucketConfiguration
-> f S3BucketConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[S3BucketAclGrantConfiguration]
[S3BucketAclGrantConfiguration]
[S3BucketAclGrantConfiguration]
[S3BucketAclGrantConfiguration]
-> Iso
(Maybe [S3BucketAclGrantConfiguration])
(Maybe [S3BucketAclGrantConfiguration])
(Maybe [S3BucketAclGrantConfiguration])
(Maybe [S3BucketAclGrantConfiguration])
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
[S3BucketAclGrantConfiguration]
[S3BucketAclGrantConfiguration]
[S3BucketAclGrantConfiguration]
[S3BucketAclGrantConfiguration]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
s3BucketConfiguration_bucketPolicy :: Lens.Lens' S3BucketConfiguration (Prelude.Maybe Prelude.Text)
s3BucketConfiguration_bucketPolicy :: (Maybe Text -> f (Maybe Text))
-> S3BucketConfiguration -> f S3BucketConfiguration
s3BucketConfiguration_bucketPolicy = (S3BucketConfiguration -> Maybe Text)
-> (S3BucketConfiguration -> Maybe Text -> S3BucketConfiguration)
-> Lens
S3BucketConfiguration
S3BucketConfiguration
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3BucketConfiguration' {Maybe Text
bucketPolicy :: Maybe Text
$sel:bucketPolicy:S3BucketConfiguration' :: S3BucketConfiguration -> Maybe Text
bucketPolicy} -> Maybe Text
bucketPolicy) (\s :: S3BucketConfiguration
s@S3BucketConfiguration' {} Maybe Text
a -> S3BucketConfiguration
s {$sel:bucketPolicy:S3BucketConfiguration' :: Maybe Text
bucketPolicy = Maybe Text
a} :: S3BucketConfiguration)
instance Core.FromJSON S3BucketConfiguration where
parseJSON :: Value -> Parser S3BucketConfiguration
parseJSON =
String
-> (Object -> Parser S3BucketConfiguration)
-> Value
-> Parser S3BucketConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"S3BucketConfiguration"
( \Object
x ->
Maybe (HashMap Text S3AccessPointConfiguration)
-> Maybe S3PublicAccessBlockConfiguration
-> Maybe [S3BucketAclGrantConfiguration]
-> Maybe Text
-> S3BucketConfiguration
S3BucketConfiguration'
(Maybe (HashMap Text S3AccessPointConfiguration)
-> Maybe S3PublicAccessBlockConfiguration
-> Maybe [S3BucketAclGrantConfiguration]
-> Maybe Text
-> S3BucketConfiguration)
-> Parser (Maybe (HashMap Text S3AccessPointConfiguration))
-> Parser
(Maybe S3PublicAccessBlockConfiguration
-> Maybe [S3BucketAclGrantConfiguration]
-> Maybe Text
-> S3BucketConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text
-> Parser (Maybe (Maybe (HashMap Text S3AccessPointConfiguration)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"accessPoints" Parser (Maybe (Maybe (HashMap Text S3AccessPointConfiguration)))
-> Maybe (HashMap Text S3AccessPointConfiguration)
-> Parser (Maybe (HashMap Text S3AccessPointConfiguration))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text S3AccessPointConfiguration)
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe S3PublicAccessBlockConfiguration
-> Maybe [S3BucketAclGrantConfiguration]
-> Maybe Text
-> S3BucketConfiguration)
-> Parser (Maybe S3PublicAccessBlockConfiguration)
-> Parser
(Maybe [S3BucketAclGrantConfiguration]
-> Maybe Text -> S3BucketConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe S3PublicAccessBlockConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"bucketPublicAccessBlock")
Parser
(Maybe [S3BucketAclGrantConfiguration]
-> Maybe Text -> S3BucketConfiguration)
-> Parser (Maybe [S3BucketAclGrantConfiguration])
-> Parser (Maybe Text -> S3BucketConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text -> Parser (Maybe (Maybe [S3BucketAclGrantConfiguration]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"bucketAclGrants"
Parser (Maybe (Maybe [S3BucketAclGrantConfiguration]))
-> Maybe [S3BucketAclGrantConfiguration]
-> Parser (Maybe [S3BucketAclGrantConfiguration])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [S3BucketAclGrantConfiguration]
forall a. Monoid a => a
Prelude.mempty
)
Parser (Maybe Text -> S3BucketConfiguration)
-> Parser (Maybe Text) -> Parser S3BucketConfiguration
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
"bucketPolicy")
)
instance Prelude.Hashable S3BucketConfiguration
instance Prelude.NFData S3BucketConfiguration
instance Core.ToJSON S3BucketConfiguration where
toJSON :: S3BucketConfiguration -> Value
toJSON S3BucketConfiguration' {Maybe [S3BucketAclGrantConfiguration]
Maybe Text
Maybe (HashMap Text S3AccessPointConfiguration)
Maybe S3PublicAccessBlockConfiguration
bucketPolicy :: Maybe Text
bucketAclGrants :: Maybe [S3BucketAclGrantConfiguration]
bucketPublicAccessBlock :: Maybe S3PublicAccessBlockConfiguration
accessPoints :: Maybe (HashMap Text S3AccessPointConfiguration)
$sel:bucketPolicy:S3BucketConfiguration' :: S3BucketConfiguration -> Maybe Text
$sel:bucketAclGrants:S3BucketConfiguration' :: S3BucketConfiguration -> Maybe [S3BucketAclGrantConfiguration]
$sel:bucketPublicAccessBlock:S3BucketConfiguration' :: S3BucketConfiguration -> Maybe S3PublicAccessBlockConfiguration
$sel:accessPoints:S3BucketConfiguration' :: S3BucketConfiguration
-> Maybe (HashMap Text S3AccessPointConfiguration)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"accessPoints" Text -> HashMap Text S3AccessPointConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text S3AccessPointConfiguration -> Pair)
-> Maybe (HashMap Text S3AccessPointConfiguration) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text S3AccessPointConfiguration)
accessPoints,
(Text
"bucketPublicAccessBlock" Text -> S3PublicAccessBlockConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(S3PublicAccessBlockConfiguration -> Pair)
-> Maybe S3PublicAccessBlockConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3PublicAccessBlockConfiguration
bucketPublicAccessBlock,
(Text
"bucketAclGrants" Text -> [S3BucketAclGrantConfiguration] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([S3BucketAclGrantConfiguration] -> Pair)
-> Maybe [S3BucketAclGrantConfiguration] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [S3BucketAclGrantConfiguration]
bucketAclGrants,
(Text
"bucketPolicy" 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
bucketPolicy
]
)