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

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

instance Prelude.Hashable LabelingJobSnsDataSource

instance Prelude.NFData LabelingJobSnsDataSource

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