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

import qualified Amazonka.Core as Core
import Amazonka.DataBrew.Types.ColumnSelector
import Amazonka.DataBrew.Types.ColumnStatisticsConfiguration
import Amazonka.DataBrew.Types.StatisticsConfiguration
import qualified Amazonka.Lens as Lens
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'
  { -- | 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,
    -- | 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),
    -- | 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
(ProfileConfiguration -> ProfileConfiguration -> Bool)
-> (ProfileConfiguration -> ProfileConfiguration -> Bool)
-> Eq ProfileConfiguration
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]
(Int -> ReadS ProfileConfiguration)
-> ReadS [ProfileConfiguration]
-> ReadPrec ProfileConfiguration
-> ReadPrec [ProfileConfiguration]
-> Read 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
(Int -> ProfileConfiguration -> ShowS)
-> (ProfileConfiguration -> String)
-> ([ProfileConfiguration] -> ShowS)
-> Show ProfileConfiguration
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. ProfileConfiguration -> Rep ProfileConfiguration x)
-> (forall x. Rep ProfileConfiguration x -> ProfileConfiguration)
-> Generic ProfileConfiguration
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:
--
-- '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.
--
-- '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.
--
-- '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' :: Maybe StatisticsConfiguration
-> Maybe (NonEmpty ColumnStatisticsConfiguration)
-> Maybe (NonEmpty ColumnSelector)
-> ProfileConfiguration
ProfileConfiguration'
    { $sel:datasetStatisticsConfiguration:ProfileConfiguration' :: Maybe StatisticsConfiguration
datasetStatisticsConfiguration =
        Maybe StatisticsConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:columnStatisticsConfigurations:ProfileConfiguration' :: Maybe (NonEmpty ColumnStatisticsConfiguration)
columnStatisticsConfigurations = Maybe (NonEmpty ColumnStatisticsConfiguration)
forall a. Maybe a
Prelude.Nothing,
      $sel:profileColumns:ProfileConfiguration' :: Maybe (NonEmpty ColumnSelector)
profileColumns = Maybe (NonEmpty ColumnSelector)
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe StatisticsConfiguration
 -> f (Maybe StatisticsConfiguration))
-> ProfileConfiguration -> f ProfileConfiguration
profileConfiguration_datasetStatisticsConfiguration = (ProfileConfiguration -> Maybe StatisticsConfiguration)
-> (ProfileConfiguration
    -> Maybe StatisticsConfiguration -> ProfileConfiguration)
-> Lens
     ProfileConfiguration
     ProfileConfiguration
     (Maybe StatisticsConfiguration)
     (Maybe StatisticsConfiguration)
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)

-- | 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 :: (Maybe (NonEmpty ColumnStatisticsConfiguration)
 -> f (Maybe (NonEmpty ColumnStatisticsConfiguration)))
-> ProfileConfiguration -> f ProfileConfiguration
profileConfiguration_columnStatisticsConfigurations = (ProfileConfiguration
 -> Maybe (NonEmpty ColumnStatisticsConfiguration))
-> (ProfileConfiguration
    -> Maybe (NonEmpty ColumnStatisticsConfiguration)
    -> ProfileConfiguration)
-> Lens
     ProfileConfiguration
     ProfileConfiguration
     (Maybe (NonEmpty ColumnStatisticsConfiguration))
     (Maybe (NonEmpty ColumnStatisticsConfiguration))
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) ((Maybe (NonEmpty ColumnStatisticsConfiguration)
  -> f (Maybe (NonEmpty ColumnStatisticsConfiguration)))
 -> ProfileConfiguration -> f ProfileConfiguration)
-> ((Maybe (NonEmpty ColumnStatisticsConfiguration)
     -> f (Maybe (NonEmpty ColumnStatisticsConfiguration)))
    -> Maybe (NonEmpty ColumnStatisticsConfiguration)
    -> f (Maybe (NonEmpty ColumnStatisticsConfiguration)))
-> (Maybe (NonEmpty ColumnStatisticsConfiguration)
    -> f (Maybe (NonEmpty ColumnStatisticsConfiguration)))
-> ProfileConfiguration
-> f ProfileConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty ColumnStatisticsConfiguration)
  (NonEmpty ColumnStatisticsConfiguration)
  (NonEmpty ColumnStatisticsConfiguration)
  (NonEmpty ColumnStatisticsConfiguration)
-> Iso
     (Maybe (NonEmpty ColumnStatisticsConfiguration))
     (Maybe (NonEmpty ColumnStatisticsConfiguration))
     (Maybe (NonEmpty ColumnStatisticsConfiguration))
     (Maybe (NonEmpty ColumnStatisticsConfiguration))
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
  (NonEmpty ColumnStatisticsConfiguration)
  (NonEmpty ColumnStatisticsConfiguration)
  (NonEmpty ColumnStatisticsConfiguration)
  (NonEmpty ColumnStatisticsConfiguration)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: (Maybe (NonEmpty ColumnSelector)
 -> f (Maybe (NonEmpty ColumnSelector)))
