{-# 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.ModelExplainabilityAppSpecification
-- 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.ModelExplainabilityAppSpecification where

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

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

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

-- | Sets the environment variables in the Docker container.
modelExplainabilityAppSpecification_environment :: Lens.Lens' ModelExplainabilityAppSpecification (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
modelExplainabilityAppSpecification_environment :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ModelExplainabilityAppSpecification
-> f ModelExplainabilityAppSpecification
modelExplainabilityAppSpecification_environment = (ModelExplainabilityAppSpecification -> Maybe (HashMap Text Text))
-> (ModelExplainabilityAppSpecification
    -> Maybe (HashMap Text Text)
    -> ModelExplainabilityAppSpecification)
-> Lens
     ModelExplainabilityAppSpecification
     ModelExplainabilityAppSpecification
     (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 (\ModelExplainabilityAppSpecification' {Maybe (HashMap Text Text)
environment :: Maybe (HashMap Text Text)
$sel:environment:ModelExplainabilityAppSpecification' :: ModelExplainabilityAppSpecification -> Maybe (HashMap Text Text)
environment} -> Maybe (HashMap Text Text)
environment) (\s :: ModelExplainabilityAppSpecification
s@ModelExplainabilityAppSpecification' {} Maybe (HashMap Text Text)
a -> ModelExplainabilityAppSpecification
s {$sel:environment:ModelExplainabilityAppSpecification' :: Maybe (HashMap Text Text)
environment = Maybe (HashMap Text Text)
a} :: ModelExplainabilityAppSpecification) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> ModelExplainabilityAppSpecification
 -> f ModelExplainabilityAppSpecification)
-> ((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)))
-> ModelExplainabilityAppSpecification
-> f ModelExplainabilityAppSpecification
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

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

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

instance
  Core.FromJSON
    ModelExplainabilityAppSpecification
  where
  parseJSON :: Value -> Parser ModelExplainabilityAppSpecification
parseJSON =
    String
-> (Object -> Parser ModelExplainabilityAppSpecification)
-> Value
-> Parser ModelExplainabilityAppSpecification
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ModelExplainabilityAppSpecification"
      ( \Object
x ->
          Maybe (HashMap Text Text)
-> Text -> Text -> ModelExplainabilityAppSpecification
ModelExplainabilityAppSpecification'
            (Maybe (HashMap Text Text)
 -> Text -> Text -> ModelExplainabilityAppSpecification)
-> Parser (Maybe (HashMap Text Text))
-> Parser (Text -> Text -> ModelExplainabilityAppSpecification)
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
"Environment" 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 (Text -> Text -> ModelExplainabilityAppSpecification)
-> Parser Text
-> Parser (Text -> ModelExplainabilityAppSpecification)
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
"ImageUri")
            Parser (Text -> ModelExplainabilityAppSpecification)
-> Parser Text -> Parser ModelExplainabilityAppSpecification
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
"ConfigUri")
      )

instance
  Prelude.Hashable
    ModelExplainabilityAppSpecification

instance
  Prelude.NFData
    ModelExplainabilityAppSpecification

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