{-# 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.BucketCountByEffectivePermission
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MacieV2.Types.BucketCountByEffectivePermission where

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

-- | Provides information about the number of S3 buckets that are publicly
-- accessible based on a combination of permissions settings for each
-- bucket.
--
-- /See:/ 'newBucketCountByEffectivePermission' smart constructor.
data BucketCountByEffectivePermission = BucketCountByEffectivePermission'
  { -- | The total number of buckets that allow the general public to have read
    -- or write access to the bucket.
    BucketCountByEffectivePermission -> Maybe Integer
publiclyAccessible :: Prelude.Maybe Prelude.Integer,
    -- | The total number of buckets that allow the general public to have read
    -- access to the bucket.
    BucketCountByEffectivePermission -> Maybe Integer
publiclyReadable :: Prelude.Maybe Prelude.Integer,
    -- | The total number of buckets that allow the general public to have write
    -- access to the bucket.
    BucketCountByEffectivePermission -> Maybe Integer
publiclyWritable :: Prelude.Maybe Prelude.Integer,
    -- | The total number of buckets that Amazon Macie wasn\'t able to evaluate
    -- permissions settings for. Macie can\'t determine whether these buckets
    -- are publicly accessible.
    BucketCountByEffectivePermission -> Maybe Integer
unknown :: Prelude.Maybe Prelude.Integer
  }
  deriving (BucketCountByEffectivePermission
-> BucketCountByEffectivePermission -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BucketCountByEffectivePermission
-> BucketCountByEffectivePermission -> Bool
$c/= :: BucketCountByEffectivePermission
-> BucketCountByEffectivePermission -> Bool
== :: BucketCountByEffectivePermission
-> BucketCountByEffectivePermission -> Bool
$c== :: BucketCountByEffectivePermission
-> BucketCountByEffectivePermission -> Bool
Prelude.Eq, ReadPrec [BucketCountByEffectivePermission]
ReadPrec BucketCountByEffectivePermission
Int -> ReadS BucketCountByEffectivePermission
ReadS [BucketCountByEffectivePermission]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BucketCountByEffectivePermission]
$creadListPrec :: ReadPrec [BucketCountByEffectivePermission]
readPrec :: ReadPrec BucketCountByEffectivePermission
$creadPrec :: ReadPrec BucketCountByEffectivePermission
readList :: ReadS [BucketCountByEffectivePermission]
$creadList :: ReadS [BucketCountByEffectivePermission]
readsPrec :: Int -> ReadS BucketCountByEffectivePermission
$creadsPrec :: Int -> ReadS BucketCountByEffectivePermission
Prelude.Read, Int -> BucketCountByEffectivePermission -> ShowS
[BucketCountByEffectivePermission] -> ShowS
BucketCountByEffectivePermission -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BucketCountByEffectivePermission] -> ShowS
$cshowList :: [BucketCountByEffectivePermission] -> ShowS
show :: BucketCountByEffectivePermission -> String
$cshow :: BucketCountByEffectivePermission -> String
showsPrec :: Int -> BucketCountByEffectivePermission -> ShowS
$cshowsPrec :: Int -> BucketCountByEffectivePermission -> ShowS
Prelude.Show, forall x.
Rep BucketCountByEffectivePermission x
-> BucketCountByEffectivePermission
forall x.
BucketCountByEffectivePermission
-> Rep BucketCountByEffectivePermission x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BucketCountByEffectivePermission x
-> BucketCountByEffectivePermission
$cfrom :: forall x.
BucketCountByEffectivePermission
-> Rep BucketCountByEffectivePermission x
Prelude.Generic)

