{-# 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.SageMaker.Types.ProfilerRuleConfiguration
-- 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.SageMaker.Types.ProfilerRuleConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.ProcessingInstanceType

-- | Configuration information for profiling rules.
--
-- /See:/ 'newProfilerRuleConfiguration' smart constructor.
data ProfilerRuleConfiguration = ProfilerRuleConfiguration'
  { -- | Runtime configuration for rule container.
    ProfilerRuleConfiguration -> Maybe (HashMap Text Text)
ruleParameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | Path to Amazon S3 storage location for rules.
    ProfilerRuleConfiguration -> Maybe Text
s3OutputPath :: Prelude.Maybe Prelude.Text,
    -- | Path to local storage location for output of rules. Defaults to
    -- @\/opt\/ml\/processing\/output\/rule\/@.
    ProfilerRuleConfiguration -> Maybe Text
localPath :: Prelude.Maybe Prelude.Text,
    -- | The instance type to deploy a Debugger custom rule for profiling a
    -- training job.
    ProfilerRuleConfiguration -> Maybe ProcessingInstanceType
instanceType :: Prelude.Maybe ProcessingInstanceType,
    -- | The size, in GB, of the ML storage volume attached to the processing
    -- instance.
    ProfilerRuleConfiguration -> Maybe Natural
volumeSizeInGB :: Prelude.Maybe Prelude.Natural,
    -- | The name of the rule configuration. It must be unique relative to other
    -- rule configuration names.
    ProfilerRuleConfiguration -> Text
ruleConfigurationName :: Prelude.Text,
    -- | The Amazon Elastic Container (ECR) Image for the managed rule
    -- evaluation.
    ProfilerRuleConfiguration -> Text
ruleEvaluatorImage :: Prelude.Text
  }
  deriving (ProfilerRuleConfiguration -> ProfilerRuleConfiguration -> Bool
(ProfilerRuleConfiguration -> ProfilerRuleConfiguration -> Bool)
-> (ProfilerRuleConfiguration -> ProfilerRuleConfiguration -> Bool)
-> Eq ProfilerRuleConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProfilerRuleConfiguration -> ProfilerRuleConfiguration -> Bool
$c/= :: ProfilerRuleConfiguration -> ProfilerRuleConfiguration -> Bool
== :: ProfilerRuleConfiguration -> ProfilerRuleConfiguration -> Bool
$c== :: ProfilerRuleConfiguration -> ProfilerRuleConfiguration -> Bool
Prelude.Eq, ReadPrec [ProfilerRuleConfiguration]
ReadPrec ProfilerRuleConfiguration
Int -> ReadS ProfilerRuleConfiguration
ReadS [ProfilerRuleConfiguration]
(Int -> ReadS ProfilerRuleConfiguration)
-> ReadS [ProfilerRuleConfiguration]
-> ReadPrec ProfilerRuleConfiguration
-> ReadPrec [ProfilerRuleConfiguration]
-> Read ProfilerRuleConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProfilerRuleConfiguration]
$creadListPrec :: ReadPrec [ProfilerRuleConfiguration]
readPrec :: ReadPrec ProfilerRuleConfiguration
$creadPrec :: ReadPrec ProfilerRuleConfiguration
readList :: ReadS [ProfilerRuleConfiguration]
$creadList :: ReadS [ProfilerRuleConfiguration]
readsPrec :: Int -> ReadS ProfilerRuleConfiguration
$creadsPrec :: Int -> ReadS ProfilerRuleConfiguration
Prelude.Read, Int -> ProfilerRuleConfiguration -> ShowS
[ProfilerRuleConfiguration] -> ShowS
ProfilerRuleConfiguration -> String
(Int -> ProfilerRuleConfiguration -> ShowS)
-> (ProfilerRuleConfiguration -> String)
-> ([ProfilerRuleConfiguration] -> ShowS)
-> Show ProfilerRuleConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProfilerRuleConfiguration] -> ShowS
$cshowList :: [ProfilerRuleConfiguration] -> ShowS
show :: ProfilerRuleConfiguration -> String
$cshow :: ProfilerRuleConfiguration -> String
showsPrec :: Int -> ProfilerRuleConfiguration -> ShowS
$cshowsPrec :: Int -> ProfilerRuleConfiguration -> ShowS
Prelude.Show, (forall x.
 ProfilerRuleConfiguration -> Rep ProfilerRuleConfiguration x)
