{-# 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.Glue.Types.CrawlerTargets
-- 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.Glue.Types.CrawlerTargets where

import qualified Amazonka.Core as Core
import Amazonka.Glue.Types.CatalogTarget
import Amazonka.Glue.Types.DynamoDBTarget
import Amazonka.Glue.Types.JdbcTarget
import Amazonka.Glue.Types.MongoDBTarget
import Amazonka.Glue.Types.S3Target
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Specifies data stores to crawl.
--
-- /See:/ 'newCrawlerTargets' smart constructor.
data CrawlerTargets = CrawlerTargets'
  { -- | Specifies Amazon DynamoDB targets.
    CrawlerTargets -> Maybe [DynamoDBTarget]
dynamoDBTargets :: Prelude.Maybe [DynamoDBTarget],
    -- | Specifies Amazon Simple Storage Service (Amazon S3) targets.
    CrawlerTargets -> Maybe [S3Target]
s3Targets :: Prelude.Maybe [S3Target],
    -- | Specifies Amazon DocumentDB or MongoDB targets.
    CrawlerTargets -> Maybe [MongoDBTarget]
mongoDBTargets :: Prelude.Maybe [MongoDBTarget],
    -- | Specifies Glue Data Catalog targets.
    CrawlerTargets -> Maybe [CatalogTarget]
catalogTargets :: Prelude.Maybe [CatalogTarget],
    -- | Specifies JDBC targets.
    CrawlerTargets -> Maybe [JdbcTarget]
jdbcTargets :: Prelude.Maybe [JdbcTarget]
  }
  deriving (CrawlerTargets -> CrawlerTargets -> Bool
(CrawlerTargets -> CrawlerTargets -> Bool)
-> (CrawlerTargets -> CrawlerTargets -> Bool) -> Eq CrawlerTargets
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CrawlerTargets -> CrawlerTargets -> Bool
$c/= :: CrawlerTargets -> CrawlerTargets -> Bool
== :: CrawlerTargets -> CrawlerTargets -> Bool
$c== :: CrawlerTargets -> CrawlerTargets -> Bool
Prelude.Eq, ReadPrec [CrawlerTargets]
ReadPrec CrawlerTargets
Int -> ReadS CrawlerTargets
ReadS [CrawlerTargets]
(Int -> ReadS CrawlerTargets)
-> ReadS [CrawlerTargets]
-> ReadPrec CrawlerTargets
-> ReadPrec [CrawlerTargets]
-> Read CrawlerTargets
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CrawlerTargets]
$creadListPrec :: ReadPrec [CrawlerTargets]
readPrec :: ReadPrec CrawlerTargets
$creadPrec :: ReadPrec CrawlerTargets
readList :: ReadS [CrawlerTargets]
$creadList :: ReadS [CrawlerTargets]
readsPrec :: Int -> ReadS CrawlerTargets
$creadsPrec :: Int -> ReadS CrawlerTargets
Prelude.Read, Int -> CrawlerTargets -> ShowS
[CrawlerTargets] -> ShowS
CrawlerTargets -> String
(Int -> CrawlerTargets -> ShowS)
-> (CrawlerTargets -> String)
-> ([CrawlerTargets] -> ShowS)
-> Show CrawlerTargets
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CrawlerTargets] -> ShowS
$cshowList :: [CrawlerTargets] -> ShowS
show :: CrawlerTargets -> String
$cshow :: CrawlerTargets -> String
showsPrec :: Int -> CrawlerTargets -> ShowS
$cshowsPrec :: Int -> CrawlerTargets -> ShowS
Prelude.Show, (forall x. CrawlerTargets -> Rep CrawlerTargets x)
-> (forall x. Rep CrawlerTargets x -> CrawlerTargets)
-> Generic CrawlerTargets
forall x. Rep CrawlerTargets x -> CrawlerTargets
forall x. CrawlerTargets -> Rep CrawlerTargets x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CrawlerTargets x -> CrawlerTargets
$cfrom :: forall x. CrawlerTargets -> Rep CrawlerTargets x
Prelude.Generic)

-- |
-- Create a value of 'CrawlerTargets' 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:
--
-- 'dynamoDBTargets', 'crawlerTargets_dynamoDBTargets' - Specifies Amazon DynamoDB targets.
--
-- 's3Targets', 'crawlerTargets_s3Targets' - Specifies Amazon Simple Storage Service (Amazon S3) targets.
--
-- 'mongoDBTargets', 'crawlerTargets_mongoDBTargets' - Specifies Amazon DocumentDB or MongoDB targets.
--
-- 'catalogTargets', 'crawlerTargets_catalogTargets' - Specifies Glue Data Catalog targets.
--
-- 'jdbcTargets', 'crawlerTargets_jdbcTargets' - Specifies JDBC targets.
newCrawlerTargets ::
  CrawlerTargets
