{-# 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-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.ModelBiasAppSpecification 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 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/json-bias-parameter-config.html Configure bias parameters>.
    ModelBiasAppSpecification -> Text
configUri :: Prelude.Text
  }
  deriving (ModelBiasAppSpecification -> ModelBiasAppSpecification -> Bool
(ModelBiasAppSpecification -> ModelBiasAppSpecification -> Bool)
-> (ModelBiasAppSpecification -> ModelBiasAppSpecification -> Bool)
-> Eq ModelBiasAppSpecification
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]
(Int -> ReadS ModelBiasAppSpecification)
-> ReadS [ModelBiasAppSpecification]
-> ReadPrec ModelBiasAppSpecification
-> ReadPrec [ModelBiasAppSpecification]
-> Read 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
(Int -> ModelBiasAppSpecification -> ShowS)
-> (ModelBiasAppSpecification -> String)
-> ([ModelBiasAppSpecification] -> ShowS)
-> Show ModelBiasAppSpecification
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.
 ModelBiasAppSpecification -> Rep ModelBiasAppSpecification x)
-> (forall x.
    Rep ModelBiasAppSpecification x -> ModelBiasAppSpecification)
-> Generic ModelBiasAppSpecification
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/json-bias-parameter-config.html Configure bias parameters>.
newModelBiasAppSpecification ::
  -- | 'imageUri'
  Prelude.Text ->
  -- | 'configUri'
  Prelude.Text ->
  ModelBiasAppSpecification
newModelBiasAppSpecification :: Text -> Text -> ModelBiasAppSpecification
newModelBiasAppSpecification Text
pImageUri_ Text
pConfigUri_ =
  ModelBiasAppSpecification' :: Maybe (HashMap Text Text)
-> Text -> Text -> ModelBiasAppSpecification
ModelBiasAppSpecification'
    { $sel:environment:ModelBiasAppSpecification' :: Maybe (HashMap Text Text)
environment =
        Maybe (HashMap Text Text)
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 :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ModelBiasAppSpecification -> f ModelBiasAppSpecification
modelBiasAppSpecification_environment = (ModelBiasAppSpecification -> Maybe (HashMap Text Text))
-> (ModelBiasAppSpecification
    -> Maybe (HashMap Text Text) -> ModelBiasAppSpecification)
-> Lens
     ModelBiasAppSpecification
     ModelBiasAppSpecification
     (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 (\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) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> ModelBiasAppSpecification -> f ModelBiasAppSpecification)
-> ((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)))
-> ModelBiasAppSpecification
-> f ModelBiasAppSpecification
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 bias job.
modelBiasAppSpecification_imageUri :: Lens.Lens' ModelBiasAppSpecification Prelude.Text
modelBiasAppSpecification_imageUri :: (Text -> f Text)
-> ModelBiasAppSpecification -> f ModelBiasAppSpecification
modelBiasAppSpecification_imageUri = (ModelBiasAppSpecification -> Text)
-> (ModelBiasAppSpecification -> Text -> ModelBiasAppSpecification)
-> Lens
     ModelBiasAppSpecification ModelBiasAppSpecification Text Text
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/json-bias-parameter-config.html Configure bias parameters>.
modelBiasAppSpecification_configUri :: Lens.Lens' ModelBiasAppSpecification Prelude.Text
modelBiasAppSpecification_configUri :: (Text -> f Text)
-> ModelBiasAppSpecification -> f ModelBiasAppSpecification
modelBiasAppSpecification_configUri = (ModelBiasAppSpecification -> Text)
-> (ModelBiasAppSpecification -> Text -> ModelBiasAppSpecification)
-> Lens
     ModelBiasAppSpecification ModelBiasAppSpecification Text Text
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 Core.FromJSON ModelBiasAppSpecification where
  parseJSON :: Value -> Parser ModelBiasAppSpecification
parseJSON =
    String
-> (Object -> Parser ModelBiasAppSpecification)
-> Value
-> Parser ModelBiasAppSpecification
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ModelBiasAppSpecification"
      ( \Object
x ->
          Maybe (HashMap Text Text)
-> Text -> Text -> ModelBiasAppSpecification
ModelBiasAppSpecification'
            (Maybe (HashMap Text Text)
 -> Text -> Text -> ModelBiasAppSpecification)
-> Parser (Maybe (HashMap Text Text))
-> Parser (Text -> Text -> ModelBiasAppSpecification)
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 -> ModelBiasAppSpecification)
-> Parser Text -> Parser (Text -> ModelBiasAppSpecification)
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 -> ModelBiasAppSpecification)
-> Parser Text -> Parser ModelBiasAppSpecification
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 ModelBiasAppSpecification

instance Prelude.NFData ModelBiasAppSpecification

instance Core.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
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)
          ]
      )