{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.SecurityHub.Types.AwsS3AccountPublicAccessBlockDetails
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SecurityHub.Types.AwsS3AccountPublicAccessBlockDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | provides information about the Amazon S3 Public Access Block
-- configuration for accounts.
--
-- /See:/ 'newAwsS3AccountPublicAccessBlockDetails' smart constructor.
data AwsS3AccountPublicAccessBlockDetails = AwsS3AccountPublicAccessBlockDetails'
  { -- | Indicates whether Amazon S3 ignores public ACLs that are associated with
    -- an S3 bucket.
    AwsS3AccountPublicAccessBlockDetails -> Maybe Bool
ignorePublicAcls :: Prelude.Maybe Prelude.Bool,
    -- | Indicates whether to reject calls to update an S3 bucket if the calls
    -- include a public access control list (ACL).
    AwsS3AccountPublicAccessBlockDetails -> Maybe Bool
blockPublicAcls :: Prelude.Maybe Prelude.Bool,
    -- | Indicates whether to restrict access to an access point or S3 bucket
    -- that has a public policy to only Amazon Web Services service principals
    -- and authorized users within the S3 bucket owner\'s account.
    AwsS3AccountPublicAccessBlockDetails -> Maybe Bool
restrictPublicBuckets :: Prelude.Maybe Prelude.Bool,
    -- | Indicates whether to reject calls to update the access policy for an S3
    -- bucket or access point if the policy allows public access.
    AwsS3AccountPublicAccessBlockDetails -> Maybe Bool
blockPublicPolicy :: Prelude.Maybe Prelude.Bool
  }
  deriving (AwsS3AccountPublicAccessBlockDetails
-> AwsS3AccountPublicAccessBlockDetails -> Bool
(AwsS3AccountPublicAccessBlockDetails
 -> AwsS3AccountPublicAccessBlockDetails -> Bool)
-> (AwsS3AccountPublicAccessBlockDetails
    -> AwsS3AccountPublicAccessBlockDetails -> Bool)
-> Eq AwsS3AccountPublicAccessBlockDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsS3AccountPublicAccessBlockDetails
-> AwsS3AccountPublicAccessBlockDetails -> Bool
$c/= :: AwsS3AccountPublicAccessBlockDetails
-> AwsS3AccountPublicAccessBlockDetails -> Bool
== :: AwsS3AccountPublicAccessBlockDetails
-> AwsS3AccountPublicAccessBlockDetails -> Bool
$c== :: AwsS3AccountPublicAccessBlockDetails
-> AwsS3AccountPublicAccessBlockDetails -> Bool
Prelude.Eq, ReadPrec [AwsS3AccountPublicAccessBlockDetails]
ReadPrec AwsS3AccountPublicAccessBlockDetails
Int -> ReadS AwsS3AccountPublicAccessBlockDetails
ReadS [AwsS3AccountPublicAccessBlockDetails]
(Int -> ReadS AwsS3AccountPublicAccessBlockDetails)
-> ReadS [AwsS3AccountPublicAccessBlockDetails]
-> ReadPrec AwsS3AccountPublicAccessBlockDetails
-> ReadPrec [AwsS3AccountPublicAccessBlockDetails]
-> Read AwsS3AccountPublicAccessBlockDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsS3AccountPublicAccessBlockDetails]
$creadListPrec :: ReadPrec [AwsS3AccountPublicAccessBlockDetails]
readPrec :: ReadPrec AwsS3AccountPublicAccessBlockDetails
$creadPrec :: ReadPrec AwsS3AccountPublicAccessBlockDetails
readList :: ReadS [AwsS3AccountPublicAccessBlockDetails]
$creadList :: ReadS [AwsS3AccountPublicAccessBlockDetails]
readsPrec :: Int -> ReadS AwsS3AccountPublicAccessBlockDetails
$creadsPrec :: Int -> ReadS AwsS3AccountPublicAccessBlockDetails
Prelude.Read, Int -> AwsS3AccountPublicAccessBlockDetails -> ShowS
[AwsS3AccountPublicAccessBlockDetails] -> ShowS
AwsS3AccountPublicAccessBlockDetails -> String
(Int -> AwsS3AccountPublicAccessBlockDetails -> ShowS)
-> (AwsS3AccountPublicAccessBlockDetails -> String)
-> ([AwsS3AccountPublicAccessBlockDetails] -> ShowS)
-> Show AwsS3AccountPublicAccessBlockDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsS3AccountPublicAccessBlockDetails] -> ShowS
$cshowList :: [AwsS3AccountPublicAccessBlockDetails] -> ShowS
show :: AwsS3AccountPublicAccessBlockDetails -> String
$cshow :: AwsS3AccountPublicAccessBlockDetails -> String
showsPrec :: Int -> AwsS3AccountPublicAccessBlockDetails -> ShowS
$cshowsPrec :: Int -> AwsS3AccountPublicAccessBlockDetails -> ShowS
Prelude.Show, (forall x.
 AwsS3AccountPublicAccessBlockDetails
 -> Rep AwsS3AccountPublicAccessBlockDetails x)
