{-# 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.DatadogSourceProperties
-- 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.DatadogSourceProperties 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 Datadog is being used as a source.
--
-- /See:/ 'newDatadogSourceProperties' smart constructor.
data DatadogSourceProperties = DatadogSourceProperties'
  { -- | The object specified in the Datadog flow source.
    DatadogSourceProperties -> Text
object' :: Prelude.Text
  }
  deriving (DatadogSourceProperties -> DatadogSourceProperties -> Bool
(DatadogSourceProperties -> DatadogSourceProperties -> Bool)
-> (DatadogSourceProperties -> DatadogSourceProperties -> Bool)
-> Eq DatadogSourceProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DatadogSourceProperties -> DatadogSourceProperties -> Bool
$c/= :: DatadogSourceProperties -> DatadogSourceProperties -> Bool
== :: DatadogSourceProperties -> DatadogSourceProperties -> Bool
$c== :: DatadogSourceProperties -> DatadogSourceProperties -> Bool
Prelude.Eq, ReadPrec [DatadogSourceProperties]
ReadPrec DatadogSourceProperties
Int -> ReadS DatadogSourceProperties
ReadS [DatadogSourceProperties]
(Int -> ReadS DatadogSourceProperties)
-> ReadS [DatadogSourceProperties]
-> ReadPrec DatadogSourceProperties
-> ReadPrec [DatadogSourceProperties]
-> Read DatadogSourceProperties
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DatadogSourceProperties]
$creadListPrec :: ReadPrec [DatadogSourceProperties]
readPrec :: ReadPrec DatadogSourceProperties
$creadPrec :: ReadPrec DatadogSourceProperties
readList :: ReadS [DatadogSourceProperties]
$creadList :: ReadS [DatadogSourceProperties]
readsPrec :: Int -> ReadS DatadogSourceProperties
$creadsPrec :: Int -> ReadS DatadogSourceProperties
Prelude.Read, Int -> DatadogSourceProperties -> ShowS
[DatadogSourceProperties] -> ShowS
DatadogSourceProperties -> String
(Int -> DatadogSourceProperties -> ShowS)
-> (DatadogSourceProperties -> String)
-> ([DatadogSourceProperties] -> ShowS)
-> Show DatadogSourceProperties
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DatadogSourceProperties] -> ShowS
$cshowList :: [DatadogSourceProperties] -> ShowS
show :: DatadogSourceProperties -> String
$cshow :: DatadogSourceProperties -> String
showsPrec :: Int -> DatadogSourceProperties -> ShowS
$cshowsPrec :: Int -> DatadogSourceProperties -> ShowS
Prelude.Show, (forall x.
 DatadogSourceProperties -> Rep DatadogSourceProperties x)
-> (forall x.
    Rep DatadogSourceProperties x -> DatadogSourceProperties)
-> Generic DatadogSourceProperties
forall x. Rep DatadogSourceProperties x -> DatadogSourceProperties
forall x. DatadogSourceProperties -> Rep DatadogSourceProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DatadogSourceProperties x -> DatadogSourceProperties
$cfrom :: forall x. DatadogSourceProperties -> Rep DatadogSourceProperties x
Prelude.Generic)

-- |
-- Create a value of 'DatadogSourceProperties' 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'', 'datadogSourceProperties_object' - The object specified in the Datadog flow source.
newDatadogSourceProperties ::
  -- | 'object''
  Prelude.Text ->
  DatadogSourceProperties
newDatadogSourceProperties :: Text -> DatadogSourceProperties
newDatadogSourceProperties Text
pObject_ =
  DatadogSourceProperties' :: Text -> DatadogSourceProperties
DatadogSourceProperties' {$sel:object':DatadogSourceProperties' :: Text
object' = Text
pObject_}

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

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

instance Prelude.NFData DatadogSourceProperties

instance Core.ToJSON DatadogSourceProperties where
  toJSON :: DatadogSourceProperties -> Value
toJSON DatadogSourceProperties' {Text
object' :: Text
$sel:object':DatadogSourceProperties' :: DatadogSourceProperties -> 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')]
      )