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

-- | Docker container image configuration object for the model bias job.
--
-- /See:/ 'newModelBiasAppSpecification' smart constructor.
data ModelBiasAppSpecification = ModelBiasAppSpecification'
  { -- | Sets the environment variables in the Docker container.
    ModelBiasAppSpecification -> Maybe (HashMap Text Text)
environment :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The container image to be run by the model bias job.
    ModelBiasAppSpecification -> Text
imageUri :: Prelude.Text,
    -- | JSON formatted S3 file that defines bias parameters. For more
    -- information on this JSON configuration file, see
    -- <https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-config-json-monitor-bias-parameters.html Configure bias parameters>.
    ModelBiasAppSpecification -> Text
configUri :: Prelude.Text
  }
  deriving (ModelBiasAppSpecification -> ModelBiasAppSpecification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModelBiasAppSpecification -> ModelBiasAppSpecification -> Bool
$c/= :: ModelBiasAppSpecification -> ModelBiasAppSpecification -> Bool
== :: ModelBiasAppSpecification -> ModelBiasAppSpecification -> Bool
$c== :: ModelBiasAppSpecification -> ModelBiasAppSpecification -> Bool
Prelude.Eq, ReadPrec [ModelBiasAppSpecification]
ReadPrec ModelBiasAppSpecification
Int -> ReadS ModelBiasAppSpecification
ReadS [ModelBiasAppSpecification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModelBiasAppSpecification]
$creadListPrec :: ReadPrec [ModelBiasAppSpecification]
readPrec :: ReadPrec ModelBiasAppSpecification
$creadPrec :: ReadPrec ModelBiasAppSpecification
readList :: ReadS [ModelBiasAppSpecification]
$creadList :: ReadS [ModelBiasAppSpecification]
readsPrec :: Int -> ReadS ModelBiasAppSpecification
$creadsPrec :: Int -> ReadS ModelBiasAppSpecification
Prelude.Read, Int -> ModelBiasAppSpecification -> ShowS
[ModelBiasAppSpecification] -> ShowS
ModelBiasAppSpecification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModelBiasAppSpecification] -> ShowS
$cshowList :: [ModelBiasAppSpecification] -> ShowS
show :: ModelBiasAppSpecification -> String
$cshow :: ModelBiasAppSpecification -> String
showsPrec :: Int -> ModelBiasAppSpecification -> ShowS
$cshowsPrec :: Int -> ModelBiasAppSpecification -> ShowS
Prelude.Show, forall x.
Rep ModelBiasAppSpecification x -> ModelBiasAppSpecification
forall x.
ModelBiasAppSpecification -> Rep ModelBiasAppSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ModelBiasAppSpecification x -> ModelBiasAppSpecification
$cfrom :: forall x.
ModelBiasAppSpecification -> Rep ModelBiasAppSpecification x
Prelude.Generic)

-- |
-- Create a value of 'ModelBiasAppSpecification' 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:
--
-- 'environment', 'modelBiasAppSpecification_environment' - Sets the environment variables in the Docker container.
--
-- 'imageUri', 'modelBiasAppSpecification_imageUri' - The container image to be run by the model bias job.
--
-- 'configUri', 'modelBiasAppSpecification_configUri' - JSON formatted S3 file that defines bias parameters. For more
-- information on this JSON configuration file, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-config-json-monitor-bias-parameters.html Configure bias parameters>.
newModelBiasAppSpecification ::
  -- | 'imageUri'
  Prelude.Text ->
  -- | 'configUri'
  Prelude.Text ->
  ModelBiasAppSpecification
newModelBiasAppSpecification :: Text -> Text -> ModelBiasAppSpecification
newModelBiasAppSpecification Text
pImageUri_ Text
pConfigUri_ =
  ModelBiasAppSpecification'
    { $sel:environment:ModelBiasAppSpecification' :: Maybe (HashMap Text Text)
environment =
        forall a. Maybe a
Prelude.Nothing,
      $sel:imageUri:ModelBiasAppSpecification' :: Text
imageUri = Text
pImageUri_,
      $sel:configUri:ModelBiasAppSpecification' :: Text
configUri = Text
pConfigUri_
    }

-- | Sets the environment variables in the Docker container.
modelBiasAppSpecification_environment :: Lens.Lens' ModelBiasAppSpecification (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
modelBiasAppSpecification_environment :: Lens' ModelBiasAppSpecification (Maybe (HashMap Text Text))
modelBiasAppSpecification_environment = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelBiasAppSpecification' {Maybe (HashMap Text Text)
environment :: Maybe (HashMap Text Text)
$sel:environment:ModelBiasAppSpecification' :: ModelBiasAppSpecification -> Maybe (HashMap Text Text)
environment} -> Maybe (HashMap Text Text)
environment) (\s :: ModelBiasAppSpecification
s@ModelBiasAppSpecification' {} Maybe (HashMap Text Text)
a -> ModelBiasAppSpecification
s {$sel:environment:ModelBiasAppSpecification' :: Maybe (HashMap Text Text)
environment = Maybe (HashMap Text Text)
a} :: ModelBiasAppSpecification) 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