-> (forall x.
    Rep AwsS3AccountPublicAccessBlockDetails x
    -> AwsS3AccountPublicAccessBlockDetails)
-> Generic AwsS3AccountPublicAccessBlockDetails
forall x.
Rep AwsS3AccountPublicAccessBlockDetails x
-> AwsS3AccountPublicAccessBlockDetails
forall x.
AwsS3AccountPublicAccessBlockDetails
-> Rep AwsS3AccountPublicAccessBlockDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsS3AccountPublicAccessBlockDetails x
-> AwsS3AccountPublicAccessBlockDetails
$cfrom :: forall x.
AwsS3AccountPublicAccessBlockDetails
-> Rep AwsS3AccountPublicAccessBlockDetails x
Prelude.Generic)

-- |
-- Create a value of 'AwsS3AccountPublicAccessBlockDetails' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'ignorePublicAcls', 'awsS3AccountPublicAccessBlockDetails_ignorePublicAcls' - Indicates whether Amazon S3 ignores public ACLs that are associated with
-- an S3 bucket.
--
-- 'blockPublicAcls', 'awsS3AccountPublicAccessBlockDetails_blockPublicAcls' - Indicates whether to reject calls to update an S3 bucket if the calls
-- include a public access control list (ACL).
--
-- 'restrictPublicBuckets', 'awsS3AccountPublicAccessBlockDetails_restrictPublicBuckets' - Indicates whether to restrict access to an access point or S3 bucket
-- that has a public policy to only Amazon Web Services service principals
-- and authorized users within the S3 bucket owner\'s account.
--
-- 'blockPublicPolicy', 'awsS3AccountPublicAccessBlockDetails_blockPublicPolicy' - Indicates whether to reject calls to update the access policy for an S3
-- bucket or access point if the policy allows public access.
newAwsS3AccountPublicAccessBlockDetails ::
  AwsS3AccountPublicAccessBlockDetails
newAwsS3AccountPublicAccessBlockDetails :: AwsS3AccountPublicAccessBlockDetails
newAwsS3AccountPublicAccessBlockDetails =
  AwsS3AccountPublicAccessBlockDetails' :: Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> AwsS3AccountPublicAccessBlockDetails
AwsS3AccountPublicAccessBlockDetails'
    { $sel:ignorePublicAcls:AwsS3AccountPublicAccessBlockDetails' :: Maybe Bool
ignorePublicAcls =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:blockPublicAcls:AwsS3AccountPublicAccessBlockDetails' :: Maybe Bool
blockPublicAcls = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:restrictPublicBuckets:AwsS3AccountPublicAccessBlockDetails' :: Maybe Bool
restrictPublicBuckets =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:blockPublicPolicy:AwsS3AccountPublicAccessBlockDetails' :: Maybe Bool
blockPublicPolicy = Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | Indicates whether Amazon S3 ignores public ACLs that are associated with
-- an S3 bucket.
awsS3AccountPublicAccessBlockDetails_ignorePublicAcls :: Lens.Lens' AwsS3AccountPublicAccessBlockDetails (Prelude.Maybe Prelude.Bool)
awsS3AccountPublicAccessBlockDetails_ignorePublicAcls :: (Maybe Bool -> f (Maybe Bool))
-> AwsS3AccountPublicAccessBlockDetails
-> f AwsS3AccountPublicAccessBlockDetails
awsS3AccountPublicAccessBlockDetails_ignorePublicAcls = (AwsS3AccountPublicAccessBlockDetails -> Maybe Bool)
-> (AwsS3AccountPublicAccessBlockDetails
    -> Maybe Bool -> AwsS3AccountPublicAccessBlockDetails)
-> Lens
     AwsS3AccountPublicAccessBlockDetails
     AwsS3AccountPublicAccessBlockDetails
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsS3AccountPublicAccessBlockDetails' {Maybe Bool
ignorePublicAcls :: Maybe Bool
$sel:ignorePublicAcls:AwsS3AccountPublicAccessBlockDetails' :: AwsS3AccountPublicAccessBlockDetails -> Maybe Bool
ignorePublicAcls} -> Maybe Bool
ignorePublicAcls) (\s :: AwsS3AccountPublicAccessBlockDetails
s@AwsS3AccountPublicAccessBlockDetails' {} Maybe Bool
a -> AwsS3AccountPublicAccessBlockDetails
s {$sel:ignorePublicAcls:AwsS3AccountPublicAccessBlockDetails' :: Maybe Bool
ignorePublicAcls = Maybe Bool
a} :: AwsS3AccountPublicAccessBlockDetails)

