{-# 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.S3.Types.PolicyStatus
-- 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.S3.Types.PolicyStatus 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
import Amazonka.S3.Internal

-- | The container element for a bucket\'s policy status.
--
-- /See:/ 'newPolicyStatus' smart constructor.
data PolicyStatus = PolicyStatus'
  { -- | The policy status for this bucket. @TRUE@ indicates that this bucket is
    -- public. @FALSE@ indicates that the bucket is not public.
    PolicyStatus -> Maybe Bool
isPublic :: Prelude.Maybe Prelude.Bool
  }
  deriving (PolicyStatus -> PolicyStatus -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PolicyStatus -> PolicyStatus -> Bool
$c/= :: PolicyStatus -> PolicyStatus -> Bool
== :: PolicyStatus -> PolicyStatus -> Bool
$c== :: PolicyStatus -> PolicyStatus -> Bool
Prelude.Eq, ReadPrec [PolicyStatus]
ReadPrec PolicyStatus
Int -> ReadS PolicyStatus
ReadS [PolicyStatus]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PolicyStatus]
$creadListPrec :: ReadPrec [PolicyStatus]
readPrec :: ReadPrec PolicyStatus
$creadPrec :: ReadPrec PolicyStatus
readList :: ReadS [PolicyStatus]
$creadList :: ReadS [PolicyStatus]
readsPrec :: Int -> ReadS PolicyStatus
$creadsPrec :: Int -> ReadS PolicyStatus
Prelude.Read, Int -> PolicyStatus -> ShowS
[PolicyStatus] -> ShowS
PolicyStatus -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PolicyStatus] -> ShowS
$cshowList :: [PolicyStatus] -> ShowS
show :: PolicyStatus -> String
$cshow :: PolicyStatus -> String
showsPrec :: Int -> PolicyStatus -> ShowS
$cshowsPrec :: Int -> PolicyStatus -> ShowS
Prelude.Show, forall x. Rep PolicyStatus x -> PolicyStatus
forall x. PolicyStatus -> Rep PolicyStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PolicyStatus x -> PolicyStatus
$cfrom :: forall x. PolicyStatus -> Rep PolicyStatus x
Prelude.Generic)

-- |
-- Create a value of 'PolicyStatus' 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:
--
-- 'isPublic', 'policyStatus_isPublic' - The policy status for this bucket. @TRUE@ indicates that this bucket is
-- public. @FALSE@ indicates that the bucket is not public.
newPolicyStatus ::
  PolicyStatus
newPolicyStatus :: PolicyStatus
newPolicyStatus =
  PolicyStatus' {$sel:isPublic:PolicyStatus' :: Maybe Bool
isPublic = forall a. Maybe a
Prelude.Nothing}

-- | The policy status for this bucket. @TRUE@ indicates that this bucket is
-- public. @FALSE@ indicates that the bucket is not public.
policyStatus_isPublic :: Lens.Lens' PolicyStatus (Prelude.Maybe Prelude.Bool)
policyStatus_isPublic :: Lens' PolicyStatus (Maybe Bool)
policyStatus_isPublic = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicyStatus' {Maybe Bool
isPublic :: Maybe Bool
$sel:isPublic:PolicyStatus' :: PolicyStatus -> Maybe Bool
isPublic} -> Maybe Bool
isPublic) (\s :: PolicyStatus
s@PolicyStatus' {} Maybe Bool
a -> PolicyStatus
s {$sel:isPublic:PolicyStatus' :: Maybe Bool
isPublic = Maybe Bool
a} :: PolicyStatus)

instance Data.FromXML PolicyStatus where
  parseXML :: [Node] -> Either String PolicyStatus
parseXML [Node]
x =
    Maybe Bool -> PolicyStatus
PolicyStatus' forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"IsPublic")

instance Prelude.Hashable PolicyStatus where
  hashWithSalt :: Int -> PolicyStatus -> Int
hashWithSalt Int
_salt PolicyStatus' {Maybe Bool
isPublic :: Maybe Bool
$sel:isPublic:PolicyStatus' :: PolicyStatus -> Maybe Bool
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
isPublic

instance Prelude.NFData PolicyStatus where
  rnf :: PolicyStatus -> ()
rnf PolicyStatus' {Maybe Bool
isPublic :: Maybe Bool
$sel:isPublic:PolicyStatus' :: PolicyStatus -> Maybe Bool
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
isPublic