{-# 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.SageMaker.Types.LabelingJobSnsDataSource
-- 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.SageMaker.Types.LabelingJobSnsDataSource 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

-- | An Amazon SNS data source used for streaming labeling jobs.
--
-- /See:/ 'newLabelingJobSnsDataSource' smart constructor.
data LabelingJobSnsDataSource = LabelingJobSnsDataSource'
  { -- | The Amazon SNS input topic Amazon Resource Name (ARN). Specify the ARN
    -- of the input topic you will use to send new data objects to a streaming
    -- labeling job.
    LabelingJobSnsDataSource -> Text
snsTopicArn :: Prelude.Text
  }
  deriving (LabelingJobSnsDataSource -> LabelingJobSnsDataSource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LabelingJobSnsDataSource -> LabelingJobSnsDataSource -> Bool
$c/= :: LabelingJobSnsDataSource -> LabelingJobSnsDataSource -> Bool
== :: LabelingJobSnsDataSource -> LabelingJobSnsDataSource -> Bool
$c== :: LabelingJobSnsDataSource -> LabelingJobSnsDataSource -> Bool
Prelude.Eq, ReadPrec [LabelingJobSnsDataSource]
ReadPrec LabelingJobSnsDataSource
Int -> ReadS LabelingJobSnsDataSource
ReadS [LabelingJobSnsDataSource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LabelingJobSnsDataSource]
$creadListPrec :: ReadPrec [LabelingJobSnsDataSource]
readPrec :: ReadPrec LabelingJobSnsDataSource
$creadPrec :: ReadPrec LabelingJobSnsDataSource
readList :: ReadS [LabelingJobSnsDataSource]
$creadList :: ReadS [LabelingJobSnsDataSource]
readsPrec :: Int -> ReadS LabelingJobSnsDataSource
$creadsPrec :: Int -> ReadS LabelingJobSnsDataSource
Prelude.Read, Int -> LabelingJobSnsDataSource -> ShowS
[LabelingJobSnsDataSource] -> ShowS
LabelingJobSnsDataSource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LabelingJobSnsDataSource] -> ShowS
$cshowList :: [LabelingJobSnsDataSource] -> ShowS
show :: LabelingJobSnsDataSource -> String
$cshow :: LabelingJobSnsDataSource -> String
showsPrec :: Int -> LabelingJobSnsDataSource -> ShowS
$cshowsPrec :: Int -> LabelingJobSnsDataSource -> ShowS
Prelude.Show, forall x.
Rep LabelingJobSnsDataSource x -> LabelingJobSnsDataSource
forall x.
LabelingJobSnsDataSource -> Rep LabelingJobSnsDataSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LabelingJobSnsDataSource x -> LabelingJobSnsDataSource
$cfrom :: forall x.
LabelingJobSnsDataSource -> Rep LabelingJobSnsDataSource x
Prelude.Generic)

-- |
-- Create a value of 'LabelingJobSnsDataSource' 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:
--
-- 'snsTopicArn', 'labelingJobSnsDataSource_snsTopicArn' - The Amazon SNS input topic Amazon Resource Name (ARN). Specify the ARN
-- of the input topic you will use to send new data objects to a streaming
-- labeling job.
newLabelingJobSnsDataSource ::
  -- | 'snsTopicArn'
  Prelude.Text ->
  LabelingJobSnsDataSource
newLabelingJobSnsDataSource :: Text -> LabelingJobSnsDataSource
newLabelingJobSnsDataSource Text
pSnsTopicArn_ =
  LabelingJobSnsDataSource'
    { $sel:snsTopicArn:LabelingJobSnsDataSource' :: Text
snsTopicArn =
        Text
pSnsTopicArn_
    }

-- | The Amazon SNS input topic Amazon Resource Name (ARN). Specify the ARN
-- of the input topic you will use to send new data objects to a streaming
-- labeling job.
labelingJobSnsDataSource_snsTopicArn :: Lens.Lens' LabelingJobSnsDataSource Prelude.Text
labelingJobSnsDataSource_snsTopicArn :: Lens' LabelingJobSnsDataSource Text
labelingJobSnsDataSource_snsTopicArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LabelingJobSnsDataSource' {Text
snsTopicArn :: Text
$sel:snsTopicArn:LabelingJobSnsDataSource' :: LabelingJobSnsDataSource -> Text
snsTopicArn} -> Text
snsTopicArn) (\s :: LabelingJobSnsDataSource
s@LabelingJobSnsDataSource' {} Text
a -> LabelingJobSnsDataSource
s {$sel:snsTopicArn:LabelingJobSnsDataSource' :: Text
snsTopicArn = Text
a} :: LabelingJobSnsDataSource)

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

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

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

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