{-# 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.DataBrew.Types.ProfileConfiguration
-- 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.DataBrew.Types.ProfileConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DataBrew.Types.ColumnSelector
import Amazonka.DataBrew.Types.ColumnStatisticsConfiguration
import Amazonka.DataBrew.Types.EntityDetectorConfiguration
import Amazonka.DataBrew.Types.StatisticsConfiguration
import qualified Amazonka.Prelude as Prelude

-- | Configuration for profile jobs. Configuration can be used to select
-- columns, do evaluations, and override default parameters of evaluations.
-- When configuration is undefined, the profile job will apply default
-- settings to all supported columns.
--
-- /See:/ 'newProfileConfiguration' smart constructor.
data ProfileConfiguration = ProfileConfiguration'
  { -- | List of configurations for column evaluations.
    -- ColumnStatisticsConfigurations are used to select evaluations and
    -- override parameters of evaluations for particular columns. When
    -- ColumnStatisticsConfigurations is undefined, the profile job will
    -- profile all supported columns and run all supported evaluations.
    ProfileConfiguration
-> Maybe (NonEmpty ColumnStatisticsConfiguration)
columnStatisticsConfigurations :: Prelude.Maybe (Prelude.NonEmpty ColumnStatisticsConfiguration),
    -- | Configuration for inter-column evaluations. Configuration can be used to
    -- select evaluations and override parameters of evaluations. When
    -- configuration is undefined, the profile job will run all supported
    -- inter-column evaluations.
    ProfileConfiguration -> Maybe StatisticsConfiguration
datasetStatisticsConfiguration :: Prelude.Maybe StatisticsConfiguration,
    -- | Configuration of entity detection for a profile job. When undefined,
    -- entity detection is disabled.
    ProfileConfiguration -> Maybe EntityDetectorConfiguration
entityDetectorConfiguration :: Prelude.Maybe EntityDetectorConfiguration,
    -- | List of column selectors. ProfileColumns can be used to select columns
    -- from the dataset. When ProfileColumns is undefined, the profile job will
    -- profile all supported columns.
    ProfileConfiguration -> Maybe (NonEmpty ColumnSelector)
profileColumns :: Prelude.Maybe (Prelude.NonEmpty ColumnSelector)
  }
  deriving (ProfileConfiguration -> ProfileConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProfileConfiguration -> ProfileConfiguration -> Bool
$c/= :: ProfileConfiguration -> ProfileConfiguration -> Bool
== :: ProfileConfiguration -> ProfileConfiguration -> Bool
$c== :: ProfileConfiguration -> ProfileConfiguration -> Bool
Prelude.Eq, ReadPrec [ProfileConfiguration]
ReadPrec ProfileConfiguration
Int -> ReadS ProfileConfiguration
ReadS [ProfileConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProfileConfiguration]
$creadListPrec :: ReadPrec [ProfileConfiguration]
readPrec :: ReadPrec ProfileConfiguration
$creadPrec :: ReadPrec ProfileConfiguration
readList :: ReadS [ProfileConfiguration]
$creadList :: ReadS [ProfileConfiguration]
readsPrec :: Int -> ReadS ProfileConfiguration
$creadsPrec :: Int -> ReadS ProfileConfiguration
Prelude.Read, Int -> ProfileConfiguration -> ShowS
[ProfileConfiguration] -> ShowS
ProfileConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProfileConfiguration] -> ShowS
$cshowList :: [ProfileConfiguration] -> ShowS
show :: ProfileConfiguration -> String
$cshow :: ProfileConfiguration -> String
showsPrec :: Int -> ProfileConfiguration -> ShowS
$cshowsPrec :: Int -> ProfileConfiguration -> ShowS
Prelude.Show, forall x. Rep ProfileConfiguration x -> ProfileConfiguration
forall x. ProfileConfiguration -> Rep ProfileConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProfileConfiguration x -> ProfileConfiguration
$cfrom :: forall x. ProfileConfiguration -> Rep ProfileConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ProfileConfiguration' 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:
--
-- 'columnStatisticsConfigurations', 'profileConfiguration_columnStatisticsConfigurations' - List of configurations for column evaluations.
-- ColumnStatisticsConfigurations are used to select evaluations and
-- override parameters of evaluations for particular columns. When
-- ColumnStatisticsConfigurations is undefined, the profile job will
-- profile all supported columns and run all supported evaluations.
--
-- 'datasetStatisticsConfiguration', 'profileConfiguration_datasetStatisticsConfiguration' - Configuration for inter-column evaluations. Configuration can be used to
-- select evaluations and override parameters of evaluations. When
-- configuration is undefined, the profile job will run all supported
-- inter-column evaluations.
--
-- 'entityDetectorConfiguration', 'profileConfiguration_entityDetectorConfiguration' - Configuration of entity detection for a profile job. When undefined,
-- entity detection is disabled.
--
-- 'profileColumns', 'profileConfiguration_profileColumns' - List of column selectors. ProfileColumns can be used to select columns
-- from the dataset. When ProfileColumns is undefined, the profile job will
-- profile all supported columns.
newProfileConfiguration ::
  ProfileConfiguration
newProfileConfiguration :: ProfileConfiguration
newProfileConfiguration =
  ProfileConfiguration'
    { $sel:columnStatisticsConfigurations:ProfileConfiguration' :: Maybe (NonEmpty ColumnStatisticsConfiguration)
columnStatisticsConfigurations =
        forall a. Maybe a
Prelude.Nothing,
      $sel:datasetStatisticsConfiguration:ProfileConfiguration' :: Maybe StatisticsConfiguration
datasetStatisticsConfiguration = forall a. Maybe a
Prelude.Nothing,
      $sel:entityDetectorConfiguration:ProfileConfiguration' :: Maybe EntityDetectorConfiguration
entityDetectorConfiguration = forall a. Maybe a
Prelude.Nothing,
      $sel:profileColumns:ProfileConfiguration' :: Maybe (NonEmpty ColumnSelector)
profileColumns = forall a. Maybe a
Prelude.Nothing
    }

-- | List of configurations for column evaluations.
-- ColumnStatisticsConfigurations are used to select evaluations and
-- override parameters of evaluations for particular columns. When
-- ColumnStatisticsConfigurations is undefined, the profile job will
-- profile all supported columns and run all supported evaluations.
profileConfiguration_columnStatisticsConfigurations :: Lens.Lens' ProfileConfiguration (Prelude.Maybe (Prelude.NonEmpty ColumnStatisticsConfiguration))
profileConfiguration_columnStatisticsConfigurations :: Lens'
  ProfileConfiguration
  (Maybe (NonEmpty ColumnStatisticsConfiguration))
profileConfiguration_columnStatisticsConfigurations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProfileConfiguration' {Maybe (NonEmpty ColumnStatisticsConfiguration)
columnStatisticsConfigurations :: Maybe (NonEmpty ColumnStatisticsConfiguration)
$sel:columnStatisticsConfigurations:ProfileConfiguration' :: ProfileConfiguration
-> Maybe (NonEmpty ColumnStatisticsConfiguration)
columnStatisticsConfigurations} -> Maybe (NonEmpty ColumnStatisticsConfiguration)
columnStatisticsConfigurations) (\s :: ProfileConfiguration
s@ProfileConfiguration' {} Maybe (NonEmpty ColumnStatisticsConfiguration)
a -> ProfileConfiguration
s {$sel:columnStatisticsConfigurations:ProfileConfiguration' :: Maybe (NonEmpty ColumnStatisticsConfiguration)
columnStatisticsConfigurations = Maybe (NonEmpty ColumnStatisticsConfiguration)
a} :: ProfileConfiguration) 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