-- | Indicates whether to reject calls to update an S3 bucket if the calls
-- include a public access control list (ACL).
awsS3AccountPublicAccessBlockDetails_blockPublicAcls :: Lens.Lens' AwsS3AccountPublicAccessBlockDetails (Prelude.Maybe Prelude.Bool)
awsS3AccountPublicAccessBlockDetails_blockPublicAcls :: (Maybe Bool -> f (Maybe Bool))
-> AwsS3AccountPublicAccessBlockDetails
-> f AwsS3AccountPublicAccessBlockDetails
awsS3AccountPublicAccessBlockDetails_blockPublicAcls = (AwsS3AccountPublicAccessBlockDetails -> Maybe Bool)
-> (AwsS3AccountPublicAccessBlockDetails
    -> Maybe Bool -> AwsS3AccountPublicAccessBlockDetails)
-> Lens
     AwsS3AccountPublicAccessBlockDetails
     AwsS3AccountPublicAccessBlockDetails
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsS3AccountPublicAccessBlockDetails' {Maybe Bool
blockPublicAcls :: Maybe Bool
$sel:blockPublicAcls:AwsS3AccountPublicAccessBlockDetails' :: AwsS3AccountPublicAccessBlockDetails -> Maybe Bool
blockPublicAcls} -> Maybe Bool
blockPublicAcls) (\s :: AwsS3AccountPublicAccessBlockDetails
s@AwsS3AccountPublicAccessBlockDetails' {} Maybe Bool
a -> AwsS3AccountPublicAccessBlockDetails
s {$sel:blockPublicAcls:AwsS3AccountPublicAccessBlockDetails' :: Maybe Bool
blockPublicAcls = Maybe Bool
a} :: AwsS3AccountPublicAccessBlockDetails)

-- | Indicates whether to restrict access to an access point or S3 bucket
-- that has a public policy to only Amazon Web Services service principals
-- and authorized users within the S3 bucket owner\'s account.
awsS3AccountPublicAccessBlockDetails_restrictPublicBuckets :: Lens.Lens' AwsS3AccountPublicAccessBlockDetails (Prelude.Maybe Prelude.Bool)
awsS3AccountPublicAccessBlockDetails_restrictPublicBuckets :: (Maybe Bool -> f (Maybe Bool))
-> AwsS3AccountPublicAccessBlockDetails
-> f AwsS3AccountPublicAccessBlockDetails
awsS3AccountPublicAccessBlockDetails_restrictPublicBuckets = (AwsS3AccountPublicAccessBlockDetails -> Maybe Bool)
-> (AwsS3AccountPublicAccessBlockDetails
    -> Maybe Bool -> AwsS3AccountPublicAccessBlockDetails)
-> Lens
     AwsS3AccountPublicAccessBlockDetails
     AwsS3AccountPublicAccessBlockDetails
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsS3AccountPublicAccessBlockDetails' {Maybe Bool
restrictPublicBuckets :: Maybe Bool
$sel:restrictPublicBuckets:AwsS3AccountPublicAccessBlockDetails' :: AwsS3AccountPublicAccessBlockDetails -> Maybe Bool
restrictPublicBuckets} -> Maybe Bool
restrictPublicBuckets) (\s :: AwsS3AccountPublicAccessBlockDetails
s@AwsS3AccountPublicAccessBlockDetails' {} Maybe Bool
a -> AwsS3AccountPublicAccessBlockDetails
s {$sel:restrictPublicBuckets:AwsS3AccountPublicAccessBlockDetails' :: Maybe Bool
restrictPublicBuckets = Maybe Bool
a} :: AwsS3AccountPublicAccessBlockDetails)

-- | Indicates whether to reject calls to update the access policy for an S3
-- bucket or access point if the policy allows public access.
awsS3AccountPublicAccessBlockDetails_blockPublicPolicy :: Lens.Lens' AwsS3AccountPublicAccessBlockDetails (Prelude.Maybe Prelude.Bool)
awsS3AccountPublicAccessBlockDetails_blockPublicPolicy :: (Maybe Bool -> f (Maybe Bool))
-> AwsS3AccountPublicAccessBlockDetails
-> f AwsS3AccountPublicAccessBlockDetails
awsS3AccountPublicAccessBlockDetails_blockPublicPolicy = (AwsS3AccountPublicAccessBlockDetails -> Maybe Bool)
-> (AwsS3AccountPublicAccessBlockDetails
    -> Maybe Bool -> AwsS3AccountPublicAccessBlockDetails)
