{-# 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.DeltaTarget
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Glue.Types.DeltaTarget where

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

-- | Specifies a Delta data store to crawl one or more Delta tables.
--
-- /See:/ 'newDeltaTarget' smart constructor.
data DeltaTarget = DeltaTarget'
  { -- | The name of the connection to use to connect to the Delta table target.
    DeltaTarget -> Maybe Text
connectionName :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether the crawler will create native tables, to allow
    -- integration with query engines that support querying of the Delta
    -- transaction log directly.
    DeltaTarget -> Maybe Bool
createNativeDeltaTable :: Prelude.Maybe Prelude.Bool,
    -- | A list of the Amazon S3 paths to the Delta tables.
    DeltaTarget -> Maybe [Text]
deltaTables :: Prelude.Maybe [Prelude.Text],
    -- | Specifies whether to write the manifest files to the Delta table path.
    DeltaTarget -> Maybe Bool
writeManifest :: Prelude.Maybe Prelude.Bool
  }
  deriving (DeltaTarget -> DeltaTarget -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeltaTarget -> DeltaTarget -> Bool
$c/= :: DeltaTarget -> DeltaTarget -> Bool
== :: DeltaTarget -> DeltaTarget -> Bool
$c== :: DeltaTarget -> DeltaTarget -> Bool
Prelude.Eq, ReadPrec [DeltaTarget]
ReadPrec DeltaTarget
Int -> ReadS DeltaTarget
ReadS [DeltaTarget]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeltaTarget]
$creadListPrec :: ReadPrec [DeltaTarget]
readPrec :: ReadPrec DeltaTarget
$creadPrec :: ReadPrec DeltaTarget
readList :: ReadS [DeltaTarget]
$creadList :: ReadS [DeltaTarget]
readsPrec :: Int -> ReadS DeltaTarget
$creadsPrec :: Int -> ReadS DeltaTarget
Prelude.Read, Int -> DeltaTarget -> ShowS
[DeltaTarget] -> ShowS
DeltaTarget -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeltaTarget] -> ShowS
$cshowList :: [DeltaTarget] -> ShowS
show :: DeltaTarget -> String
$cshow :: DeltaTarget -> String
showsPrec :: Int -> DeltaTarget -> ShowS
$cshowsPrec :: Int -> DeltaTarget -> ShowS
Prelude.Show, forall x. Rep DeltaTarget x -> DeltaTarget
forall x. DeltaTarget -> Rep DeltaTarget x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeltaTarget x -> DeltaTarget
$cfrom :: forall x. DeltaTarget -> Rep DeltaTarget x
Prelude.Generic)

-- |
-- Create a value of 'DeltaTarget' 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:
--
-- 'connectionName', 'deltaTarget_connectionName' - The name of the connection to use to connect to the Delta table target.
--
-- 'createNativeDeltaTable', 'deltaTarget_createNativeDeltaTable' - Specifies whether the crawler will create native tables, to allow
-- integration with query engines that support querying of the Delta
-- transaction log directly.
--
-- 'deltaTables', 'deltaTarget_deltaTables' - A list of the Amazon S3 paths to the Delta tables.
--
-- 'writeManifest', 'deltaTarget_writeManifest' - Specifies whether to write the manifest files to the Delta table path.
newDeltaTarget ::
  DeltaTarget
newDeltaTarget :: DeltaTarget
newDeltaTarget =
  DeltaTarget'
    { $sel:connectionName:DeltaTarget' :: Maybe Text
connectionName = forall a. Maybe a
Prelude.Nothing,
      $sel:createNativeDeltaTable:DeltaTarget' :: Maybe Bool
createNativeDeltaTable = forall a. Maybe a
Prelude.Nothing,
      $sel:deltaTables:DeltaTarget' :: Maybe [Text]
deltaTables = forall a. Maybe a
Prelude.Nothing,
      $sel:writeManifest:DeltaTarget' :: Maybe Bool
writeManifest = forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the connection to use to connect to the Delta table target.
deltaTarget_connectionName :: Lens.Lens' DeltaTarget (Prelude.Maybe Prelude.Text)
deltaTarget_connectionName :: Lens' DeltaTarget (Maybe Text)
deltaTarget_connectionName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeltaTarget' {Maybe Text
connectionName :: Maybe Text
$sel:connectionName:DeltaTarget' :: DeltaTarget -> Maybe Text
connectionName} -> Maybe Text
connectionName) (\s :: DeltaTarget
s@DeltaTarget' {} Maybe Text
a -> DeltaTarget
s {$sel:connectionName:DeltaTarget' :: Maybe Text
connectionName = Maybe Text
a} :: DeltaTarget)

