{-# 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.AccessAnalyzer.Types.SqsQueueConfiguration
-- 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.AccessAnalyzer.Types.SqsQueueConfiguration 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

-- | The proposed access control configuration for an Amazon SQS queue. You
-- can propose a configuration for a new Amazon SQS queue or an existing
-- Amazon SQS queue that you own by specifying the Amazon SQS policy. If
-- the configuration is for an existing Amazon SQS queue and you do not
-- specify the Amazon SQS policy, the access preview uses the existing
-- Amazon SQS policy for the queue. If the access preview is for a new
-- resource and you do not specify the policy, the access preview assumes
-- an Amazon SQS queue without a policy. To propose deletion of an existing
-- Amazon SQS queue policy, you can specify an empty string for the Amazon
-- SQS policy. For more information about Amazon SQS policy limits, see
-- <https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/quotas-policies.html Quotas related to policies>.
--
-- /See:/ 'newSqsQueueConfiguration' smart constructor.
data SqsQueueConfiguration = SqsQueueConfiguration'
  { -- | The proposed resource policy for the Amazon SQS queue.
    SqsQueueConfiguration -> Maybe Text
queuePolicy :: Prelude.Maybe Prelude.Text
  }
  deriving (SqsQueueConfiguration -> SqsQueueConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SqsQueueConfiguration -> SqsQueueConfiguration -> Bool
$c/= :: SqsQueueConfiguration -> SqsQueueConfiguration -> Bool
== :: SqsQueueConfiguration -> SqsQueueConfiguration -> Bool
$c== :: SqsQueueConfiguration -> SqsQueueConfiguration -> Bool
Prelude.Eq, ReadPrec [SqsQueueConfiguration]
ReadPrec SqsQueueConfiguration
Int -> ReadS SqsQueueConfiguration
ReadS [SqsQueueConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SqsQueueConfiguration]
$creadListPrec :: ReadPrec [SqsQueueConfiguration]
readPrec :: ReadPrec SqsQueueConfiguration
$creadPrec :: ReadPrec SqsQueueConfiguration
readList :: ReadS [SqsQueueConfiguration]
$creadList :: ReadS [SqsQueueConfiguration]
readsPrec :: Int -> ReadS SqsQueueConfiguration
$creadsPrec :: Int -> ReadS SqsQueueConfiguration
Prelude.Read, Int -> SqsQueueConfiguration -> ShowS
[SqsQueueConfiguration] -> ShowS
SqsQueueConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SqsQueueConfiguration] -> ShowS
$cshowList :: [SqsQueueConfiguration] -> ShowS
show :: SqsQueueConfiguration -> String
$cshow :: SqsQueueConfiguration -> String
showsPrec :: Int -> SqsQueueConfiguration -> ShowS
$cshowsPrec :: Int -> SqsQueueConfiguration -> ShowS
Prelude.Show, forall x. Rep SqsQueueConfiguration x -> SqsQueueConfiguration
forall x. SqsQueueConfiguration -> Rep SqsQueueConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SqsQueueConfiguration x -> SqsQueueConfiguration
$cfrom :: forall x. SqsQueueConfiguration -> Rep SqsQueueConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'SqsQueueConfiguration' 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:
--
-- 'queuePolicy', 'sqsQueueConfiguration_queuePolicy' - The proposed resource policy for the Amazon SQS queue.
newSqsQueueConfiguration ::
  SqsQueueConfiguration
newSqsQueueConfiguration :: SqsQueueConfiguration
newSqsQueueConfiguration =
  SqsQueueConfiguration'
    { $sel:queuePolicy:SqsQueueConfiguration' :: Maybe Text
queuePolicy =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The proposed resource policy for the Amazon SQS queue.
sqsQueueConfiguration_queuePolicy :: Lens.Lens' SqsQueueConfiguration (Prelude.Maybe Prelude.Text)
sqsQueueConfiguration_queuePolicy :: Lens' SqsQueueConfiguration (Maybe Text)
sqsQueueConfiguration_queuePolicy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SqsQueueConfiguration' {Maybe Text
queuePolicy :: Maybe Text
$sel:queuePolicy:SqsQueueConfiguration' :: SqsQueueConfiguration -> Maybe Text
queuePolicy} -> Maybe Text
queuePolicy) (\s :: SqsQueueConfiguration
s@SqsQueueConfiguration' {} Maybe Text
a -> SqsQueueConfiguration
s {$sel:queuePolicy:SqsQueueConfiguration' :: Maybe Text
queuePolicy = Maybe Text
a} :: SqsQueueConfiguration)

instance Data.FromJSON SqsQueueConfiguration where
  parseJSON :: Value -> Parser SqsQueueConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SqsQueueConfiguration"
      ( \Object
x ->
          Maybe Text -> SqsQueueConfiguration
SqsQueueConfiguration'
            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
"queuePolicy")
      )

instance Prelude.Hashable SqsQueueConfiguration where
  hashWithSalt :: Int -> SqsQueueConfiguration -> Int
hashWithSalt Int
_salt SqsQueueConfiguration' {Maybe Text
queuePolicy :: Maybe Text
$sel:queuePolicy:SqsQueueConfiguration' :: SqsQueueConfiguration -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
queuePolicy

instance Prelude.NFData SqsQueueConfiguration where
  rnf :: SqsQueueConfiguration -> ()
rnf SqsQueueConfiguration' {Maybe Text
queuePolicy :: Maybe Text
$sel:queuePolicy:SqsQueueConfiguration' :: SqsQueueConfiguration -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
queuePolicy

instance Data.ToJSON SqsQueueConfiguration where
  toJSON :: SqsQueueConfiguration -> Value
toJSON SqsQueueConfiguration' {Maybe Text
queuePolicy :: Maybe Text
$sel:queuePolicy:SqsQueueConfiguration' :: SqsQueueConfiguration -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"queuePolicy" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
queuePolicy]
      )