{-# 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-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.S3.Types.PolicyStatus where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(PolicyStatus -> PolicyStatus -> Bool)
-> (PolicyStatus -> PolicyStatus -> Bool) -> Eq PolicyStatus
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]
(Int -> ReadS PolicyStatus)
-> ReadS [PolicyStatus]
-> ReadPrec PolicyStatus
-> ReadPrec [PolicyStatus]
-> Read 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
(Int -> PolicyStatus -> ShowS)
-> (PolicyStatus -> String)
-> ([PolicyStatus] -> ShowS)
-> Show PolicyStatus
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. PolicyStatus -> Rep PolicyStatus x)
-> (forall x. Rep PolicyStatus x -> PolicyStatus)
-> Generic PolicyStatus
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' :: Maybe Bool -> PolicyStatus
PolicyStatus' {$sel:isPublic:PolicyStatus' :: Maybe Bool
isPublic = Maybe Bool
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 :: (Maybe Bool -> f (Maybe Bool)) -> PolicyStatus -> f PolicyStatus
policyStatus_isPublic = (PolicyStatus -> Maybe Bool)
-> (PolicyStatus -> Maybe Bool -> PolicyStatus)
-> Lens PolicyStatus PolicyStatus (Maybe Bool) (Maybe Bool)
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 Core.FromXML PolicyStatus where
  parseXML :: [Node] -> Either String PolicyStatus
parseXML [Node]
x =
    Maybe Bool -> PolicyStatus
PolicyStatus' (Maybe Bool -> PolicyStatus)
-> Either String (Maybe Bool) -> Either String PolicyStatus
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"IsPublic")

instance Prelude.Hashable PolicyStatus

instance Prelude.NFData PolicyStatus