-- |
-- Create a value of 'BucketCountByEffectivePermission' 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:
--
-- 'publiclyAccessible', 'bucketCountByEffectivePermission_publiclyAccessible' - The total number of buckets that allow the general public to have read
-- or write access to the bucket.
--
-- 'publiclyReadable', 'bucketCountByEffectivePermission_publiclyReadable' - The total number of buckets that allow the general public to have read
-- access to the bucket.
--
-- 'publiclyWritable', 'bucketCountByEffectivePermission_publiclyWritable' - The total number of buckets that allow the general public to have write
-- access to the bucket.
--
-- 'unknown', 'bucketCountByEffectivePermission_unknown' - The total number of buckets that Amazon Macie wasn\'t able to evaluate
-- permissions settings for. Macie can\'t determine whether these buckets
-- are publicly accessible.
newBucketCountByEffectivePermission ::
  BucketCountByEffectivePermission
newBucketCountByEffectivePermission :: BucketCountByEffectivePermission
newBucketCountByEffectivePermission =
  BucketCountByEffectivePermission'
    { $sel:publiclyAccessible:BucketCountByEffectivePermission' :: Maybe Integer
publiclyAccessible =
        forall a. Maybe a
Prelude.Nothing,
      $sel:publiclyReadable:BucketCountByEffectivePermission' :: Maybe Integer
publiclyReadable = forall a. Maybe a
Prelude.Nothing,
      $sel:publiclyWritable:BucketCountByEffectivePermission' :: Maybe Integer
publiclyWritable = forall a. Maybe a
Prelude.Nothing,
      $sel:unknown:BucketCountByEffectivePermission' :: Maybe Integer
unknown = forall a. Maybe a
Prelude.Nothing
    }

-- | The total number of buckets that allow the general public to have read
-- or write access to the bucket.
bucketCountByEffectivePermission_publiclyAccessible :: Lens.Lens' BucketCountByEffectivePermission (Prelude.Maybe Prelude.Integer)
bucketCountByEffectivePermission_publiclyAccessible :: Lens' BucketCountByEffectivePermission (Maybe Integer)
bucketCountByEffectivePermission_publiclyAccessible = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BucketCountByEffectivePermission' {Maybe Integer
publiclyAccessible :: Maybe Integer
$sel:publiclyAccessible:BucketCountByEffectivePermission' :: BucketCountByEffectivePermission -> Maybe Integer
publiclyAccessible} -> Maybe Integer
publiclyAccessible) (\s :: BucketCountByEffectivePermission
s@BucketCountByEffectivePermission' {} Maybe Integer
a -> BucketCountByEffectivePermission
s {$sel:publiclyAccessible:BucketCountByEffectivePermission' :: Maybe Integer
publiclyAccessible = Maybe Integer
a} :: BucketCountByEffectivePermission)

-- | The total number of buckets that allow the general public to have read
-- access to the bucket.
bucketCountByEffectivePermission_publiclyReadable :: Lens.Lens' BucketCountByEffectivePermission (Prelude.Maybe Prelude.Integer)
bucketCountByEffectivePermission_publiclyReadable :: Lens' BucketCountByEffectivePermission (Maybe Integer)
bucketCountByEffectivePermission_publiclyReadable = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BucketCountByEffectivePermission' {Maybe Integer
publiclyReadable :: Maybe Integer
$sel:publiclyReadable:BucketCountByEffectivePermission' :: BucketCountByEffectivePermission -> Maybe Integer
publiclyReadable} -> Maybe Integer
publiclyReadable) (\s :: BucketCountByEffectivePermission
s@BucketCountByEffectivePermission' {} Maybe Integer
a -> BucketCountByEffectivePermission
s {$sel:publiclyReadable:BucketCountByEffectivePermission' :: Maybe Integer
publiclyReadable = Maybe Integer
a} :: BucketCountByEffectivePermission)