newCrawlerTargets :: CrawlerTargets
newCrawlerTargets =
  CrawlerTargets' :: Maybe [DynamoDBTarget]
-> Maybe [S3Target]
-> Maybe [MongoDBTarget]
-> Maybe [CatalogTarget]
-> Maybe [JdbcTarget]
-> CrawlerTargets
CrawlerTargets'
    { $sel:dynamoDBTargets:CrawlerTargets' :: Maybe [DynamoDBTarget]
dynamoDBTargets = Maybe [DynamoDBTarget]
forall a. Maybe a
Prelude.Nothing,
      $sel:s3Targets:CrawlerTargets' :: Maybe [S3Target]
s3Targets = Maybe [S3Target]
forall a. Maybe a
Prelude.Nothing,
      $sel:mongoDBTargets:CrawlerTargets' :: Maybe [MongoDBTarget]
mongoDBTargets = Maybe [MongoDBTarget]
forall a. Maybe a
Prelude.Nothing,
      $sel:catalogTargets:CrawlerTargets' :: Maybe [CatalogTarget]
catalogTargets = Maybe [CatalogTarget]
forall a. Maybe a
Prelude.Nothing,
      $sel:jdbcTargets:CrawlerTargets' :: Maybe [JdbcTarget]
jdbcTargets = Maybe [JdbcTarget]
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies Amazon DynamoDB targets.
crawlerTargets_dynamoDBTargets :: Lens.Lens' CrawlerTargets (Prelude.Maybe [DynamoDBTarget])
crawlerTargets_dynamoDBTargets :: (Maybe [DynamoDBTarget] -> f (Maybe [DynamoDBTarget]))
-> CrawlerTargets -> f CrawlerTargets
crawlerTargets_dynamoDBTargets = (CrawlerTargets -> Maybe [DynamoDBTarget])
-> (CrawlerTargets -> Maybe [DynamoDBTarget] -> CrawlerTargets)
-> Lens
     CrawlerTargets
     CrawlerTargets
     (Maybe [DynamoDBTarget])
     (Maybe [DynamoDBTarget])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CrawlerTargets' {Maybe [DynamoDBTarget]
dynamoDBTargets :: Maybe [DynamoDBTarget]
$sel:dynamoDBTargets:CrawlerTargets' :: CrawlerTargets -> Maybe [DynamoDBTarget]
dynamoDBTargets} -> Maybe [DynamoDBTarget]
dynamoDBTargets) (\s :: CrawlerTargets
s@CrawlerTargets' {} Maybe [DynamoDBTarget]
a -> CrawlerTargets
s {$sel:dynamoDBTargets:CrawlerTargets' :: Maybe [DynamoDBTarget]
dynamoDBTargets = Maybe [DynamoDBTarget]
a} :: CrawlerTargets) ((Maybe [DynamoDBTarget] -> f (Maybe [DynamoDBTarget]))
 -> CrawlerTargets -> f CrawlerTargets)
-> ((Maybe [DynamoDBTarget] -> f (Maybe [DynamoDBTarget]))
    -> Maybe [DynamoDBTarget] -> f (Maybe [DynamoDBTarget]))
-> (Maybe [DynamoDBTarget] -> f (Maybe [DynamoDBTarget]))
-> CrawlerTargets
-> f CrawlerTargets
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [DynamoDBTarget] [DynamoDBTarget] [DynamoDBTarget] [DynamoDBTarget]
-> Iso
     (Maybe [DynamoDBTarget])
     (Maybe [DynamoDBTarget])
     (Maybe [DynamoDBTarget])
     (Maybe [DynamoDBTarget])
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
  [DynamoDBTarget] [DynamoDBTarget] [DynamoDBTarget] [DynamoDBTarget]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Specifies Amazon Simple Storage Service (Amazon S3) targets.
crawlerTargets_s3Targets :: Lens.Lens' CrawlerTargets (Prelude.Maybe [S3Target])
crawlerTargets_s3Targets :: (Maybe [S3Target] -> f (Maybe [S3Target]))
-> CrawlerTargets -> f CrawlerTargets
crawlerTargets_s3Targets = (CrawlerTargets -> Maybe [S3Target])
-> (CrawlerTargets -> Maybe [S3Target] -> CrawlerTargets)
-> Lens
     CrawlerTargets CrawlerTargets (Maybe [S3Target]) (Maybe [S3Target])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CrawlerTargets' {Maybe [S3Target]
