{-# 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.ModelInfrastructureConfig
-- 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.ModelInfrastructureConfig 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.ModelInfrastructureType
import Amazonka.SageMaker.Types.RealTimeInferenceConfig

-- | The configuration for the infrastructure that the model will be deployed
-- to.
--
-- /See:/ 'newModelInfrastructureConfig' smart constructor.
data ModelInfrastructureConfig = ModelInfrastructureConfig'
  { -- | The inference option to which to deploy your model. Possible values are
    -- the following:
    --
    -- -   @RealTime@: Deploy to real-time inference.
    ModelInfrastructureConfig -> ModelInfrastructureType
infrastructureType :: ModelInfrastructureType,
    -- | The infrastructure configuration for deploying the model to real-time
    -- inference.
    ModelInfrastructureConfig -> RealTimeInferenceConfig
realTimeInferenceConfig :: RealTimeInferenceConfig
  }
  deriving (ModelInfrastructureConfig -> ModelInfrastructureConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModelInfrastructureConfig -> ModelInfrastructureConfig -> Bool
$c/= :: ModelInfrastructureConfig -> ModelInfrastructureConfig -> Bool
== :: ModelInfrastructureConfig -> ModelInfrastructureConfig -> Bool
$c== :: ModelInfrastructureConfig -> ModelInfrastructureConfig -> Bool
Prelude.Eq, ReadPrec [ModelInfrastructureConfig]
ReadPrec ModelInfrastructureConfig
Int -> ReadS ModelInfrastructureConfig
ReadS [ModelInfrastructureConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModelInfrastructureConfig]
$creadListPrec :: ReadPrec [ModelInfrastructureConfig]
readPrec :: ReadPrec ModelInfrastructureConfig
$creadPrec :: ReadPrec ModelInfrastructureConfig
readList :: ReadS [ModelInfrastructureConfig]
$creadList :: ReadS [ModelInfrastructureConfig]
readsPrec :: Int -> ReadS ModelInfrastructureConfig
$creadsPrec :: Int -> ReadS ModelInfrastructureConfig
Prelude.Read, Int -> ModelInfrastructureConfig -> ShowS
[ModelInfrastructureConfig] -> ShowS
ModelInfrastructureConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModelInfrastructureConfig] -> ShowS
$cshowList :: [ModelInfrastructureConfig] -> ShowS
show :: ModelInfrastructureConfig -> String
$cshow :: ModelInfrastructureConfig -> String
showsPrec :: Int -> ModelInfrastructureConfig -> ShowS
$cshowsPrec :: Int -> ModelInfrastructureConfig -> ShowS
Prelude.Show, forall x.
Rep ModelInfrastructureConfig x -> ModelInfrastructureConfig
forall x.
ModelInfrastructureConfig -> Rep ModelInfrastructureConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ModelInfrastructureConfig x -> ModelInfrastructureConfig
$cfrom :: forall x.
ModelInfrastructureConfig -> Rep ModelInfrastructureConfig x
Prelude.Generic)

-- |
-- Create a value of 'ModelInfrastructureConfig' 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:
--
-- 'infrastructureType', 'modelInfrastructureConfig_infrastructureType' - The inference option to which to deploy your model. Possible values are
-- the following:
--
-- -   @RealTime@: Deploy to real-time inference.
--
-- 'realTimeInferenceConfig', 'modelInfrastructureConfig_realTimeInferenceConfig' - The infrastructure configuration for deploying the model to real-time
-- inference.
newModelInfrastructureConfig ::
  -- | 'infrastructureType'
  ModelInfrastructureType ->
  -- | 'realTimeInferenceConfig'
  RealTimeInferenceConfig ->
  ModelInfrastructureConfig
newModelInfrastructureConfig :: ModelInfrastructureType
-> RealTimeInferenceConfig -> ModelInfrastructureConfig
newModelInfrastructureConfig
  ModelInfrastructureType
pInfrastructureType_
  RealTimeInferenceConfig
pRealTimeInferenceConfig_ =
    ModelInfrastructureConfig'
      { $sel:infrastructureType:ModelInfrastructureConfig' :: ModelInfrastructureType
infrastructureType =
          ModelInfrastructureType
pInfrastructureType_,
        $sel:realTimeInferenceConfig:ModelInfrastructureConfig' :: RealTimeInferenceConfig
realTimeInferenceConfig =
          RealTimeInferenceConfig
pRealTimeInferenceConfig_
      }