-> ProfileConfiguration -> f ProfileConfiguration
profileConfiguration_profileColumns = (ProfileConfiguration -> Maybe (NonEmpty ColumnSelector))
-> (ProfileConfiguration
    -> Maybe (NonEmpty ColumnSelector) -> ProfileConfiguration)
-> Lens
     ProfileConfiguration
     ProfileConfiguration
     (Maybe (NonEmpty ColumnSelector))
     (Maybe (NonEmpty ColumnSelector))
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) ((Maybe (NonEmpty ColumnSelector)
  -> f (Maybe (NonEmpty ColumnSelector)))
 -> ProfileConfiguration -> f ProfileConfiguration)
-> ((Maybe (NonEmpty ColumnSelector)
     -> f (Maybe (NonEmpty ColumnSelector)))
    -> Maybe (NonEmpty ColumnSelector)
    -> f (Maybe (NonEmpty ColumnSelector)))
-> (Maybe (NonEmpty ColumnSelector)
    -> f (Maybe (NonEmpty ColumnSelector)))
-> ProfileConfiguration
-> f ProfileConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty ColumnSelector)
  (NonEmpty ColumnSelector)
  (NonEmpty ColumnSelector)
  (NonEmpty ColumnSelector)
-> Iso
     (Maybe (NonEmpty ColumnSelector))
     (Maybe (NonEmpty ColumnSelector))
     (Maybe (NonEmpty ColumnSelector))
     (Maybe (NonEmpty ColumnSelector))
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
  (NonEmpty ColumnSelector)
  (NonEmpty ColumnSelector)
  (NonEmpty ColumnSelector)
  (NonEmpty ColumnSelector)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON ProfileConfiguration where
  parseJSON :: Value -> Parser ProfileConfiguration
parseJSON =
    String
-> (Object -> Parser ProfileConfiguration)
-> Value
-> Parser ProfileConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ProfileConfiguration"
      ( \Object
x ->
          Maybe StatisticsConfiguration
-> Maybe (NonEmpty ColumnStatisticsConfiguration)
-> Maybe (NonEmpty ColumnSelector)
-> ProfileConfiguration
ProfileConfiguration'
            (Maybe StatisticsConfiguration
 -> Maybe (NonEmpty ColumnStatisticsConfiguration)
 -> Maybe (NonEmpty ColumnSelector)
 -> ProfileConfiguration)
-> Parser (Maybe StatisticsConfiguration)
-> Parser
     (Maybe (NonEmpty ColumnStatisticsConfiguration)
      -> Maybe (NonEmpty ColumnSelector) -> ProfileConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe StatisticsConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DatasetStatisticsConfiguration")
            Parser
  (Maybe (NonEmpty ColumnStatisticsConfiguration)
   -> Maybe (NonEmpty ColumnSelector) -> ProfileConfiguration)
-> Parser (Maybe (NonEmpty ColumnStatisticsConfiguration))
-> Parser (Maybe (NonEmpty ColumnSelector) -> ProfileConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe (NonEmpty ColumnStatisticsConfiguration))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ColumnStatisticsConfigurations")
            Parser (Maybe (NonEmpty ColumnSelector) -> ProfileConfiguration)
-> Parser (Maybe (NonEmpty ColumnSelector))
-> Parser ProfileConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (NonEmpty ColumnSelector))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ProfileColumns")
      )

instance Prelude.Hashable ProfileConfiguration

instance Prelude.NFData ProfileConfiguration

instance Core.ToJSON ProfileConfiguration where
  toJSON :: ProfileConfiguration -> Value
toJSON ProfileConfiguration' {Maybe (NonEmpty ColumnSelector)
Maybe (NonEmpty ColumnStatisticsConfiguration)
Maybe StatisticsConfiguration
profileColumns :: Maybe (NonEmpty ColumnSelector)
columnStatisticsConfigurations :: Maybe (NonEmpty ColumnStatisticsConfiguration)
datasetStatisticsConfiguration :: Maybe StatisticsConfiguration
$sel:profileColumns:ProfileConfiguration' :: ProfileConfiguration -> Maybe (NonEmpty ColumnSelector)
$sel:columnStatisticsConfigurations:ProfileConfiguration' :: ProfileConfiguration
-> Maybe (NonEmpty ColumnStatisticsConfiguration)
$sel:datasetStatisticsConfiguration:ProfileConfiguration' :: ProfileConfiguration -> Maybe StatisticsConfiguration
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"DatasetStatisticsConfiguration" Text -> StatisticsConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (StatisticsConfiguration -> Pair)
-> Maybe StatisticsConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe StatisticsConfiguration
datasetStatisticsConfiguration,
            (Text
"ColumnStatisticsConfigurations" Text -> NonEmpty ColumnStatisticsConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty ColumnStatisticsConfiguration -> Pair)
-> Maybe (NonEmpty ColumnStatisticsConfiguration) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty ColumnStatisticsConfiguration)
columnStatisticsConfigurations,
            (Text
"ProfileColumns" Text -> NonEmpty ColumnSelector -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty ColumnSelector -> Pair)
-> Maybe (NonEmpty ColumnSelector) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty ColumnSelector)
profileColumns
          ]
      )