-- | Configuration for inter-column evaluations. Configuration can be used to
-- select evaluations and override parameters of evaluations. When
-- configuration is undefined, the profile job will run all supported
-- inter-column evaluations.
profileConfiguration_datasetStatisticsConfiguration :: Lens.Lens' ProfileConfiguration (Prelude.Maybe StatisticsConfiguration)
profileConfiguration_datasetStatisticsConfiguration :: Lens' ProfileConfiguration (Maybe StatisticsConfiguration)
profileConfiguration_datasetStatisticsConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProfileConfiguration' {Maybe StatisticsConfiguration
datasetStatisticsConfiguration :: Maybe StatisticsConfiguration
$sel:datasetStatisticsConfiguration:ProfileConfiguration' :: ProfileConfiguration -> Maybe StatisticsConfiguration
datasetStatisticsConfiguration} -> Maybe StatisticsConfiguration
datasetStatisticsConfiguration) (\s :: ProfileConfiguration
s@ProfileConfiguration' {} Maybe StatisticsConfiguration
a -> ProfileConfiguration
s {$sel:datasetStatisticsConfiguration:ProfileConfiguration' :: Maybe StatisticsConfiguration
datasetStatisticsConfiguration = Maybe StatisticsConfiguration
a} :: ProfileConfiguration)