-> (forall x.
    Rep ProfilerRuleConfiguration x -> ProfilerRuleConfiguration)
-> Generic ProfilerRuleConfiguration
forall x.
Rep ProfilerRuleConfiguration x -> ProfilerRuleConfiguration
forall x.
ProfilerRuleConfiguration -> Rep ProfilerRuleConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ProfilerRuleConfiguration x -> ProfilerRuleConfiguration
$cfrom :: forall x.
ProfilerRuleConfiguration -> Rep ProfilerRuleConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ProfilerRuleConfiguration' 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:
--
-- 'ruleParameters', 'profilerRuleConfiguration_ruleParameters' - Runtime configuration for rule container.
--
-- 's3OutputPath', 'profilerRuleConfiguration_s3OutputPath' - Path to Amazon S3 storage location for rules.
--
-- 'localPath', 'profilerRuleConfiguration_localPath' - Path to local storage location for output of rules. Defaults to
-- @\/opt\/ml\/processing\/output\/rule\/@.
--
-- 'instanceType', 'profilerRuleConfiguration_instanceType' - The instance type to deploy a Debugger custom rule for profiling a
-- training job.
--
-- 'volumeSizeInGB', 'profilerRuleConfiguration_volumeSizeInGB' - The size, in GB, of the ML storage volume attached to the processing
-- instance.
--
-- 'ruleConfigurationName', 'profilerRuleConfiguration_ruleConfigurationName' - The name of the rule configuration. It must be unique relative to other
-- rule configuration names.
--
-- 'ruleEvaluatorImage', 'profilerRuleConfiguration_ruleEvaluatorImage' - The Amazon Elastic Container (ECR) Image for the managed rule
-- evaluation.
newProfilerRuleConfiguration ::
  -- | 'ruleConfigurationName'
  Prelude.Text ->
  -- | 'ruleEvaluatorImage'
  Prelude.Text ->
  ProfilerRuleConfiguration
newProfilerRuleConfiguration :: Text -> Text -> ProfilerRuleConfiguration
newProfilerRuleConfiguration
  Text
pRuleConfigurationName_
  Text
pRuleEvaluatorImage_ =
    ProfilerRuleConfiguration' :: Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe ProcessingInstanceType
-> Maybe Natural
-> Text
-> Text
-> ProfilerRuleConfiguration
ProfilerRuleConfiguration'
      { $sel:ruleParameters:ProfilerRuleConfiguration' :: Maybe (HashMap Text Text)
ruleParameters =
          Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:s3OutputPath:ProfilerRuleConfiguration' :: Maybe Text
s3OutputPath = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:localPath:ProfilerRuleConfiguration' :: Maybe Text
localPath = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:instanceType:ProfilerRuleConfiguration' :: Maybe ProcessingInstanceType
instanceType = Maybe ProcessingInstanceType
forall a. Maybe a
Prelude.Nothing,
        $sel:volumeSizeInGB:ProfilerRuleConfiguration' :: Maybe Natural
volumeSizeInGB = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:ruleConfigurationName:ProfilerRuleConfiguration' :: Text
ruleConfigurationName = Text
pRuleConfigurationName_,
        $sel:ruleEvaluatorImage:ProfilerRuleConfiguration' :: Text
ruleEvaluatorImage = Text
pRuleEvaluatorImage_
      }

-- | Runtime configuration for rule container.
profilerRuleConfiguration_ruleParameters :: Lens.Lens' ProfilerRuleConfiguration (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
profilerRuleConfiguration_ruleParameters :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ProfilerRuleConfiguration -> f ProfilerRuleConfiguration
profilerRuleConfiguration_ruleParameters = (ProfilerRuleConfiguration -> Maybe (HashMap Text Text))
-> (ProfilerRuleConfiguration
    -> Maybe (HashMap Text Text) -> ProfilerRuleConfiguration)
