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