-- | Configuration of entity detection for a profile job. When undefined,
-- entity detection is disabled.
profileConfiguration_entityDetectorConfiguration :: Lens.Lens' ProfileConfiguration (Prelude.Maybe EntityDetectorConfiguration)
profileConfiguration_entityDetectorConfiguration :: Lens' ProfileConfiguration (Maybe EntityDetectorConfiguration)
profileConfiguration_entityDetectorConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProfileConfiguration' {Maybe EntityDetectorConfiguration
entityDetectorConfiguration :: Maybe EntityDetectorConfiguration
$sel:entityDetectorConfiguration:ProfileConfiguration' :: ProfileConfiguration -> Maybe EntityDetectorConfiguration
entityDetectorConfiguration} -> Maybe EntityDetectorConfiguration
entityDetectorConfiguration) (\s :: ProfileConfiguration
s@ProfileConfiguration' {} Maybe EntityDetectorConfiguration
a -> ProfileConfiguration
s {$sel:entityDetectorConfiguration:ProfileConfiguration' :: Maybe EntityDetectorConfiguration
entityDetectorConfiguration = Maybe EntityDetectorConfiguration
a} :: ProfileConfiguration)

-- | List of column selectors. ProfileColumns can be used to select columns
-- from the dataset. When ProfileColumns is undefined, the profile job will
-- profile all supported columns.
profileConfiguration_profileColumns :: Lens.Lens' ProfileConfiguration (Prelude.Maybe (Prelude.NonEmpty ColumnSelector))
profileConfiguration_profileColumns :: Lens' ProfileConfiguration (Maybe (NonEmpty ColumnSelector))
profileConfiguration_profileColumns = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProfileConfiguration' {Maybe (NonEmpty ColumnSelector)
profileColumns :: Maybe (NonEmpty ColumnSelector)
$sel:profileColumns:ProfileConfiguration' :: ProfileConfiguration -> Maybe (NonEmpty ColumnSelector)
profileColumns} -> Maybe (NonEmpty ColumnSelector)
profileColumns) (\s :: ProfileConfiguration
s@ProfileConfiguration' {} Maybe (NonEmpty ColumnSelector)
a -> ProfileConfiguration
s {$sel:profileColumns:ProfileConfiguration' :: Maybe (NonEmpty ColumnSelector)
profileColumns = Maybe (NonEmpty ColumnSelector)
a} :: ProfileConfiguration) 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

instance Data.FromJSON ProfileConfiguration where
  parseJSON :: Value -> Parser ProfileConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ProfileConfiguration"
      ( \Object
x ->
          Maybe (NonEmpty ColumnStatisticsConfiguration)
-> Maybe StatisticsConfiguration
-> Maybe EntityDetectorConfiguration
-> Maybe (NonEmpty ColumnSelector)
-> ProfileConfiguration
ProfileConfiguration'
            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
"ColumnStatisticsConfigurations")
            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
"DatasetStatisticsConfiguration")
            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
"EntityDetectorConfiguration")
            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
"ProfileColumns")
      )

instance Prelude.Hashable ProfileConfiguration where
  hashWithSalt :: Int -> ProfileConfiguration -> Int
