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

-- |
-- Create a value of 'GoogleAnalyticsSourceProperties' 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'', 'googleAnalyticsSourceProperties_object' - The object specified in the Google Analytics flow source.
newGoogleAnalyticsSourceProperties ::
  -- | 'object''
  Prelude.Text ->
  GoogleAnalyticsSourceProperties
newGoogleAnalyticsSourceProperties :: Text -> GoogleAnalyticsSourceProperties
newGoogleAnalyticsSourceProperties Text
pObject_ =
  GoogleAnalyticsSourceProperties' :: Text -> GoogleAnalyticsSourceProperties
GoogleAnalyticsSourceProperties'
    { $sel:object':GoogleAnalyticsSourceProperties' :: Text
object' =
        Text
pObject_
    }

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

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

instance
  Prelude.NFData
    GoogleAnalyticsSourceProperties

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