{-# 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.MacieV2.Types.AccountLevelPermissions
-- 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.MacieV2.Types.AccountLevelPermissions where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MacieV2.Types.BlockPublicAccess
import qualified Amazonka.Prelude as Prelude

-- | Provides information about the account-level permissions settings that
-- apply to an S3 bucket.
--
-- /See:/ 'newAccountLevelPermissions' smart constructor.
data AccountLevelPermissions = AccountLevelPermissions'
  { -- | The block public access settings for the Amazon Web Services account
    -- that owns the bucket.
    AccountLevelPermissions -> Maybe BlockPublicAccess
blockPublicAccess :: Prelude.Maybe BlockPublicAccess
  }
  deriving (AccountLevelPermissions -> AccountLevelPermissions -> Bool
(AccountLevelPermissions -> AccountLevelPermissions -> Bool)
-> (AccountLevelPermissions -> AccountLevelPermissions -> Bool)
-> Eq AccountLevelPermissions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccountLevelPermissions -> AccountLevelPermissions -> Bool
$c/= :: AccountLevelPermissions -> AccountLevelPermissions -> Bool
== :: AccountLevelPermissions -> AccountLevelPermissions -> Bool
$c== :: AccountLevelPermissions -> AccountLevelPermissions -> Bool
Prelude.Eq, ReadPrec [AccountLevelPermissions]
ReadPrec AccountLevelPermissions
Int -> ReadS AccountLevelPermissions
ReadS [AccountLevelPermissions]
(Int -> ReadS AccountLevelPermissions)
-> ReadS [AccountLevelPermissions]
-> ReadPrec AccountLevelPermissions
-> ReadPrec [AccountLevelPermissions]
-> Read AccountLevelPermissions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AccountLevelPermissions]
$creadListPrec :: ReadPrec [AccountLevelPermissions]
readPrec :: ReadPrec AccountLevelPermissions
$creadPrec :: ReadPrec AccountLevelPermissions
readList :: ReadS [AccountLevelPermissions]
$creadList :: ReadS [AccountLevelPermissions]
readsPrec :: Int -> ReadS AccountLevelPermissions
$creadsPrec :: Int -> ReadS AccountLevelPermissions
Prelude.Read, Int -> AccountLevelPermissions -> ShowS
[AccountLevelPermissions] -> ShowS
AccountLevelPermissions -> String
(Int -> AccountLevelPermissions -> ShowS)
-> (AccountLevelPermissions -> String)
-> ([AccountLevelPermissions] -> ShowS)
-> Show AccountLevelPermissions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccountLevelPermissions] -> ShowS
$cshowList :: [AccountLevelPermissions] -> ShowS
show :: AccountLevelPermissions -> String
$cshow :: AccountLevelPermissions -> String
showsPrec :: Int -> AccountLevelPermissions -> ShowS
$cshowsPrec :: Int -> AccountLevelPermissions -> ShowS
Prelude.Show, (forall x.
 AccountLevelPermissions -> Rep AccountLevelPermissions x)
-> (forall x.
    Rep AccountLevelPermissions x -> AccountLevelPermissions)
-> Generic AccountLevelPermissions
forall x. Rep AccountLevelPermissions x -> AccountLevelPermissions
forall x. AccountLevelPermissions -> Rep AccountLevelPermissions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AccountLevelPermissions x -> AccountLevelPermissions
$cfrom :: forall x. AccountLevelPermissions -> Rep AccountLevelPermissions x
Prelude.Generic)

-- |
-- Create a value of 'AccountLevelPermissions' 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:
--
-- 'blockPublicAccess', 'accountLevelPermissions_blockPublicAccess' - The block public access settings for the Amazon Web Services account
-- that owns the bucket.
newAccountLevelPermissions ::
  AccountLevelPermissions
newAccountLevelPermissions :: AccountLevelPermissions
newAccountLevelPermissions =
  AccountLevelPermissions' :: Maybe BlockPublicAccess -> AccountLevelPermissions
AccountLevelPermissions'
    { $sel:blockPublicAccess:AccountLevelPermissions' :: Maybe BlockPublicAccess
blockPublicAccess =
        Maybe BlockPublicAccess
forall a. Maybe a
Prelude.Nothing
    }

-- | The block public access settings for the Amazon Web Services account
-- that owns the bucket.
accountLevelPermissions_blockPublicAccess :: Lens.Lens' AccountLevelPermissions (Prelude.Maybe BlockPublicAccess)
accountLevelPermissions_blockPublicAccess :: (Maybe BlockPublicAccess -> f (Maybe BlockPublicAccess))
-> AccountLevelPermissions -> f AccountLevelPermissions
accountLevelPermissions_blockPublicAccess = (AccountLevelPermissions -> Maybe BlockPublicAccess)
-> (AccountLevelPermissions
    -> Maybe BlockPublicAccess -> AccountLevelPermissions)
-> Lens
     AccountLevelPermissions
     AccountLevelPermissions
     (Maybe BlockPublicAccess)
     (Maybe BlockPublicAccess)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountLevelPermissions' {Maybe BlockPublicAccess
blockPublicAccess :: Maybe BlockPublicAccess
$sel:blockPublicAccess:AccountLevelPermissions' :: AccountLevelPermissions -> Maybe BlockPublicAccess
blockPublicAccess} -> Maybe BlockPublicAccess
blockPublicAccess) (\s :: AccountLevelPermissions
s@AccountLevelPermissions' {} Maybe BlockPublicAccess
a -> AccountLevelPermissions
s {$sel:blockPublicAccess:AccountLevelPermissions' :: Maybe BlockPublicAccess
blockPublicAccess = Maybe BlockPublicAccess
a} :: AccountLevelPermissions)

instance Core.FromJSON AccountLevelPermissions where
  parseJSON :: Value -> Parser AccountLevelPermissions
parseJSON =
    String
-> (Object -> Parser AccountLevelPermissions)
-> Value
-> Parser AccountLevelPermissions
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AccountLevelPermissions"
      ( \Object
x ->
          Maybe BlockPublicAccess -> AccountLevelPermissions
AccountLevelPermissions'
            (Maybe BlockPublicAccess -> AccountLevelPermissions)
-> Parser (Maybe BlockPublicAccess)
-> Parser AccountLevelPermissions
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe BlockPublicAccess)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"blockPublicAccess")
      )

instance Prelude.Hashable AccountLevelPermissions

instance Prelude.NFData AccountLevelPermissions