{-# 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.AppFlow.Types.SlackSourceProperties
-- 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.AppFlow.Types.SlackSourceProperties where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The properties that are applied when Slack is being used as a source.
--
-- /See:/ 'newSlackSourceProperties' smart constructor.
data SlackSourceProperties = SlackSourceProperties'
  { -- | The object specified in the Slack flow source.
    SlackSourceProperties -> Text
object' :: Prelude.Text
  }
  deriving (SlackSourceProperties -> SlackSourceProperties -> Bool
(SlackSourceProperties -> SlackSourceProperties -> Bool)
-> (SlackSourceProperties -> SlackSourceProperties -> Bool)
-> Eq SlackSourceProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SlackSourceProperties -> SlackSourceProperties -> Bool
$c/= :: SlackSourceProperties -> SlackSourceProperties -> Bool
== :: SlackSourceProperties -> SlackSourceProperties -> Bool
$c== :: SlackSourceProperties -> SlackSourceProperties -> Bool
Prelude.Eq, ReadPrec [SlackSourceProperties]
ReadPrec SlackSourceProperties
Int -> ReadS SlackSourceProperties
ReadS [SlackSourceProperties]
(Int -> ReadS SlackSourceProperties)
-> ReadS [SlackSourceProperties]
-> ReadPrec SlackSourceProperties
-> ReadPrec [SlackSourceProperties]
-> Read SlackSourceProperties
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SlackSourceProperties]
$creadListPrec :: ReadPrec [SlackSourceProperties]
readPrec :: ReadPrec SlackSourceProperties
$creadPrec :: ReadPrec SlackSourceProperties
readList :: ReadS [SlackSourceProperties]
$creadList :: ReadS [SlackSourceProperties]
readsPrec :: Int -> ReadS SlackSourceProperties
$creadsPrec :: Int -> ReadS SlackSourceProperties
Prelude.Read, Int -> SlackSourceProperties -> ShowS
[SlackSourceProperties] -> ShowS
SlackSourceProperties -> String
(Int -> SlackSourceProperties -> ShowS)
-> (SlackSourceProperties -> String)
-> ([SlackSourceProperties] -> ShowS)
-> Show SlackSourceProperties
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SlackSourceProperties] -> ShowS
$cshowList :: [SlackSourceProperties] -> ShowS
show :: SlackSourceProperties -> String
$cshow :: SlackSourceProperties -> String
showsPrec :: Int -> SlackSourceProperties -> ShowS
$cshowsPrec :: Int -> SlackSourceProperties -> ShowS
Prelude.Show, (forall x. SlackSourceProperties -> Rep SlackSourceProperties x)
-> (forall x. Rep SlackSourceProperties x -> SlackSourceProperties)
-> Generic SlackSourceProperties
forall x. Rep SlackSourceProperties x -> SlackSourceProperties
forall x. SlackSourceProperties -> Rep SlackSourceProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SlackSourceProperties x -> SlackSourceProperties
$cfrom :: forall x. SlackSourceProperties -> Rep SlackSourceProperties x
Prelude.Generic)

-- |
-- Create a value of 'SlackSourceProperties' 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:
--
-- 'object'', 'slackSourceProperties_object' - The object specified in the Slack flow source.
newSlackSourceProperties ::
  -- | 'object''
  Prelude.Text ->
  SlackSourceProperties
newSlackSourceProperties :: Text -> SlackSourceProperties
newSlackSourceProperties Text
pObject_ =
  SlackSourceProperties' :: Text -> SlackSourceProperties
SlackSourceProperties' {$sel:object':SlackSourceProperties' :: Text
object' = Text
pObject_}

-- | The object specified in the Slack flow source.
slackSourceProperties_object :: Lens.Lens' SlackSourceProperties Prelude.Text
slackSourceProperties_object :: (Text -> f Text)
-> SlackSourceProperties -> f SlackSourceProperties
slackSourceProperties_object = (SlackSourceProperties -> Text)
-> (SlackSourceProperties -> Text -> SlackSourceProperties)
-> Lens SlackSourceProperties SlackSourceProperties Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SlackSourceProperties' {Text
object' :: Text
$sel:object':SlackSourceProperties' :: SlackSourceProperties -> Text
object'} -> Text
object') (\s :: SlackSourceProperties
s@SlackSourceProperties' {} Text
a -> SlackSourceProperties
s {$sel:object':SlackSourceProperties' :: Text
object' = Text
a} :: SlackSourceProperties)

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

instance Prelude.Hashable SlackSourceProperties

instance Prelude.NFData SlackSourceProperties

instance Core.ToJSON SlackSourceProperties where
  toJSON :: SlackSourceProperties -> Value
toJSON SlackSourceProperties' {Text
object' :: Text
$sel:object':SlackSourceProperties' :: SlackSourceProperties -> 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
"object" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
object')]
      )