{-# 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.TimeStreamQuery.Types.SnsConfiguration
-- 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.TimeStreamQuery.Types.SnsConfiguration 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

-- | Details on SNS that are required to send the notification.
--
-- /See:/ 'newSnsConfiguration' smart constructor.
data SnsConfiguration = SnsConfiguration'
  { -- | SNS topic ARN that the scheduled query status notifications will be sent
    -- to.
    SnsConfiguration -> Text
topicArn :: Prelude.Text
  }
  deriving (SnsConfiguration -> SnsConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SnsConfiguration -> SnsConfiguration -> Bool
$c/= :: SnsConfiguration -> SnsConfiguration -> Bool
== :: SnsConfiguration -> SnsConfiguration -> Bool
$c== :: SnsConfiguration -> SnsConfiguration -> Bool
Prelude.Eq, ReadPrec [SnsConfiguration]
ReadPrec SnsConfiguration
Int -> ReadS SnsConfiguration
ReadS [SnsConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SnsConfiguration]
$creadListPrec :: ReadPrec [SnsConfiguration]
readPrec :: ReadPrec SnsConfiguration
$creadPrec :: ReadPrec SnsConfiguration
readList :: ReadS [SnsConfiguration]
$creadList :: ReadS [SnsConfiguration]
readsPrec :: Int -> ReadS SnsConfiguration
$creadsPrec :: Int -> ReadS SnsConfiguration
Prelude.Read, Int -> SnsConfiguration -> ShowS
[SnsConfiguration] -> ShowS
SnsConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SnsConfiguration] -> ShowS
$cshowList :: [SnsConfiguration] -> ShowS
show :: SnsConfiguration -> String
$cshow :: SnsConfiguration -> String
showsPrec :: Int -> SnsConfiguration -> ShowS
$cshowsPrec :: Int -> SnsConfiguration -> ShowS
Prelude.Show, forall x. Rep SnsConfiguration x -> SnsConfiguration
forall x. SnsConfiguration -> Rep SnsConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SnsConfiguration x -> SnsConfiguration
$cfrom :: forall x. SnsConfiguration -> Rep SnsConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'SnsConfiguration' 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:
--
-- 'topicArn', 'snsConfiguration_topicArn' - SNS topic ARN that the scheduled query status notifications will be sent
-- to.
newSnsConfiguration ::
  -- | 'topicArn'
  Prelude.Text ->
  SnsConfiguration
newSnsConfiguration :: Text -> SnsConfiguration
newSnsConfiguration Text
pTopicArn_ =
  SnsConfiguration' {$sel:topicArn:SnsConfiguration' :: Text
topicArn = Text
pTopicArn_}

-- | SNS topic ARN that the scheduled query status notifications will be sent
-- to.
snsConfiguration_topicArn :: Lens.Lens' SnsConfiguration Prelude.Text
snsConfiguration_topicArn :: Lens' SnsConfiguration Text
snsConfiguration_topicArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnsConfiguration' {Text
topicArn :: Text
$sel:topicArn:SnsConfiguration' :: SnsConfiguration -> Text
topicArn} -> Text
topicArn) (\s :: SnsConfiguration
s@SnsConfiguration' {} Text
a -> SnsConfiguration
s {$sel:topicArn:SnsConfiguration' :: Text
topicArn = Text
a} :: SnsConfiguration)

instance Data.FromJSON SnsConfiguration where
  parseJSON :: Value -> Parser SnsConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SnsConfiguration"
      ( \Object
x ->
          Text -> SnsConfiguration
SnsConfiguration' forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"TopicArn")
      )

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

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

instance Data.ToJSON SnsConfiguration where
  toJSON :: SnsConfiguration -> Value
toJSON SnsConfiguration' {Text
topicArn :: Text
$sel:topicArn:SnsConfiguration' :: SnsConfiguration -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"TopicArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
topicArn)]
      )