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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(SqsQueueConfiguration -> SqsQueueConfiguration -> Bool)
-> (SqsQueueConfiguration -> SqsQueueConfiguration -> Bool)
-> Eq SqsQueueConfiguration
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]
(Int -> ReadS SqsQueueConfiguration)
-> ReadS [SqsQueueConfiguration]
-> ReadPrec SqsQueueConfiguration
-> ReadPrec [SqsQueueConfiguration]
-> Read 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
(Int -> SqsQueueConfiguration -> ShowS)
-> (SqsQueueConfiguration -> String)
-> ([SqsQueueConfiguration] -> ShowS)
-> Show SqsQueueConfiguration
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. SqsQueueConfiguration -> Rep SqsQueueConfiguration x)
-> (forall x. Rep SqsQueueConfiguration x -> SqsQueueConfiguration)
-> Generic SqsQueueConfiguration
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' :: Maybe Text -> SqsQueueConfiguration
SqsQueueConfiguration'
    { $sel:queuePolicy:SqsQueueConfiguration' :: Maybe Text
queuePolicy =
        Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> SqsQueueConfiguration -> f SqsQueueConfiguration
sqsQueueConfiguration_queuePolicy = (SqsQueueConfiguration -> Maybe Text)
-> (SqsQueueConfiguration -> Maybe Text -> SqsQueueConfiguration)
-> Lens
     SqsQueueConfiguration
     SqsQueueConfiguration
     (Maybe Text)
     (Maybe Text)
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 Core.FromJSON SqsQueueConfiguration where
  parseJSON :: Value -> Parser SqsQueueConfiguration
parseJSON =
    String
-> (Object -> Parser SqsQueueConfiguration)
-> Value
-> Parser SqsQueueConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SqsQueueConfiguration"
      ( \Object
x ->
          Maybe Text -> SqsQueueConfiguration
SqsQueueConfiguration'
            (Maybe Text -> SqsQueueConfiguration)
-> Parser (Maybe Text) -> Parser SqsQueueConfiguration
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"queuePolicy")
      )

instance Prelude.Hashable SqsQueueConfiguration

instance Prelude.NFData SqsQueueConfiguration

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