{-# 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.ModelConfiguration
-- 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.ModelConfiguration 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
import Amazonka.SageMaker.Types.EnvironmentParameter

-- | Defines the model configuration. Includes the specification name and
-- environment parameters.
--
-- /See:/ 'newModelConfiguration' smart constructor.
data ModelConfiguration = ModelConfiguration'
  { -- | Defines the environment parameters that includes key, value types, and
    -- values.
    ModelConfiguration -> Maybe (NonEmpty EnvironmentParameter)
environmentParameters :: Prelude.Maybe (Prelude.NonEmpty EnvironmentParameter),
    -- | The inference specification name in the model package version.
    ModelConfiguration -> Maybe Text
inferenceSpecificationName :: Prelude.Maybe Prelude.Text
  }
  deriving (ModelConfiguration -> ModelConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModelConfiguration -> ModelConfiguration -> Bool
$c/= :: ModelConfiguration -> ModelConfiguration -> Bool
== :: ModelConfiguration -> ModelConfiguration -> Bool
$c== :: ModelConfiguration -> ModelConfiguration -> Bool
Prelude.Eq, ReadPrec [ModelConfiguration]
ReadPrec ModelConfiguration
Int -> ReadS ModelConfiguration
ReadS [ModelConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModelConfiguration]
$creadListPrec :: ReadPrec [ModelConfiguration]
readPrec :: ReadPrec ModelConfiguration
$creadPrec :: ReadPrec ModelConfiguration
readList :: ReadS [ModelConfiguration]
$creadList :: ReadS [ModelConfiguration]
readsPrec :: Int -> ReadS ModelConfiguration
$creadsPrec :: Int -> ReadS ModelConfiguration
Prelude.Read, Int -> ModelConfiguration -> ShowS
[ModelConfiguration] -> ShowS
ModelConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModelConfiguration] -> ShowS
$cshowList :: [ModelConfiguration] -> ShowS
show :: ModelConfiguration -> String
$cshow :: ModelConfiguration -> String
showsPrec :: Int -> ModelConfiguration -> ShowS
$cshowsPrec :: Int -> ModelConfiguration -> ShowS
Prelude.Show, forall x. Rep ModelConfiguration x -> ModelConfiguration
forall x. ModelConfiguration -> Rep ModelConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModelConfiguration x -> ModelConfiguration
$cfrom :: forall x. ModelConfiguration -> Rep ModelConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ModelConfiguration' 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:
--
-- 'environmentParameters', 'modelConfiguration_environmentParameters' - Defines the environment parameters that includes key, value types, and
-- values.
--
-- 'inferenceSpecificationName', 'modelConfiguration_inferenceSpecificationName' - The inference specification name in the model package version.
newModelConfiguration ::
  ModelConfiguration
newModelConfiguration :: ModelConfiguration
newModelConfiguration =
  ModelConfiguration'
    { $sel:environmentParameters:ModelConfiguration' :: Maybe (NonEmpty EnvironmentParameter)
environmentParameters =
        forall a. Maybe a
Prelude.Nothing,
      $sel:inferenceSpecificationName:ModelConfiguration' :: Maybe Text
inferenceSpecificationName = forall a. Maybe a
Prelude.Nothing
    }

-- | Defines the environment parameters that includes key, value types, and
-- values.
modelConfiguration_environmentParameters :: Lens.Lens' ModelConfiguration (Prelude.Maybe (Prelude.NonEmpty EnvironmentParameter))
modelConfiguration_environmentParameters :: Lens' ModelConfiguration (Maybe (NonEmpty EnvironmentParameter))
modelConfiguration_environmentParameters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelConfiguration' {Maybe (NonEmpty EnvironmentParameter)
environmentParameters :: Maybe (NonEmpty EnvironmentParameter)
$sel:environmentParameters:ModelConfiguration' :: ModelConfiguration -> Maybe (NonEmpty EnvironmentParameter)
environmentParameters} -> Maybe (NonEmpty EnvironmentParameter)
environmentParameters) (\s :: ModelConfiguration
s@ModelConfiguration' {} Maybe (NonEmpty EnvironmentParameter)
a -> ModelConfiguration
s {$sel:environmentParameters:ModelConfiguration' :: Maybe (NonEmpty EnvironmentParameter)
environmentParameters = Maybe (NonEmpty EnvironmentParameter)
a} :: ModelConfiguration) 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 inference specification name in the model package version.
modelConfiguration_inferenceSpecificationName :: Lens.Lens' ModelConfiguration (Prelude.Maybe Prelude.Text)
modelConfiguration_inferenceSpecificationName :: Lens' ModelConfiguration (Maybe Text)
modelConfiguration_inferenceSpecificationName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelConfiguration' {Maybe Text
inferenceSpecificationName :: Maybe Text
$sel:inferenceSpecificationName:ModelConfiguration' :: ModelConfiguration -> Maybe Text
inferenceSpecificationName} -> Maybe Text
inferenceSpecificationName) (\s :: ModelConfiguration
s@ModelConfiguration' {} Maybe Text
a -> ModelConfiguration
s {$sel:inferenceSpecificationName:ModelConfiguration' :: Maybe Text
inferenceSpecificationName = Maybe Text
a} :: ModelConfiguration)

instance Data.FromJSON ModelConfiguration where
  parseJSON :: Value -> Parser ModelConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ModelConfiguration"
      ( \Object
x ->
          Maybe (NonEmpty EnvironmentParameter)
-> Maybe Text -> ModelConfiguration
ModelConfiguration'
            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
"EnvironmentParameters")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"InferenceSpecificationName")
      )

instance Prelude.Hashable ModelConfiguration where
  hashWithSalt :: Int -> ModelConfiguration -> Int
hashWithSalt Int
_salt ModelConfiguration' {Maybe (NonEmpty EnvironmentParameter)
Maybe Text
inferenceSpecificationName :: Maybe Text
environmentParameters :: Maybe (NonEmpty EnvironmentParameter)
$sel:inferenceSpecificationName:ModelConfiguration' :: ModelConfiguration -> Maybe Text
$sel:environmentParameters:ModelConfiguration' :: ModelConfiguration -> Maybe (NonEmpty EnvironmentParameter)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty EnvironmentParameter)
environmentParameters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
inferenceSpecificationName

instance Prelude.NFData ModelConfiguration where
  rnf :: ModelConfiguration -> ()
rnf ModelConfiguration' {Maybe (NonEmpty EnvironmentParameter)
Maybe Text
inferenceSpecificationName :: Maybe Text
environmentParameters :: Maybe (NonEmpty EnvironmentParameter)
$sel:inferenceSpecificationName:ModelConfiguration' :: ModelConfiguration -> Maybe Text
$sel:environmentParameters:ModelConfiguration' :: ModelConfiguration -> Maybe (NonEmpty EnvironmentParameter)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty EnvironmentParameter)
environmentParameters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
inferenceSpecificationName