-> Lens
     AwsS3AccountPublicAccessBlockDetails
     AwsS3AccountPublicAccessBlockDetails
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsS3AccountPublicAccessBlockDetails' {Maybe Bool
blockPublicPolicy :: Maybe Bool
$sel:blockPublicPolicy:AwsS3AccountPublicAccessBlockDetails' :: AwsS3AccountPublicAccessBlockDetails -> Maybe Bool
blockPublicPolicy} -> Maybe Bool
blockPublicPolicy) (\s :: AwsS3AccountPublicAccessBlockDetails
s@AwsS3AccountPublicAccessBlockDetails' {} Maybe Bool
a -> AwsS3AccountPublicAccessBlockDetails
s {$sel:blockPublicPolicy:AwsS3AccountPublicAccessBlockDetails' :: Maybe Bool
blockPublicPolicy = Maybe Bool
a} :: AwsS3AccountPublicAccessBlockDetails)

instance
  Core.FromJSON
    AwsS3AccountPublicAccessBlockDetails
  where
  parseJSON :: Value -> Parser AwsS3AccountPublicAccessBlockDetails
parseJSON =
    String
-> (Object -> Parser AwsS3AccountPublicAccessBlockDetails)
-> Value
-> Parser AwsS3AccountPublicAccessBlockDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsS3AccountPublicAccessBlockDetails"
      ( \Object
x ->
          Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> AwsS3AccountPublicAccessBlockDetails
AwsS3AccountPublicAccessBlockDetails'
            (Maybe Bool
 -> Maybe Bool
 -> Maybe Bool
 -> Maybe Bool
 -> AwsS3AccountPublicAccessBlockDetails)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Bool
      -> Maybe Bool
      -> Maybe Bool
      -> AwsS3AccountPublicAccessBlockDetails)
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
"IgnorePublicAcls")
            Parser
  (Maybe Bool
   -> Maybe Bool
   -> Maybe Bool
   -> AwsS3AccountPublicAccessBlockDetails)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Bool -> Maybe Bool -> AwsS3AccountPublicAccessBlockDetails)
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
"BlockPublicAcls")
            Parser
  (Maybe Bool -> Maybe Bool -> AwsS3AccountPublicAccessBlockDetails)
-> Parser (Maybe Bool)
-> Parser (Maybe Bool -> AwsS3AccountPublicAccessBlockDetails)
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
"RestrictPublicBuckets")
            Parser (Maybe Bool -> AwsS3AccountPublicAccessBlockDetails)
-> Parser (Maybe Bool)
-> Parser AwsS3AccountPublicAccessBlockDetails
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
"BlockPublicPolicy")
      )

instance
  Prelude.Hashable
    AwsS3AccountPublicAccessBlockDetails

instance
  Prelude.NFData
    AwsS3AccountPublicAccessBlockDetails

instance
  Core.ToJSON
    AwsS3AccountPublicAccessBlockDetails
  where
  toJSON :: AwsS3AccountPublicAccessBlockDetails -> Value
toJSON AwsS3AccountPublicAccessBlockDetails' {Maybe Bool
blockPublicPolicy :: Maybe Bool
restrictPublicBuckets :: Maybe Bool
blockPublicAcls :: Maybe Bool
ignorePublicAcls :: Maybe Bool
$sel:blockPublicPolicy:AwsS3AccountPublicAccessBlockDetails' :: AwsS3AccountPublicAccessBlockDetails -> Maybe Bool
$sel:restrictPublicBuckets:AwsS3AccountPublicAccessBlockDetails' :: AwsS3AccountPublicAccessBlockDetails -> Maybe Bool
$sel:blockPublicAcls:AwsS3AccountPublicAccessBlockDetails' :: AwsS3AccountPublicAccessBlockDetails -> Maybe Bool
$sel:ignorePublicAcls:AwsS3AccountPublicAccessBlockDetails' :: AwsS3AccountPublicAccessBlockDetails -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"IgnorePublicAcls" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
ignorePublicAcls,
            (Text
"BlockPublicAcls" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
blockPublicAcls,
            (Text
"RestrictPublicBuckets" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
restrictPublicBuckets,
            (Text
"BlockPublicPolicy" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
blockPublicPolicy
          ]
      )