s3Targets :: Maybe [S3Target]
$sel:s3Targets:CrawlerTargets' :: CrawlerTargets -> Maybe [S3Target]
s3Targets} -> Maybe [S3Target]
s3Targets) (\s :: CrawlerTargets
s@CrawlerTargets' {} Maybe [S3Target]
a -> CrawlerTargets
s {$sel:s3Targets:CrawlerTargets' :: Maybe [S3Target]
s3Targets = Maybe [S3Target]
a} :: CrawlerTargets) ((Maybe [S3Target] -> f (Maybe [S3Target]))
 -> CrawlerTargets -> f CrawlerTargets)
-> ((Maybe [S3Target] -> f (Maybe [S3Target]))
    -> Maybe [S3Target] -> f (Maybe [S3Target]))
-> (Maybe [S3Target] -> f (Maybe [S3Target]))
-> CrawlerTargets
-> f CrawlerTargets
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [S3Target] [S3Target] [S3Target] [S3Target]
-> Iso
     (Maybe [S3Target])
     (Maybe [S3Target])
     (Maybe [S3Target])
     (Maybe [S3Target])
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 [S3Target] [S3Target] [S3Target] [S3Target]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Specifies Amazon DocumentDB or MongoDB targets.
crawlerTargets_mongoDBTargets :: Lens.Lens' CrawlerTargets (Prelude.Maybe [MongoDBTarget])
crawlerTargets_mongoDBTargets :: (Maybe [MongoDBTarget] -> f (Maybe [MongoDBTarget]))
-> CrawlerTargets -> f CrawlerTargets
crawlerTargets_mongoDBTargets = (CrawlerTargets -> Maybe [MongoDBTarget])
-> (CrawlerTargets -> Maybe [MongoDBTarget] -> CrawlerTargets)
-> Lens
     CrawlerTargets
     CrawlerTargets
     (Maybe [MongoDBTarget])
     (Maybe [MongoDBTarget])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CrawlerTargets' {Maybe [MongoDBTarget]
mongoDBTargets :: Maybe [MongoDBTarget]
$sel:mongoDBTargets:CrawlerTargets' :: CrawlerTargets -> Maybe [MongoDBTarget]
mongoDBTargets} -> Maybe [MongoDBTarget]
mongoDBTargets) (\s :: CrawlerTargets
s@CrawlerTargets' {} Maybe [MongoDBTarget]
a -> CrawlerTargets
s {$sel:mongoDBTargets:CrawlerTargets' :: Maybe [MongoDBTarget]
mongoDBTargets = Maybe [MongoDBTarget]
a} :: CrawlerTargets) ((Maybe [MongoDBTarget] -> f (Maybe [MongoDBTarget]))
 -> CrawlerTargets -> f CrawlerTargets)
-> ((Maybe [MongoDBTarget] -> f (Maybe [MongoDBTarget]))
    -> Maybe [MongoDBTarget] -> f (Maybe [MongoDBTarget]))
-> (Maybe [MongoDBTarget] -> f (Maybe [MongoDBTarget]))
-> CrawlerTargets
-> f CrawlerTargets
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [MongoDBTarget] [MongoDBTarget] [MongoDBTarget] [MongoDBTarget]
-> Iso
     (Maybe [MongoDBTarget])
     (Maybe [MongoDBTarget])
     (Maybe [MongoDBTarget])
     (Maybe [MongoDBTarget])
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
  [MongoDBTarget] [MongoDBTarget] [MongoDBTarget] [MongoDBTarget]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Specifies Glue Data Catalog targets.
crawlerTargets_catalogTargets :: Lens.Lens' CrawlerTargets (Prelude.Maybe [CatalogTarget])
crawlerTargets_catalogTargets :: (Maybe [CatalogTarget] -> f (Maybe [CatalogTarget]))
-> CrawlerTargets -> f CrawlerTargets
crawlerTargets_catalogTargets = (CrawlerTargets -> Maybe [CatalogTarget])
-> (CrawlerTargets -> Maybe [CatalogTarget] -> CrawlerTargets)
-> Lens
     CrawlerTargets
     CrawlerTargets
     (Maybe [CatalogTarget])
     (Maybe [CatalogTarget])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CrawlerTargets' {Maybe [CatalogTarget]