-> Lens
     ProfilerRuleConfiguration
     ProfilerRuleConfiguration
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProfilerRuleConfiguration' {Maybe (HashMap Text Text)
ruleParameters :: Maybe (HashMap Text Text)
$sel:ruleParameters:ProfilerRuleConfiguration' :: ProfilerRuleConfiguration -> Maybe (HashMap Text Text)
ruleParameters} -> Maybe (HashMap Text Text)
ruleParameters) (\s :: ProfilerRuleConfiguration
s@ProfilerRuleConfiguration' {} Maybe (HashMap Text Text)
a -> ProfilerRuleConfiguration
s {$sel:ruleParameters:ProfilerRuleConfiguration' :: Maybe (HashMap Text Text)
ruleParameters = Maybe (HashMap Text Text)
a} :: ProfilerRuleConfiguration) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> ProfilerRuleConfiguration -> f ProfilerRuleConfiguration)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ProfilerRuleConfiguration
-> f ProfilerRuleConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Path to Amazon S3 storage location for rules.
profilerRuleConfiguration_s3OutputPath :: Lens.Lens' ProfilerRuleConfiguration (Prelude.Maybe Prelude.Text)
profilerRuleConfiguration_s3OutputPath :: (Maybe Text -> f (Maybe Text))
-> ProfilerRuleConfiguration -> f ProfilerRuleConfiguration
profilerRuleConfiguration_s3OutputPath = (ProfilerRuleConfiguration -> Maybe Text)
-> (ProfilerRuleConfiguration
    -> Maybe Text -> ProfilerRuleConfiguration)
-> Lens
     ProfilerRuleConfiguration
     ProfilerRuleConfiguration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProfilerRuleConfiguration' {Maybe Text
s3OutputPath :: Maybe Text
$sel:s3OutputPath:ProfilerRuleConfiguration' :: ProfilerRuleConfiguration -> Maybe Text
s3OutputPath} -> Maybe Text
s3OutputPath) (\s :: ProfilerRuleConfiguration
s@ProfilerRuleConfiguration' {} Maybe Text
a -> ProfilerRuleConfiguration
s {$sel:s3OutputPath:ProfilerRuleConfiguration' :: Maybe Text
s3OutputPath = Maybe Text
a} :: ProfilerRuleConfiguration)

-- | Path to local storage location for output of rules. Defaults to
-- @\/opt\/ml\/processing\/output\/rule\/@.
profilerRuleConfiguration_localPath :: Lens.Lens' ProfilerRuleConfiguration (Prelude.Maybe Prelude.Text)
profilerRuleConfiguration_localPath :: (Maybe Text -> f (Maybe Text))
-> ProfilerRuleConfiguration -> f ProfilerRuleConfiguration
profilerRuleConfiguration_localPath = (ProfilerRuleConfiguration -> Maybe Text)
-> (ProfilerRuleConfiguration
    -> Maybe Text -> ProfilerRuleConfiguration)
-> Lens
     ProfilerRuleConfiguration
     ProfilerRuleConfiguration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProfilerRuleConfiguration' {Maybe Text
localPath :: Maybe Text
$sel:localPath:ProfilerRuleConfiguration' :: ProfilerRuleConfiguration -> Maybe Text
localPath} -> Maybe Text
localPath) (\s :: ProfilerRuleConfiguration
s@ProfilerRuleConfiguration' {} Maybe Text
a -> ProfilerRuleConfiguration
s {$sel:localPath:ProfilerRuleConfiguration' :: Maybe Text
localPath = Maybe Text
a} :: ProfilerRuleConfiguration)

-- | The instance type to deploy a Debugger custom rule for profiling a
-- training job.
profilerRuleConfiguration_instanceType :: Lens.Lens' ProfilerRuleConfiguration (Prelude.Maybe ProcessingInstanceType)
profilerRuleConfiguration_instanceType :: (Maybe ProcessingInstanceType -> f (Maybe ProcessingInstanceType))
-> ProfilerRuleConfiguration -> f ProfilerRuleConfiguration
profilerRuleConfiguration_instanceType = (ProfilerRuleConfiguration -> Maybe ProcessingInstanceType)
-> (ProfilerRuleConfiguration
    -> Maybe ProcessingInstanceType -> ProfilerRuleConfiguration)
-> Lens
     ProfilerRuleConfiguration
     ProfilerRuleConfiguration
     (Maybe ProcessingInstanceType)
     (Maybe ProcessingInstanceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProfilerRuleConfiguration' {Maybe ProcessingInstanceType
instanceType :: Maybe ProcessingInstanceType
$sel:instanceType:ProfilerRuleConfiguration' :: ProfilerRuleConfiguration -> Maybe ProcessingInstanceType
instanceType} -> Maybe ProcessingInstanceType
instanceType) (\s :: ProfilerRuleConfiguration
s@ProfilerRuleConfiguration' {} Maybe ProcessingInstanceType
a -> ProfilerRuleConfiguration
s {$sel:instanceType:ProfilerRuleConfiguration' :: Maybe ProcessingInstanceType
instanceType = Maybe ProcessingInstanceType
a} :: ProfilerRuleConfiguration)