-- | The inference option to which to deploy your model. Possible values are
-- the following:
--
-- -   @RealTime@: Deploy to real-time inference.
modelInfrastructureConfig_infrastructureType :: Lens.Lens' ModelInfrastructureConfig ModelInfrastructureType
modelInfrastructureConfig_infrastructureType :: Lens' ModelInfrastructureConfig ModelInfrastructureType
modelInfrastructureConfig_infrastructureType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelInfrastructureConfig' {ModelInfrastructureType
infrastructureType :: ModelInfrastructureType
$sel:infrastructureType:ModelInfrastructureConfig' :: ModelInfrastructureConfig -> ModelInfrastructureType
infrastructureType} -> ModelInfrastructureType
infrastructureType) (\s :: ModelInfrastructureConfig
s@ModelInfrastructureConfig' {} ModelInfrastructureType
a -> ModelInfrastructureConfig
s {$sel:infrastructureType:ModelInfrastructureConfig' :: ModelInfrastructureType
infrastructureType = ModelInfrastructureType
a} :: ModelInfrastructureConfig)

-- | The infrastructure configuration for deploying the model to real-time
-- inference.
modelInfrastructureConfig_realTimeInferenceConfig :: Lens.Lens' ModelInfrastructureConfig RealTimeInferenceConfig
modelInfrastructureConfig_realTimeInferenceConfig :: Lens' ModelInfrastructureConfig RealTimeInferenceConfig
modelInfrastructureConfig_realTimeInferenceConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelInfrastructureConfig' {RealTimeInferenceConfig
realTimeInferenceConfig :: RealTimeInferenceConfig
$sel:realTimeInferenceConfig:ModelInfrastructureConfig' :: ModelInfrastructureConfig -> RealTimeInferenceConfig
realTimeInferenceConfig} -> RealTimeInferenceConfig
realTimeInferenceConfig) (\s :: ModelInfrastructureConfig
s@ModelInfrastructureConfig' {} RealTimeInferenceConfig
a -> ModelInfrastructureConfig
s {$sel:realTimeInferenceConfig:ModelInfrastructureConfig' :: RealTimeInferenceConfig
realTimeInferenceConfig = RealTimeInferenceConfig
a} :: ModelInfrastructureConfig)

instance Data.FromJSON ModelInfrastructureConfig where
  parseJSON :: Value -> Parser ModelInfrastructureConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ModelInfrastructureConfig"
      ( \Object
x ->
          ModelInfrastructureType
-> RealTimeInferenceConfig -> ModelInfrastructureConfig
ModelInfrastructureConfig'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"InfrastructureType")
            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
"RealTimeInferenceConfig")
      )

instance Prelude.Hashable ModelInfrastructureConfig where
  hashWithSalt :: Int -> ModelInfrastructureConfig -> Int
hashWithSalt Int
_salt ModelInfrastructureConfig' {ModelInfrastructureType
RealTimeInferenceConfig
realTimeInferenceConfig :: RealTimeInferenceConfig
infrastructureType :: ModelInfrastructureType
$sel:realTimeInferenceConfig:ModelInfrastructureConfig' :: ModelInfrastructureConfig -> RealTimeInferenceConfig
$sel:infrastructureType:ModelInfrastructureConfig' :: ModelInfrastructureConfig -> ModelInfrastructureType
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ModelInfrastructureType
infrastructureType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` RealTimeInferenceConfig
realTimeInferenceConfig

instance Prelude.NFData ModelInfrastructureConfig where
  rnf :: ModelInfrastructureConfig -> ()
rnf ModelInfrastructureConfig' {ModelInfrastructureType
RealTimeInferenceConfig
realTimeInferenceConfig :: RealTimeInferenceConfig
infrastructureType :: ModelInfrastructureType
$sel:realTimeInferenceConfig:ModelInfrastructureConfig' :: ModelInfrastructureConfig -> RealTimeInferenceConfig
$sel:infrastructureType:ModelInfrastructureConfig' :: ModelInfrastructureConfig -> ModelInfrastructureType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf ModelInfrastructureType
infrastructureType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf RealTimeInferenceConfig
realTimeInferenceConfig

instance Data.ToJSON ModelInfrastructureConfig where
  toJSON :: ModelInfrastructureConfig -> Value
toJSON ModelInfrastructureConfig' {ModelInfrastructureType
RealTimeInferenceConfig
realTimeInferenceConfig :: RealTimeInferenceConfig
infrastructureType :: ModelInfrastructureType
$sel:realTimeInferenceConfig:ModelInfrastructureConfig' :: ModelInfrastructureConfig -> RealTimeInferenceConfig
$sel:infrastructureType:ModelInfrastructureConfig' :: ModelInfrastructureConfig -> ModelInfrastructureType
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"InfrastructureType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ModelInfrastructureType
infrastructureType),
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"RealTimeInferenceConfig"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= RealTimeInferenceConfig
realTimeInferenceConfig
              )
          ]
      )