catalogTargets :: Maybe [CatalogTarget]
$sel:catalogTargets:CrawlerTargets' :: CrawlerTargets -> Maybe [CatalogTarget]
catalogTargets} -> Maybe [CatalogTarget]
catalogTargets) (\s :: CrawlerTargets
s@CrawlerTargets' {} Maybe [CatalogTarget]
a -> CrawlerTargets
s {$sel:catalogTargets:CrawlerTargets' :: Maybe [CatalogTarget]
catalogTargets = Maybe [CatalogTarget]
a} :: CrawlerTargets) ((Maybe [CatalogTarget] -> f (Maybe [CatalogTarget]))
 -> CrawlerTargets -> f CrawlerTargets)
-> ((Maybe [CatalogTarget] -> f (Maybe [CatalogTarget]))
    -> Maybe [CatalogTarget] -> f (Maybe [CatalogTarget]))
-> (Maybe [CatalogTarget] -> f (Maybe [CatalogTarget]))
-> CrawlerTargets
-> f CrawlerTargets
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [CatalogTarget] [CatalogTarget] [CatalogTarget] [CatalogTarget]
-> Iso
     (Maybe [CatalogTarget])
     (Maybe [CatalogTarget])
     (Maybe [CatalogTarget])
     (Maybe [CatalogTarget])
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
  [CatalogTarget] [CatalogTarget] [CatalogTarget] [CatalogTarget]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Specifies JDBC targets.
crawlerTargets_jdbcTargets :: Lens.Lens' CrawlerTargets (Prelude.Maybe [JdbcTarget])
crawlerTargets_jdbcTargets :: (Maybe [JdbcTarget] -> f (Maybe [JdbcTarget]))
-> CrawlerTargets -> f CrawlerTargets
crawlerTargets_jdbcTargets = (CrawlerTargets -> Maybe [JdbcTarget])
-> (CrawlerTargets -> Maybe [JdbcTarget] -> CrawlerTargets)
-> Lens
     CrawlerTargets
     CrawlerTargets
     (Maybe [JdbcTarget])
     (Maybe [JdbcTarget])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CrawlerTargets' {Maybe [JdbcTarget]
jdbcTargets :: Maybe [JdbcTarget]
$sel:jdbcTargets:CrawlerTargets' :: CrawlerTargets -> Maybe [JdbcTarget]
jdbcTargets} -> Maybe [JdbcTarget]
jdbcTargets) (\s :: CrawlerTargets
s@CrawlerTargets' {} Maybe [JdbcTarget]
a -> CrawlerTargets
s {$sel:jdbcTargets:CrawlerTargets' :: Maybe [JdbcTarget]
jdbcTargets = Maybe [JdbcTarget]
a} :: CrawlerTargets) ((Maybe [JdbcTarget] -> f (Maybe [JdbcTarget]))
 -> CrawlerTargets -> f CrawlerTargets)
-> ((Maybe [JdbcTarget] -> f (Maybe [JdbcTarget]))
    -> Maybe [JdbcTarget] -> f (Maybe [JdbcTarget]))
-> (Maybe [JdbcTarget] -> f (Maybe [JdbcTarget]))
-> CrawlerTargets
-> f CrawlerTargets
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [JdbcTarget] [JdbcTarget] [JdbcTarget] [JdbcTarget]
-> Iso
     (Maybe [JdbcTarget])
     (Maybe [JdbcTarget])
     (Maybe [JdbcTarget])
     (Maybe [JdbcTarget])
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 [JdbcTarget] [JdbcTarget] [JdbcTarget] [JdbcTarget]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON CrawlerTargets where
  parseJSON :: Value -> Parser CrawlerTargets
parseJSON =
    String
-> (Object -> Parser CrawlerTargets)
-> Value
-> Parser CrawlerTargets
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CrawlerTargets"
      ( \Object
x ->
          Maybe [DynamoDBTarget]
-> Maybe [S3Target]
-> Maybe [MongoDBTarget]
-> Maybe [CatalogTarget]
-> Maybe [JdbcTarget]
-> CrawlerTargets
CrawlerTargets'
            (Maybe [DynamoDBTarget]
 -> Maybe [S3Target]
 -> Maybe [MongoDBTarget]
 -> Maybe [CatalogTarget]
 -> Maybe [JdbcTarget]
 -> CrawlerTargets)
-> Parser (Maybe [DynamoDBTarget])
-> Parser
     (Maybe [S3Target]
      -> Maybe [MongoDBTarget]
      -> Maybe [CatalogTarget]
      -> Maybe [JdbcTarget]
      -> CrawlerTargets)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [DynamoDBTarget]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DynamoDBTargets"
                            Parser (Maybe (Maybe [DynamoDBTarget]))
-> Maybe [DynamoDBTarget] -> Parser (Maybe [DynamoDBTarget])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [DynamoDBTarget]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe [S3Target]
   -> Maybe [MongoDBTarget]
   -> Maybe [CatalogTarget]
   -> Maybe [JdbcTarget]
   -> CrawlerTargets)