-- | The size, in GB, of the ML storage volume attached to the processing
-- instance.
profilerRuleConfiguration_volumeSizeInGB :: Lens.Lens' ProfilerRuleConfiguration (Prelude.Maybe Prelude.Natural)
profilerRuleConfiguration_volumeSizeInGB :: (Maybe Natural -> f (Maybe Natural))
-> ProfilerRuleConfiguration -> f ProfilerRuleConfiguration
profilerRuleConfiguration_volumeSizeInGB = (ProfilerRuleConfiguration -> Maybe Natural)
-> (ProfilerRuleConfiguration
    -> Maybe Natural -> ProfilerRuleConfiguration)
-> Lens
     ProfilerRuleConfiguration
     ProfilerRuleConfiguration
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProfilerRuleConfiguration' {Maybe Natural
volumeSizeInGB :: Maybe Natural
$sel:volumeSizeInGB:ProfilerRuleConfiguration' :: ProfilerRuleConfiguration -> Maybe Natural
volumeSizeInGB} -> Maybe Natural
volumeSizeInGB) (\s :: ProfilerRuleConfiguration
s@ProfilerRuleConfiguration' {} Maybe Natural
a -> ProfilerRuleConfiguration
s {$sel:volumeSizeInGB:ProfilerRuleConfiguration' :: Maybe Natural
volumeSizeInGB = Maybe Natural
a} :: ProfilerRuleConfiguration)

-- | The name of the rule configuration. It must be unique relative to other
-- rule configuration names.
profilerRuleConfiguration_ruleConfigurationName :: Lens.Lens' ProfilerRuleConfiguration Prelude.Text
profilerRuleConfiguration_ruleConfigurationName :: (Text -> f Text)
-> ProfilerRuleConfiguration -> f ProfilerRuleConfiguration
profilerRuleConfiguration_ruleConfigurationName = (ProfilerRuleConfiguration -> Text)
-> (ProfilerRuleConfiguration -> Text -> ProfilerRuleConfiguration)
-> Lens
     ProfilerRuleConfiguration ProfilerRuleConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProfilerRuleConfiguration' {Text
ruleConfigurationName :: Text
$sel:ruleConfigurationName:ProfilerRuleConfiguration' :: ProfilerRuleConfiguration -> Text
ruleConfigurationName} -> Text
ruleConfigurationName) (\s :: ProfilerRuleConfiguration
s@ProfilerRuleConfiguration' {} Text
a -> ProfilerRuleConfiguration
s {$sel:ruleConfigurationName:ProfilerRuleConfiguration' :: Text
ruleConfigurationName = Text
a} :: ProfilerRuleConfiguration)

-- | The Amazon Elastic Container (ECR) Image for the managed rule
-- evaluation.
profilerRuleConfiguration_ruleEvaluatorImage :: Lens.Lens' ProfilerRuleConfiguration Prelude.Text
profilerRuleConfiguration_ruleEvaluatorImage :: (Text -> f Text)
-> ProfilerRuleConfiguration -> f ProfilerRuleConfiguration
profilerRuleConfiguration_ruleEvaluatorImage = (ProfilerRuleConfiguration -> Text)
-> (ProfilerRuleConfiguration -> Text -> ProfilerRuleConfiguration)
-> Lens
     ProfilerRuleConfiguration ProfilerRuleConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProfilerRuleConfiguration' {Text
ruleEvaluatorImage :: Text
$sel:ruleEvaluatorImage:ProfilerRuleConfiguration' :: ProfilerRuleConfiguration -> Text
ruleEvaluatorImage} -> Text
ruleEvaluatorImage) (\s :: ProfilerRuleConfiguration
s@ProfilerRuleConfiguration' {} Text
a -> ProfilerRuleConfiguration
s {$sel:ruleEvaluatorImage:ProfilerRuleConfiguration' :: Text
ruleEvaluatorImage = Text
a} :: ProfilerRuleConfiguration)

instance Core.FromJSON ProfilerRuleConfiguration where
  parseJSON :: Value -> Parser ProfilerRuleConfiguration
parseJSON =
    String