-- | The total number of buckets that allow the general public to have write
-- access to the bucket.
bucketCountByEffectivePermission_publiclyWritable :: Lens.Lens' BucketCountByEffectivePermission (Prelude.Maybe Prelude.Integer)
bucketCountByEffectivePermission_publiclyWritable :: Lens' BucketCountByEffectivePermission (Maybe Integer)
bucketCountByEffectivePermission_publiclyWritable = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BucketCountByEffectivePermission' {Maybe Integer
publiclyWritable :: Maybe Integer
$sel:publiclyWritable:BucketCountByEffectivePermission' :: BucketCountByEffectivePermission -> Maybe Integer
publiclyWritable} -> Maybe Integer
publiclyWritable) (\s :: BucketCountByEffectivePermission
s@BucketCountByEffectivePermission' {} Maybe Integer
a -> BucketCountByEffectivePermission
s {$sel:publiclyWritable:BucketCountByEffectivePermission' :: Maybe Integer
publiclyWritable = Maybe Integer
a} :: BucketCountByEffectivePermission)

-- | The total number of buckets that Amazon Macie wasn\'t able to evaluate
-- permissions settings for. Macie can\'t determine whether these buckets
-- are publicly accessible.
bucketCountByEffectivePermission_unknown :: Lens.Lens' BucketCountByEffectivePermission (Prelude.Maybe Prelude.Integer)
bucketCountByEffectivePermission_unknown :: Lens' BucketCountByEffectivePermission (Maybe Integer)
bucketCountByEffectivePermission_unknown = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BucketCountByEffectivePermission' {Maybe Integer
unknown :: Maybe Integer
$sel:unknown:BucketCountByEffectivePermission' :: BucketCountByEffectivePermission -> Maybe Integer
unknown} -> Maybe Integer
unknown) (\s :: BucketCountByEffectivePermission
s@BucketCountByEffectivePermission' {} Maybe Integer
a -> BucketCountByEffectivePermission
s {$sel:unknown:BucketCountByEffectivePermission' :: Maybe Integer
unknown = Maybe Integer
a} :: BucketCountByEffectivePermission)

instance
  Data.FromJSON
    BucketCountByEffectivePermission
  where
  parseJSON :: Value -> Parser BucketCountByEffectivePermission
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BucketCountByEffectivePermission"
      ( \Object
x ->
          Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> BucketCountByEffectivePermission
BucketCountByEffectivePermission'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"publiclyAccessible")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"publiclyReadable")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"publiclyWritable")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"unknown")
      )

instance
  Prelude.Hashable
    BucketCountByEffectivePermission
  where
  hashWithSalt :: Int -> BucketCountByEffectivePermission -> Int
hashWithSalt
    Int
_salt
    BucketCountByEffectivePermission' {Maybe Integer
unknown :: Maybe Integer
publiclyWritable :: Maybe Integer
publiclyReadable :: Maybe Integer
publiclyAccessible :: Maybe Integer
$sel:unknown:BucketCountByEffectivePermission' :: BucketCountByEffectivePermission -> Maybe Integer
$sel:publiclyWritable:BucketCountByEffectivePermission' :: BucketCountByEffectivePermission -> Maybe Integer
$sel:publiclyReadable:BucketCountByEffectivePermission' :: BucketCountByEffectivePermission -> Maybe Integer
$sel:publiclyAccessible:BucketCountByEffectivePermission' :: BucketCountByEffectivePermission -> Maybe Integer
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
publiclyAccessible
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
publiclyReadable
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
publiclyWritable
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
unknown

instance
  Prelude.NFData
    BucketCountByEffectivePermission
  where
  rnf :: BucketCountByEffectivePermission -> ()
rnf BucketCountByEffectivePermission' {Maybe Integer
unknown :: Maybe Integer
publiclyWritable :: Maybe Integer
publiclyReadable :: Maybe Integer
publiclyAccessible :: Maybe Integer
$sel:unknown:BucketCountByEffectivePermission' :: BucketCountByEffectivePermission -> Maybe Integer
$sel:publiclyWritable:BucketCountByEffectivePermission' :: BucketCountByEffectivePermission -> Maybe Integer
$sel:publiclyReadable:BucketCountByEffectivePermission' :: BucketCountByEffectivePermission -> Maybe Integer
$sel:publiclyAccessible:BucketCountByEffectivePermission' :: BucketCountByEffectivePermission -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
publiclyAccessible
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
publiclyReadable
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
publiclyWritable
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
unknown