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

import qualified Amazonka.Core as Core
import Amazonka.Glue.Types.CrawlerLineageSettings
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Specifies data lineage configuration settings for the crawler.
--
-- /See:/ 'newLineageConfiguration' smart constructor.
data LineageConfiguration = LineageConfiguration'
  { -- | Specifies whether data lineage is enabled for the crawler. Valid values
    -- are:
    --
    -- -   ENABLE: enables data lineage for the crawler
    --
    -- -   DISABLE: disables data lineage for the crawler
    LineageConfiguration -> Maybe CrawlerLineageSettings
crawlerLineageSettings :: Prelude.Maybe CrawlerLineageSettings
  }
  deriving (LineageConfiguration -> LineageConfiguration -> Bool
(LineageConfiguration -> LineageConfiguration -> Bool)
-> (LineageConfiguration -> LineageConfiguration -> Bool)
-> Eq LineageConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LineageConfiguration -> LineageConfiguration -> Bool
$c/= :: LineageConfiguration -> LineageConfiguration -> Bool
== :: LineageConfiguration -> LineageConfiguration -> Bool
$c== :: LineageConfiguration -> LineageConfiguration -> Bool
Prelude.Eq, ReadPrec [LineageConfiguration]
ReadPrec LineageConfiguration
Int -> ReadS LineageConfiguration
ReadS [LineageConfiguration]
(Int -> ReadS LineageConfiguration)
-> ReadS [LineageConfiguration]
-> ReadPrec LineageConfiguration
-> ReadPrec [LineageConfiguration]
-> Read LineageConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LineageConfiguration]
$creadListPrec :: ReadPrec [LineageConfiguration]
readPrec :: ReadPrec LineageConfiguration
$creadPrec :: ReadPrec LineageConfiguration
readList :: ReadS [LineageConfiguration]
$creadList :: ReadS [LineageConfiguration]
readsPrec :: Int -> ReadS LineageConfiguration
$creadsPrec :: Int -> ReadS LineageConfiguration
Prelude.Read, Int -> LineageConfiguration -> ShowS
[LineageConfiguration] -> ShowS
LineageConfiguration -> String
(Int -> LineageConfiguration -> ShowS)
-> (LineageConfiguration -> String)
-> ([LineageConfiguration] -> ShowS)
-> Show LineageConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LineageConfiguration] -> ShowS
$cshowList :: [LineageConfiguration] -> ShowS
show :: LineageConfiguration -> String
$cshow :: LineageConfiguration -> String
showsPrec :: Int -> LineageConfiguration -> ShowS
$cshowsPrec :: Int -> LineageConfiguration -> ShowS
Prelude.Show, (forall x. LineageConfiguration -> Rep LineageConfiguration x)
-> (forall x. Rep LineageConfiguration x -> LineageConfiguration)
-> Generic LineageConfiguration
forall x. Rep LineageConfiguration x -> LineageConfiguration
forall x. LineageConfiguration -> Rep LineageConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LineageConfiguration x -> LineageConfiguration
$cfrom :: forall x. LineageConfiguration -> Rep LineageConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'LineageConfiguration' 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:
--
-- 'crawlerLineageSettings', 'lineageConfiguration_crawlerLineageSettings' - Specifies whether data lineage is enabled for the crawler. Valid values
-- are:
--
-- -   ENABLE: enables data lineage for the crawler
--
-- -   DISABLE: disables data lineage for the crawler
newLineageConfiguration ::
  LineageConfiguration
newLineageConfiguration :: LineageConfiguration
newLineageConfiguration =
  LineageConfiguration' :: Maybe CrawlerLineageSettings -> LineageConfiguration
LineageConfiguration'
    { $sel:crawlerLineageSettings:LineageConfiguration' :: Maybe CrawlerLineageSettings
crawlerLineageSettings =
        Maybe CrawlerLineageSettings
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies whether data lineage is enabled for the crawler. Valid values
-- are:
--
-- -   ENABLE: enables data lineage for the crawler
--
-- -   DISABLE: disables data lineage for the crawler
lineageConfiguration_crawlerLineageSettings :: Lens.Lens' LineageConfiguration (Prelude.Maybe CrawlerLineageSettings)
lineageConfiguration_crawlerLineageSettings :: (Maybe CrawlerLineageSettings -> f (Maybe CrawlerLineageSettings))
-> LineageConfiguration -> f LineageConfiguration
lineageConfiguration_crawlerLineageSettings = (LineageConfiguration -> Maybe CrawlerLineageSettings)
-> (LineageConfiguration
    -> Maybe CrawlerLineageSettings -> LineageConfiguration)
-> Lens
     LineageConfiguration
     LineageConfiguration
     (Maybe CrawlerLineageSettings)
     (Maybe CrawlerLineageSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LineageConfiguration' {Maybe CrawlerLineageSettings
crawlerLineageSettings :: Maybe CrawlerLineageSettings
$sel:crawlerLineageSettings:LineageConfiguration' :: LineageConfiguration -> Maybe CrawlerLineageSettings
crawlerLineageSettings} -> Maybe CrawlerLineageSettings
crawlerLineageSettings) (\s :: LineageConfiguration
s@LineageConfiguration' {} Maybe CrawlerLineageSettings
a -> LineageConfiguration
s {$sel:crawlerLineageSettings:LineageConfiguration' :: Maybe CrawlerLineageSettings
crawlerLineageSettings = Maybe CrawlerLineageSettings
a} :: LineageConfiguration)

instance Core.FromJSON LineageConfiguration where
  parseJSON :: Value -> Parser LineageConfiguration
parseJSON =
    String
-> (Object -> Parser LineageConfiguration)
-> Value
-> Parser LineageConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LineageConfiguration"
      ( \Object
x ->
          Maybe CrawlerLineageSettings -> LineageConfiguration
LineageConfiguration'
            (Maybe CrawlerLineageSettings -> LineageConfiguration)
-> Parser (Maybe CrawlerLineageSettings)
-> Parser LineageConfiguration
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe CrawlerLineageSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CrawlerLineageSettings")
      )

instance Prelude.Hashable LineageConfiguration

instance Prelude.NFData LineageConfiguration

instance Core.ToJSON LineageConfiguration where
  toJSON :: LineageConfiguration -> Value
toJSON LineageConfiguration' {Maybe CrawlerLineageSettings
crawlerLineageSettings :: Maybe CrawlerLineageSettings
$sel:crawlerLineageSettings:LineageConfiguration' :: LineageConfiguration -> Maybe CrawlerLineageSettings
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"CrawlerLineageSettings" Text -> CrawlerLineageSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (CrawlerLineageSettings -> Pair)
-> Maybe CrawlerLineageSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CrawlerLineageSettings
crawlerLineageSettings
          ]
      )