-- | Specifies whether the crawler will create native tables, to allow
-- integration with query engines that support querying of the Delta
-- transaction log directly.
deltaTarget_createNativeDeltaTable :: Lens.Lens' DeltaTarget (Prelude.Maybe Prelude.Bool)
deltaTarget_createNativeDeltaTable :: Lens' DeltaTarget (Maybe Bool)
deltaTarget_createNativeDeltaTable = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeltaTarget' {Maybe Bool
createNativeDeltaTable :: Maybe Bool
$sel:createNativeDeltaTable:DeltaTarget' :: DeltaTarget -> Maybe Bool
createNativeDeltaTable} -> Maybe Bool
createNativeDeltaTable) (\s :: DeltaTarget
s@DeltaTarget' {} Maybe Bool
a -> DeltaTarget
s {$sel:createNativeDeltaTable:DeltaTarget' :: Maybe Bool
createNativeDeltaTable = Maybe Bool
a} :: DeltaTarget)

-- | A list of the Amazon S3 paths to the Delta tables.
deltaTarget_deltaTables :: Lens.Lens' DeltaTarget (Prelude.Maybe [Prelude.Text])
deltaTarget_deltaTables :: Lens' DeltaTarget (Maybe [Text])
deltaTarget_deltaTables = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeltaTarget' {Maybe [Text]
deltaTables :: Maybe [Text]
$sel:deltaTables:DeltaTarget' :: DeltaTarget -> Maybe [Text]
deltaTables} -> Maybe [Text]
deltaTables) (\s :: DeltaTarget
s@DeltaTarget' {} Maybe [Text]
a -> DeltaTarget
s {$sel:deltaTables:DeltaTarget' :: Maybe [Text]
deltaTables = Maybe [Text]
a} :: DeltaTarget) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Specifies whether to write the manifest files to the Delta table path.
deltaTarget_writeManifest :: Lens.Lens' DeltaTarget (Prelude.Maybe Prelude.Bool)
deltaTarget_writeManifest :: Lens' DeltaTarget (Maybe Bool)
deltaTarget_writeManifest = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeltaTarget' {Maybe Bool
writeManifest :: Maybe Bool
$sel:writeManifest:DeltaTarget' :: DeltaTarget -> Maybe Bool
writeManifest} -> Maybe Bool
writeManifest) (\s :: DeltaTarget
s@DeltaTarget' {} Maybe Bool
a -> DeltaTarget
s {$sel:writeManifest:DeltaTarget' :: Maybe Bool
writeManifest = Maybe Bool
a} :: DeltaTarget)

instance Data.FromJSON DeltaTarget where
  parseJSON :: Value -> Parser DeltaTarget
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DeltaTarget"
      ( \Object
x ->
          Maybe Text
-> Maybe Bool -> Maybe [Text] -> Maybe Bool -> DeltaTarget
DeltaTarget'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ConnectionName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CreateNativeDeltaTable")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DeltaTables" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"WriteManifest")
      )

instance Prelude.Hashable DeltaTarget where
  hashWithSalt :: Int -> DeltaTarget -> Int
hashWithSalt Int
_salt DeltaTarget' {Maybe Bool
Maybe [Text]
Maybe Text
writeManifest :: Maybe Bool
deltaTables :: Maybe [Text]
createNativeDeltaTable :: Maybe Bool
connectionName :: Maybe Text
$sel:writeManifest:DeltaTarget' :: DeltaTarget -> Maybe Bool
$sel:deltaTables:DeltaTarget' :: DeltaTarget -> Maybe [Text]
$sel:createNativeDeltaTable:DeltaTarget' :: DeltaTarget -> Maybe Bool
$sel:connectionName:DeltaTarget' :: DeltaTarget -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
connectionName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
createNativeDeltaTable
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
deltaTables
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
writeManifest

instance Prelude.NFData DeltaTarget where
  rnf :: DeltaTarget -> ()
rnf DeltaTarget' {Maybe Bool
Maybe [Text]
Maybe Text
writeManifest :: Maybe Bool
deltaTables :: Maybe [Text]
createNativeDeltaTable :: Maybe Bool
connectionName :: Maybe Text
$sel:writeManifest:DeltaTarget' :: DeltaTarget -> Maybe Bool
$sel:deltaTables:DeltaTarget' :: DeltaTarget -> Maybe [Text]
$sel:createNativeDeltaTable:DeltaTarget' :: DeltaTarget -> Maybe Bool
$sel:connectionName:DeltaTarget' :: DeltaTarget -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
connectionName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
createNativeDeltaTable
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
deltaTables
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
writeManifest

instance Data.ToJSON DeltaTarget where
  toJSON :: DeltaTarget -> Value
toJSON DeltaTarget' {Maybe Bool
Maybe [Text]
Maybe Text
writeManifest :: Maybe Bool
deltaTables :: Maybe [Text]
createNativeDeltaTable :: Maybe Bool
connectionName :: Maybe Text
$sel:writeManifest:DeltaTarget' :: DeltaTarget -> Maybe Bool
$sel:deltaTables:DeltaTarget' :: DeltaTarget -> Maybe [Text]
$sel:createNativeDeltaTable:DeltaTarget' :: DeltaTarget -> Maybe Bool
$sel:connectionName:DeltaTarget' :: DeltaTarget -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ConnectionName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
connectionName,
            (Key
"CreateNativeDeltaTable" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
createNativeDeltaTable,
            (Key
"DeltaTables" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
deltaTables,
            (Key
"WriteManifest" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
writeManifest
          ]
      )