-> Parser (Maybe [S3Target])
-> Parser
     (Maybe [MongoDBTarget]
      -> Maybe [CatalogTarget] -> Maybe [JdbcTarget] -> CrawlerTargets)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [S3Target]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"S3Targets" Parser (Maybe (Maybe [S3Target]))
-> Maybe [S3Target] -> Parser (Maybe [S3Target])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [S3Target]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe [MongoDBTarget]
   -> Maybe [CatalogTarget] -> Maybe [JdbcTarget] -> CrawlerTargets)
-> Parser (Maybe [MongoDBTarget])
-> Parser
     (Maybe [CatalogTarget] -> Maybe [JdbcTarget] -> CrawlerTargets)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [MongoDBTarget]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MongoDBTargets" Parser (Maybe (Maybe [MongoDBTarget]))
-> Maybe [MongoDBTarget] -> Parser (Maybe [MongoDBTarget])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [MongoDBTarget]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe [CatalogTarget] -> Maybe [JdbcTarget] -> CrawlerTargets)
-> Parser (Maybe [CatalogTarget])
-> Parser (Maybe [JdbcTarget] -> CrawlerTargets)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [CatalogTarget]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CatalogTargets" Parser (Maybe (Maybe [CatalogTarget]))
-> Maybe [CatalogTarget] -> Parser (Maybe [CatalogTarget])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [CatalogTarget]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe [JdbcTarget] -> CrawlerTargets)
-> Parser (Maybe [JdbcTarget]) -> Parser CrawlerTargets
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [JdbcTarget]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"JdbcTargets" Parser (Maybe (Maybe [JdbcTarget]))
-> Maybe [JdbcTarget] -> Parser (Maybe [JdbcTarget])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [JdbcTarget]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable CrawlerTargets

instance Prelude.NFData CrawlerTargets

instance Core.ToJSON CrawlerTargets where
  toJSON :: CrawlerTargets -> Value
toJSON CrawlerTargets' {Maybe [CatalogTarget]
Maybe [DynamoDBTarget]
Maybe [JdbcTarget]
Maybe [MongoDBTarget]
Maybe [S3Target]
jdbcTargets :: Maybe [JdbcTarget]
catalogTargets :: Maybe [CatalogTarget]
mongoDBTargets :: Maybe [MongoDBTarget]
s3Targets :: Maybe [S3Target]
dynamoDBTargets :: Maybe [DynamoDBTarget]
$sel:jdbcTargets:CrawlerTargets' :: CrawlerTargets -> Maybe [JdbcTarget]
$sel:catalogTargets:CrawlerTargets' :: CrawlerTargets -> Maybe [CatalogTarget]
$sel:mongoDBTargets:CrawlerTargets' :: CrawlerTargets -> Maybe [MongoDBTarget]
$sel:s3Targets:CrawlerTargets' :: CrawlerTargets -> Maybe [S3Target]
$sel:dynamoDBTargets:CrawlerTargets' :: CrawlerTargets -> Maybe [DynamoDBTarget]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"DynamoDBTargets" Text -> [DynamoDBTarget] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([DynamoDBTarget] -> Pair) -> Maybe [DynamoDBTarget] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [DynamoDBTarget]
dynamoDBTargets,
            (Text
"S3Targets" Text -> [S3Target] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([S3Target] -> Pair) -> Maybe [S3Target] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [S3Target]
s3Targets,
            (Text
"MongoDBTargets" Text -> [MongoDBTarget] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([MongoDBTarget] -> Pair) -> Maybe [MongoDBTarget] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [MongoDBTarget]
mongoDBTargets,
            (Text
"CatalogTargets" Text -> [CatalogTarget] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([CatalogTarget] -> Pair) -> Maybe [CatalogTarget] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [CatalogTarget]
catalogTargets,
            (Text
"JdbcTargets" Text -> [JdbcTarget] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([JdbcTarget] -> Pair) -> Maybe [JdbcTarget] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [JdbcTarget]
jdbcTargets
          ]
      )