{-# 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.GoogleAnalyticsMetadata
-- 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.GoogleAnalyticsMetadata where

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

-- | The connector metadata specific to Google Analytics.
--
-- /See:/ 'newGoogleAnalyticsMetadata' smart constructor.
data GoogleAnalyticsMetadata = GoogleAnalyticsMetadata'
  { -- | The desired authorization scope for the Google Analytics account.
    GoogleAnalyticsMetadata -> Maybe [Text]
oAuthScopes :: Prelude.Maybe [Prelude.Text]
  }
  deriving (GoogleAnalyticsMetadata -> GoogleAnalyticsMetadata -> Bool
(GoogleAnalyticsMetadata -> GoogleAnalyticsMetadata -> Bool)
-> (GoogleAnalyticsMetadata -> GoogleAnalyticsMetadata -> Bool)
-> Eq GoogleAnalyticsMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GoogleAnalyticsMetadata -> GoogleAnalyticsMetadata -> Bool
$c/= :: GoogleAnalyticsMetadata -> GoogleAnalyticsMetadata -> Bool
== :: GoogleAnalyticsMetadata -> GoogleAnalyticsMetadata -> Bool
$c== :: GoogleAnalyticsMetadata -> GoogleAnalyticsMetadata -> Bool
Prelude.Eq, ReadPrec [GoogleAnalyticsMetadata]
ReadPrec GoogleAnalyticsMetadata
Int -> ReadS GoogleAnalyticsMetadata
ReadS [GoogleAnalyticsMetadata]
(Int -> ReadS GoogleAnalyticsMetadata)
-> ReadS [GoogleAnalyticsMetadata]
-> ReadPrec GoogleAnalyticsMetadata
-> ReadPrec [GoogleAnalyticsMetadata]
-> Read GoogleAnalyticsMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GoogleAnalyticsMetadata]
$creadListPrec :: ReadPrec [GoogleAnalyticsMetadata]
readPrec :: ReadPrec GoogleAnalyticsMetadata
$creadPrec :: ReadPrec GoogleAnalyticsMetadata
readList :: ReadS [GoogleAnalyticsMetadata]
$creadList :: ReadS [GoogleAnalyticsMetadata]
readsPrec :: Int -> ReadS GoogleAnalyticsMetadata
$creadsPrec :: Int -> ReadS GoogleAnalyticsMetadata
Prelude.Read, Int -> GoogleAnalyticsMetadata -> ShowS
[GoogleAnalyticsMetadata] -> ShowS
GoogleAnalyticsMetadata -> String
(Int -> GoogleAnalyticsMetadata -> ShowS)
-> (GoogleAnalyticsMetadata -> String)
-> ([GoogleAnalyticsMetadata] -> ShowS)
-> Show GoogleAnalyticsMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GoogleAnalyticsMetadata] -> ShowS
$cshowList :: [GoogleAnalyticsMetadata] -> ShowS
show :: GoogleAnalyticsMetadata -> String
$cshow :: GoogleAnalyticsMetadata -> String
showsPrec :: Int -> GoogleAnalyticsMetadata -> ShowS
$cshowsPrec :: Int -> GoogleAnalyticsMetadata -> ShowS
Prelude.Show, (forall x.
 GoogleAnalyticsMetadata -> Rep GoogleAnalyticsMetadata x)
-> (forall x.
    Rep GoogleAnalyticsMetadata x -> GoogleAnalyticsMetadata)
-> Generic GoogleAnalyticsMetadata
forall x. Rep GoogleAnalyticsMetadata x -> GoogleAnalyticsMetadata
forall x. GoogleAnalyticsMetadata -> Rep GoogleAnalyticsMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GoogleAnalyticsMetadata x -> GoogleAnalyticsMetadata
$cfrom :: forall x. GoogleAnalyticsMetadata -> Rep GoogleAnalyticsMetadata x
Prelude.Generic)

-- |
-- Create a value of 'GoogleAnalyticsMetadata' 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:
--
-- 'oAuthScopes', 'googleAnalyticsMetadata_oAuthScopes' - The desired authorization scope for the Google Analytics account.
newGoogleAnalyticsMetadata ::
  GoogleAnalyticsMetadata
newGoogleAnalyticsMetadata :: GoogleAnalyticsMetadata
newGoogleAnalyticsMetadata =
  GoogleAnalyticsMetadata' :: Maybe [Text] -> GoogleAnalyticsMetadata
GoogleAnalyticsMetadata'
    { $sel:oAuthScopes:GoogleAnalyticsMetadata' :: Maybe [Text]
oAuthScopes =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | The desired authorization scope for the Google Analytics account.
googleAnalyticsMetadata_oAuthScopes :: Lens.Lens' GoogleAnalyticsMetadata (Prelude.Maybe [Prelude.Text])
googleAnalyticsMetadata_oAuthScopes :: (Maybe [Text] -> f (Maybe [Text]))
-> GoogleAnalyticsMetadata -> f GoogleAnalyticsMetadata
googleAnalyticsMetadata_oAuthScopes = (GoogleAnalyticsMetadata -> Maybe [Text])
-> (GoogleAnalyticsMetadata
    -> Maybe [Text] -> GoogleAnalyticsMetadata)
-> Lens
     GoogleAnalyticsMetadata
     GoogleAnalyticsMetadata
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GoogleAnalyticsMetadata' {Maybe [Text]
oAuthScopes :: Maybe [Text]
$sel:oAuthScopes:GoogleAnalyticsMetadata' :: GoogleAnalyticsMetadata -> Maybe [Text]
oAuthScopes} -> Maybe [Text]
oAuthScopes) (\s :: GoogleAnalyticsMetadata
s@GoogleAnalyticsMetadata' {} Maybe [Text]
a -> GoogleAnalyticsMetadata
s {$sel:oAuthScopes:GoogleAnalyticsMetadata' :: Maybe [Text]
oAuthScopes = Maybe [Text]
a} :: GoogleAnalyticsMetadata) ((Maybe [Text] -> f (Maybe [Text]))
 -> GoogleAnalyticsMetadata -> f GoogleAnalyticsMetadata)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> GoogleAnalyticsMetadata
-> f GoogleAnalyticsMetadata
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON GoogleAnalyticsMetadata where
  parseJSON :: Value -> Parser GoogleAnalyticsMetadata
parseJSON =
    String
-> (Object -> Parser GoogleAnalyticsMetadata)
-> Value
-> Parser GoogleAnalyticsMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"GoogleAnalyticsMetadata"
      ( \Object
x ->
          Maybe [Text] -> GoogleAnalyticsMetadata
GoogleAnalyticsMetadata'
            (Maybe [Text] -> GoogleAnalyticsMetadata)
-> Parser (Maybe [Text]) -> Parser GoogleAnalyticsMetadata
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"oAuthScopes" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable GoogleAnalyticsMetadata

instance Prelude.NFData GoogleAnalyticsMetadata