-- | The container image to be run by the model bias job.
modelBiasAppSpecification_imageUri :: Lens.Lens' ModelBiasAppSpecification Prelude.Text
modelBiasAppSpecification_imageUri :: Lens' ModelBiasAppSpecification Text
modelBiasAppSpecification_imageUri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelBiasAppSpecification' {Text
imageUri :: Text
$sel:imageUri:ModelBiasAppSpecification' :: ModelBiasAppSpecification -> Text
imageUri} -> Text
imageUri) (\s :: ModelBiasAppSpecification
s@ModelBiasAppSpecification' {} Text
a -> ModelBiasAppSpecification
s {$sel:imageUri:ModelBiasAppSpecification' :: Text
imageUri = Text
a} :: ModelBiasAppSpecification)

-- | JSON formatted S3 file that defines bias parameters. For more
-- information on this JSON configuration file, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-config-json-monitor-bias-parameters.html Configure bias parameters>.
modelBiasAppSpecification_configUri :: Lens.Lens' ModelBiasAppSpecification Prelude.Text
modelBiasAppSpecification_configUri :: Lens' ModelBiasAppSpecification Text
modelBiasAppSpecification_configUri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelBiasAppSpecification' {Text
configUri :: Text
$sel:configUri:ModelBiasAppSpecification' :: ModelBiasAppSpecification -> Text
configUri} -> Text
configUri) (\s :: ModelBiasAppSpecification
s@ModelBiasAppSpecification' {} Text
a -> ModelBiasAppSpecification
s {$sel:configUri:ModelBiasAppSpecification' :: Text
configUri = Text
a} :: ModelBiasAppSpecification)

instance Data.FromJSON ModelBiasAppSpecification where
  parseJSON :: Value -> Parser ModelBiasAppSpecification
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ModelBiasAppSpecification"
      ( \Object
x ->
          Maybe (HashMap Text Text)
-> Text -> Text -> ModelBiasAppSpecification
ModelBiasAppSpecification'
            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
"Environment" 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 a
Data..: Key
"ImageUri")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ConfigUri")
      )

instance Prelude.Hashable ModelBiasAppSpecification where
  hashWithSalt :: Int -> ModelBiasAppSpecification -> Int
hashWithSalt Int
_salt ModelBiasAppSpecification' {Maybe (HashMap Text Text)
Text
configUri :: Text
imageUri :: Text
environment :: Maybe (HashMap Text Text)
$sel:configUri:ModelBiasAppSpecification' :: ModelBiasAppSpecification -> Text
$sel:imageUri:ModelBiasAppSpecification' :: ModelBiasAppSpecification -> Text
$sel:environment:ModelBiasAppSpecification' :: ModelBiasAppSpecification -> Maybe (HashMap Text Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
environment
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
imageUri
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
configUri

instance Prelude.NFData ModelBiasAppSpecification where
  rnf :: ModelBiasAppSpecification -> ()
rnf ModelBiasAppSpecification' {Maybe (HashMap Text Text)
Text
configUri :: Text
imageUri :: Text
environment :: Maybe (HashMap Text Text)
$sel:configUri:ModelBiasAppSpecification' :: ModelBiasAppSpecification -> Text
$sel:imageUri:ModelBiasAppSpecification' :: ModelBiasAppSpecification -> Text
$sel:environment:ModelBiasAppSpecification' :: ModelBiasAppSpecification -> Maybe (HashMap Text Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
environment
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
imageUri
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
configUri

instance Data.ToJSON ModelBiasAppSpecification where
  toJSON :: ModelBiasAppSpecification -> Value
toJSON ModelBiasAppSpecification' {Maybe (HashMap Text Text)
Text
configUri :: Text
imageUri :: Text
environment :: Maybe (HashMap Text Text)
$sel:configUri:ModelBiasAppSpecification' :: ModelBiasAppSpecification -> Text
$sel:imageUri:ModelBiasAppSpecification' :: ModelBiasAppSpecification -> Text
$sel:environment:ModelBiasAppSpecification' :: ModelBiasAppSpecification -> Maybe (HashMap Text Text)
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Environment" 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 (HashMap Text Text)
environment,
            forall a. a -> Maybe a
Prelude.Just (Key
"ImageUri" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
imageUri),
            forall a. a -> Maybe a
Prelude.Just (Key
"ConfigUri" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
configUri)
          ]
      )