{-# 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-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.BucketCountByEffectivePermission where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 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,
    -- | 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
  }
  deriving (BucketCountByEffectivePermission
-> BucketCountByEffectivePermission -> Bool
(BucketCountByEffectivePermission
 -> BucketCountByEffectivePermission -> Bool)
-> (BucketCountByEffectivePermission
    -> BucketCountByEffectivePermission -> Bool)
-> Eq BucketCountByEffectivePermission
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]
(Int -> ReadS BucketCountByEffectivePermission)
-> ReadS [BucketCountByEffectivePermission]
-> ReadPrec BucketCountByEffectivePermission
-> ReadPrec [BucketCountByEffectivePermission]
-> Read 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
(Int -> BucketCountByEffectivePermission -> ShowS)
-> (BucketCountByEffectivePermission -> String)
-> ([BucketCountByEffectivePermission] -> ShowS)
-> Show BucketCountByEffectivePermission
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.
 BucketCountByEffectivePermission
 -> Rep BucketCountByEffectivePermission x)
-> (forall x.
    Rep BucketCountByEffectivePermission x
    -> BucketCountByEffectivePermission)
-> Generic BucketCountByEffectivePermission
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.
--
-- '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.
--
-- '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.
newBucketCountByEffectivePermission ::
  BucketCountByEffectivePermission
newBucketCountByEffectivePermission :: BucketCountByEffectivePermission
newBucketCountByEffectivePermission =
  BucketCountByEffectivePermission' :: Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> BucketCountByEffectivePermission
BucketCountByEffectivePermission'
    { $sel:publiclyAccessible:BucketCountByEffectivePermission' :: Maybe Integer
publiclyAccessible =
        Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:unknown:BucketCountByEffectivePermission' :: Maybe Integer
unknown = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:publiclyReadable:BucketCountByEffectivePermission' :: Maybe Integer
publiclyReadable = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:publiclyWritable:BucketCountByEffectivePermission' :: Maybe Integer
publiclyWritable = Maybe Integer
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 :: (Maybe Integer -> f (Maybe Integer))
-> BucketCountByEffectivePermission
-> f BucketCountByEffectivePermission
bucketCountByEffectivePermission_publiclyAccessible = (BucketCountByEffectivePermission -> Maybe Integer)
-> (BucketCountByEffectivePermission
    -> Maybe Integer -> BucketCountByEffectivePermission)
-> Lens
     BucketCountByEffectivePermission
     BucketCountByEffectivePermission
     (Maybe Integer)
     (Maybe Integer)
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 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 :: (Maybe Integer -> f (Maybe Integer))
-> BucketCountByEffectivePermission
-> f BucketCountByEffectivePermission
bucketCountByEffectivePermission_unknown = (BucketCountByEffectivePermission -> Maybe Integer)
-> (BucketCountByEffectivePermission
    -> Maybe Integer -> BucketCountByEffectivePermission)
-> Lens
     BucketCountByEffectivePermission
     BucketCountByEffectivePermission
     (Maybe Integer)
     (Maybe Integer)
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)

-- | 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 :: (Maybe Integer -> f (Maybe Integer))
-> BucketCountByEffectivePermission
-> f BucketCountByEffectivePermission
bucketCountByEffectivePermission_publiclyReadable = (BucketCountByEffectivePermission -> Maybe Integer)
-> (BucketCountByEffectivePermission
    -> Maybe Integer -> BucketCountByEffectivePermission)
-> Lens
     BucketCountByEffectivePermission
     BucketCountByEffectivePermission
     (Maybe Integer)
     (Maybe Integer)
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 :: (Maybe Integer -> f (Maybe Integer))
-> BucketCountByEffectivePermission
-> f BucketCountByEffectivePermission
bucketCountByEffectivePermission_publiclyWritable = (BucketCountByEffectivePermission -> Maybe Integer)
-> (BucketCountByEffectivePermission
    -> Maybe Integer -> BucketCountByEffectivePermission)
-> Lens
     BucketCountByEffectivePermission
     BucketCountByEffectivePermission
     (Maybe Integer)
     (Maybe Integer)
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)

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

instance
  Prelude.Hashable
    BucketCountByEffectivePermission

instance
  Prelude.NFData
    BucketCountByEffectivePermission