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

-- |
-- Create a value of 'DynatraceSourceProperties' 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'', 'dynatraceSourceProperties_object' - The object specified in the Dynatrace flow source.
newDynatraceSourceProperties ::
  -- | 'object''
  Prelude.Text ->
  DynatraceSourceProperties
newDynatraceSourceProperties :: Text -> DynatraceSourceProperties
newDynatraceSourceProperties Text
pObject_ =
  DynatraceSourceProperties' :: Text -> DynatraceSourceProperties
DynatraceSourceProperties' {$sel:object':DynatraceSourceProperties' :: Text
object' = Text
pObject_}

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

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

instance Prelude.NFData DynatraceSourceProperties

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