-> (Object -> Parser ProfilerRuleConfiguration)
-> Value
-> Parser ProfilerRuleConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ProfilerRuleConfiguration"
      ( \Object
x ->
          Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe ProcessingInstanceType
-> Maybe Natural
-> Text
-> Text
-> ProfilerRuleConfiguration
ProfilerRuleConfiguration'
            (Maybe (HashMap Text Text)
 -> Maybe Text
 -> Maybe Text
 -> Maybe ProcessingInstanceType
 -> Maybe Natural
 -> Text
 -> Text
 -> ProfilerRuleConfiguration)
-> Parser (Maybe (HashMap Text Text))
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe ProcessingInstanceType
      -> Maybe Natural
      -> Text
      -> Text
      -> ProfilerRuleConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RuleParameters" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe ProcessingInstanceType
   -> Maybe Natural
   -> Text
   -> Text
   -> ProfilerRuleConfiguration)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe ProcessingInstanceType
      -> Maybe Natural
      -> Text
      -> Text
      -> ProfilerRuleConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"S3OutputPath")
            Parser
  (Maybe Text
   -> Maybe ProcessingInstanceType
   -> Maybe Natural
   -> Text
   -> Text
   -> ProfilerRuleConfiguration)
-> Parser (Maybe Text)
-> Parser
     (Maybe ProcessingInstanceType
      -> Maybe Natural -> Text -> Text -> ProfilerRuleConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LocalPath")
            Parser
  (Maybe ProcessingInstanceType
   -> Maybe Natural -> Text -> Text -> ProfilerRuleConfiguration)
-> Parser (Maybe ProcessingInstanceType)
-> Parser
     (Maybe Natural -> Text -> Text -> ProfilerRuleConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ProcessingInstanceType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"InstanceType")
            Parser (Maybe Natural -> Text -> Text -> ProfilerRuleConfiguration)
-> Parser (Maybe Natural)
-> Parser (Text -> Text -> ProfilerRuleConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"VolumeSizeInGB")
            Parser (Text -> Text -> ProfilerRuleConfiguration)
-> Parser Text -> Parser (Text -> ProfilerRuleConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"RuleConfigurationName")
            Parser (Text -> ProfilerRuleConfiguration)
-> Parser Text -> Parser ProfilerRuleConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"RuleEvaluatorImage")
      )

instance Prelude.Hashable ProfilerRuleConfiguration

instance Prelude.NFData ProfilerRuleConfiguration

instance Core.ToJSON ProfilerRuleConfiguration where
  toJSON :: ProfilerRuleConfiguration -> Value
toJSON ProfilerRuleConfiguration' {Maybe Natural
Maybe Text
Maybe (HashMap Text Text)
Maybe ProcessingInstanceType
Text
ruleEvaluatorImage :: Text
ruleConfigurationName :: Text
volumeSizeInGB :: Maybe Natural
instanceType :: Maybe ProcessingInstanceType
localPath :: Maybe Text
s3OutputPath :: Maybe Text
ruleParameters :: Maybe (HashMap Text Text)
$sel:ruleEvaluatorImage:ProfilerRuleConfiguration' :: ProfilerRuleConfiguration -> Text
$sel:ruleConfigurationName:ProfilerRuleConfiguration' :: ProfilerRuleConfiguration -> Text
$sel:volumeSizeInGB:ProfilerRuleConfiguration' :: ProfilerRuleConfiguration -> Maybe Natural
$sel:instanceType:ProfilerRuleConfiguration' :: ProfilerRuleConfiguration -> Maybe ProcessingInstanceType
$sel:localPath:ProfilerRuleConfiguration' :: ProfilerRuleConfiguration -> Maybe Text
$sel:s3OutputPath:ProfilerRuleConfiguration' :: ProfilerRuleConfiguration -> Maybe Text
$sel:ruleParameters:ProfilerRuleConfiguration' :: ProfilerRuleConfiguration -> Maybe (HashMap Text Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"RuleParameters" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
ruleParameters,
            (Text
"S3OutputPath" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
s3OutputPath,
            (Text
"LocalPath" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
localPath,
            (Text
"InstanceType" Text -> ProcessingInstanceType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ProcessingInstanceType -> Pair)
-> Maybe ProcessingInstanceType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ProcessingInstanceType
instanceType,
            (Text
"VolumeSizeInGB" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
volumeSizeInGB,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"RuleConfigurationName"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
ruleConfigurationName
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"RuleEvaluatorImage" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
ruleEvaluatorImage)
          ]
      )