hashWithSalt Int
_salt ProfileConfiguration' {Maybe (NonEmpty ColumnSelector)
Maybe (NonEmpty ColumnStatisticsConfiguration)
Maybe EntityDetectorConfiguration
Maybe StatisticsConfiguration
profileColumns :: Maybe (NonEmpty ColumnSelector)
entityDetectorConfiguration :: Maybe EntityDetectorConfiguration
datasetStatisticsConfiguration :: Maybe StatisticsConfiguration
columnStatisticsConfigurations :: Maybe (NonEmpty ColumnStatisticsConfiguration)
$sel:profileColumns:ProfileConfiguration' :: ProfileConfiguration -> Maybe (NonEmpty ColumnSelector)
$sel:entityDetectorConfiguration:ProfileConfiguration' :: ProfileConfiguration -> Maybe EntityDetectorConfiguration
$sel:datasetStatisticsConfiguration:ProfileConfiguration' :: ProfileConfiguration -> Maybe StatisticsConfiguration
$sel:columnStatisticsConfigurations:ProfileConfiguration' :: ProfileConfiguration
-> Maybe (NonEmpty ColumnStatisticsConfiguration)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty ColumnStatisticsConfiguration)
columnStatisticsConfigurations
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe StatisticsConfiguration
datasetStatisticsConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EntityDetectorConfiguration
entityDetectorConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty ColumnSelector)
profileColumns

instance Prelude.NFData ProfileConfiguration where
  rnf :: ProfileConfiguration -> ()
rnf ProfileConfiguration' {Maybe (NonEmpty ColumnSelector)
Maybe (NonEmpty ColumnStatisticsConfiguration)
Maybe EntityDetectorConfiguration
Maybe StatisticsConfiguration
profileColumns :: Maybe (NonEmpty ColumnSelector)
entityDetectorConfiguration :: Maybe EntityDetectorConfiguration
datasetStatisticsConfiguration :: Maybe StatisticsConfiguration
columnStatisticsConfigurations :: Maybe (NonEmpty ColumnStatisticsConfiguration)
$sel:profileColumns:ProfileConfiguration' :: ProfileConfiguration -> Maybe (NonEmpty ColumnSelector)
$sel:entityDetectorConfiguration:ProfileConfiguration' :: ProfileConfiguration -> Maybe EntityDetectorConfiguration
$sel:datasetStatisticsConfiguration:ProfileConfiguration' :: ProfileConfiguration -> Maybe StatisticsConfiguration
$sel:columnStatisticsConfigurations:ProfileConfiguration' :: ProfileConfiguration
-> Maybe (NonEmpty ColumnStatisticsConfiguration)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty ColumnStatisticsConfiguration)
columnStatisticsConfigurations
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe StatisticsConfiguration
datasetStatisticsConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EntityDetectorConfiguration
entityDetectorConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty ColumnSelector)
profileColumns

instance Data.ToJSON ProfileConfiguration where
  toJSON :: ProfileConfiguration -> Value
toJSON ProfileConfiguration' {Maybe (NonEmpty ColumnSelector)
Maybe (NonEmpty ColumnStatisticsConfiguration)
Maybe EntityDetectorConfiguration
Maybe StatisticsConfiguration
profileColumns :: Maybe (NonEmpty ColumnSelector)
entityDetectorConfiguration :: Maybe EntityDetectorConfiguration
datasetStatisticsConfiguration :: Maybe StatisticsConfiguration
columnStatisticsConfigurations :: Maybe (NonEmpty ColumnStatisticsConfiguration)
$sel:profileColumns:ProfileConfiguration' :: ProfileConfiguration -> Maybe (NonEmpty ColumnSelector)
$sel:entityDetectorConfiguration:ProfileConfiguration' :: ProfileConfiguration -> Maybe EntityDetectorConfiguration
$sel:datasetStatisticsConfiguration:ProfileConfiguration' :: ProfileConfiguration -> Maybe StatisticsConfiguration
$sel:columnStatisticsConfigurations:ProfileConfiguration' :: ProfileConfiguration
-> Maybe (NonEmpty ColumnStatisticsConfiguration)
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ColumnStatisticsConfigurations" 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 (NonEmpty ColumnStatisticsConfiguration)
columnStatisticsConfigurations,
            (Key
"DatasetStatisticsConfiguration" 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 StatisticsConfiguration
datasetStatisticsConfiguration,
            (Key
"EntityDetectorConfiguration" 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 EntityDetectorConfiguration
entityDetectorConfiguration,
            (Key
"ProfileColumns" 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 (NonEmpty ColumnSelector)
profileColumns
          ]
      )