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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.ModelPackageContainerDefinition
import Amazonka.SageMaker.Types.ProductionVariantInstanceType
import Amazonka.SageMaker.Types.TransformInstanceType

-- | Defines how to perform inference generation after a training job is run.
--
-- /See:/ 'newInferenceSpecification' smart constructor.
data InferenceSpecification = InferenceSpecification'
  { -- | A list of the instance types that are used to generate inferences in
    -- real-time.
    --
    -- This parameter is required for unversioned models, and optional for
    -- versioned models.
    InferenceSpecification -> Maybe [ProductionVariantInstanceType]
supportedRealtimeInferenceInstanceTypes :: Prelude.Maybe [ProductionVariantInstanceType],
    -- | A list of the instance types on which a transformation job can be run or
    -- on which an endpoint can be deployed.
    --
    -- This parameter is required for unversioned models, and optional for
    -- versioned models.
    InferenceSpecification -> Maybe (NonEmpty TransformInstanceType)
supportedTransformInstanceTypes :: Prelude.Maybe (Prelude.NonEmpty TransformInstanceType),
    -- | The Amazon ECR registry path of the Docker image that contains the
    -- inference code.
    InferenceSpecification -> NonEmpty ModelPackageContainerDefinition
containers :: Prelude.NonEmpty ModelPackageContainerDefinition,
    -- | The supported MIME types for the input data.
    InferenceSpecification -> [Text]
supportedContentTypes :: [Prelude.Text],
    -- | The supported MIME types for the output data.
    InferenceSpecification -> [Text]
supportedResponseMIMETypes :: [Prelude.Text]
  }
  deriving (InferenceSpecification -> InferenceSpecification -> Bool
(InferenceSpecification -> InferenceSpecification -> Bool)
-> (InferenceSpecification -> InferenceSpecification -> Bool)
-> Eq InferenceSpecification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InferenceSpecification -> InferenceSpecification -> Bool
$c/= :: InferenceSpecification -> InferenceSpecification -> Bool
== :: InferenceSpecification -> InferenceSpecification -> Bool
$c== :: InferenceSpecification -> InferenceSpecification -> Bool
Prelude.Eq, ReadPrec [InferenceSpecification]
ReadPrec InferenceSpecification
Int -> ReadS InferenceSpecification
ReadS [InferenceSpecification]
(Int -> ReadS InferenceSpecification)
-> ReadS [InferenceSpecification]
-> ReadPrec InferenceSpecification
-> ReadPrec [InferenceSpecification]
-> Read InferenceSpecification
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InferenceSpecification]
$creadListPrec :: ReadPrec [InferenceSpecification]
readPrec :: ReadPrec InferenceSpecification
$creadPrec :: ReadPrec InferenceSpecification
readList :: ReadS [InferenceSpecification]
$creadList :: ReadS [InferenceSpecification]
readsPrec :: Int -> ReadS InferenceSpecification
$creadsPrec :: Int -> ReadS InferenceSpecification
Prelude.Read, Int -> InferenceSpecification -> ShowS
[InferenceSpecification] -> ShowS
InferenceSpecification -> String
(Int -> InferenceSpecification -> ShowS)
-> (InferenceSpecification -> String)
-> ([InferenceSpecification] -> ShowS)
-> Show InferenceSpecification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InferenceSpecification] -> ShowS
$cshowList :: [InferenceSpecification] -> ShowS
show :: InferenceSpecification -> String
$cshow :: InferenceSpecification -> String
showsPrec :: Int -> InferenceSpecification -> ShowS
$cshowsPrec :: Int -> InferenceSpecification -> ShowS
Prelude.Show, (forall x. InferenceSpecification -> Rep InferenceSpecification x)
-> (forall x.
    Rep InferenceSpecification x -> InferenceSpecification)
-> Generic InferenceSpecification
forall x. Rep InferenceSpecification x -> InferenceSpecification
forall x. InferenceSpecification -> Rep InferenceSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InferenceSpecification x -> InferenceSpecification
$cfrom :: forall x. InferenceSpecification -> Rep InferenceSpecification x
Prelude.Generic)

-- |
-- Create a value of 'InferenceSpecification' 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:
--
-- 'supportedRealtimeInferenceInstanceTypes', 'inferenceSpecification_supportedRealtimeInferenceInstanceTypes' - A list of the instance types that are used to generate inferences in
-- real-time.
--
-- This parameter is required for unversioned models, and optional for
-- versioned models.
--
-- 'supportedTransformInstanceTypes', 'inferenceSpecification_supportedTransformInstanceTypes' - A list of the instance types on which a transformation job can be run or
-- on which an endpoint can be deployed.
--
-- This parameter is required for unversioned models, and optional for
-- versioned models.
--
-- 'containers', 'inferenceSpecification_containers' - The Amazon ECR registry path of the Docker image that contains the
-- inference code.
--
-- 'supportedContentTypes', 'inferenceSpecification_supportedContentTypes' - The supported MIME types for the input data.
--
-- 'supportedResponseMIMETypes', 'inferenceSpecification_supportedResponseMIMETypes' - The supported MIME types for the output data.
newInferenceSpecification ::
  -- | 'containers'
  Prelude.NonEmpty ModelPackageContainerDefinition ->
  InferenceSpecification
newInferenceSpecification :: NonEmpty ModelPackageContainerDefinition -> InferenceSpecification
newInferenceSpecification NonEmpty ModelPackageContainerDefinition
pContainers_ =
  InferenceSpecification' :: Maybe [ProductionVariantInstanceType]
-> Maybe (NonEmpty TransformInstanceType)
-> NonEmpty ModelPackageContainerDefinition
-> [Text]
-> [Text]
-> InferenceSpecification
InferenceSpecification'
    { $sel:supportedRealtimeInferenceInstanceTypes:InferenceSpecification' :: Maybe [ProductionVariantInstanceType]
supportedRealtimeInferenceInstanceTypes =
        Maybe [ProductionVariantInstanceType]
forall a. Maybe a
Prelude.Nothing,
      $sel:supportedTransformInstanceTypes:InferenceSpecification' :: Maybe (NonEmpty TransformInstanceType)
supportedTransformInstanceTypes = Maybe (NonEmpty TransformInstanceType)
forall a. Maybe a
Prelude.Nothing,
      $sel:containers:InferenceSpecification' :: NonEmpty ModelPackageContainerDefinition
containers = Tagged
  (NonEmpty ModelPackageContainerDefinition)
  (Identity (NonEmpty ModelPackageContainerDefinition))
-> Tagged
     (NonEmpty ModelPackageContainerDefinition)
     (Identity (NonEmpty ModelPackageContainerDefinition))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
   (NonEmpty ModelPackageContainerDefinition)
   (Identity (NonEmpty ModelPackageContainerDefinition))
 -> Tagged
      (NonEmpty ModelPackageContainerDefinition)
      (Identity (NonEmpty ModelPackageContainerDefinition)))
-> NonEmpty ModelPackageContainerDefinition
-> NonEmpty ModelPackageContainerDefinition
forall t b. AReview t b -> b -> t
Lens.# NonEmpty ModelPackageContainerDefinition
pContainers_,
      $sel:supportedContentTypes:InferenceSpecification' :: [Text]
supportedContentTypes = [Text]
forall a. Monoid a => a
Prelude.mempty,
      $sel:supportedResponseMIMETypes:InferenceSpecification' :: [Text]
supportedResponseMIMETypes = [Text]
forall a. Monoid a => a
Prelude.mempty
    }

-- | A list of the instance types that are used to generate inferences in
-- real-time.
--
-- This parameter is required for unversioned models, and optional for
-- versioned models.
inferenceSpecification_supportedRealtimeInferenceInstanceTypes :: Lens.Lens' InferenceSpecification (Prelude.Maybe [ProductionVariantInstanceType])
inferenceSpecification_supportedRealtimeInferenceInstanceTypes :: (Maybe [ProductionVariantInstanceType]
 -> f (Maybe [ProductionVariantInstanceType]))
-> InferenceSpecification -> f InferenceSpecification
inferenceSpecification_supportedRealtimeInferenceInstanceTypes = (InferenceSpecification -> Maybe [ProductionVariantInstanceType])
-> (InferenceSpecification
    -> Maybe [ProductionVariantInstanceType] -> InferenceSpecification)
-> Lens
     InferenceSpecification
     InferenceSpecification
     (Maybe [ProductionVariantInstanceType])
     (Maybe [ProductionVariantInstanceType])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InferenceSpecification' {Maybe [ProductionVariantInstanceType]
supportedRealtimeInferenceInstanceTypes :: Maybe [ProductionVariantInstanceType]
$sel:supportedRealtimeInferenceInstanceTypes:InferenceSpecification' :: InferenceSpecification -> Maybe [ProductionVariantInstanceType]
supportedRealtimeInferenceInstanceTypes} -> Maybe [ProductionVariantInstanceType]
supportedRealtimeInferenceInstanceTypes) (\s :: InferenceSpecification
s@InferenceSpecification' {} Maybe [ProductionVariantInstanceType]
a -> InferenceSpecification
s {$sel:supportedRealtimeInferenceInstanceTypes:InferenceSpecification' :: Maybe [ProductionVariantInstanceType]
supportedRealtimeInferenceInstanceTypes = Maybe [ProductionVariantInstanceType]
a} :: InferenceSpecification) ((Maybe [ProductionVariantInstanceType]
  -> f (Maybe [ProductionVariantInstanceType]))
 -> InferenceSpecification -> f InferenceSpecification)
-> ((Maybe [ProductionVariantInstanceType]
     -> f (Maybe [ProductionVariantInstanceType]))
    -> Maybe [ProductionVariantInstanceType]
    -> f (Maybe [ProductionVariantInstanceType]))
-> (Maybe [ProductionVariantInstanceType]
    -> f (Maybe [ProductionVariantInstanceType]))
-> InferenceSpecification
-> f InferenceSpecification
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ProductionVariantInstanceType]
  [ProductionVariantInstanceType]
  [ProductionVariantInstanceType]
  [ProductionVariantInstanceType]
-> Iso
     (Maybe [ProductionVariantInstanceType])
     (Maybe [ProductionVariantInstanceType])
     (Maybe [ProductionVariantInstanceType])
     (Maybe [ProductionVariantInstanceType])
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
  [ProductionVariantInstanceType]
  [ProductionVariantInstanceType]
  [ProductionVariantInstanceType]
  [ProductionVariantInstanceType]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list of the instance types on which a transformation job can be run or
-- on which an endpoint can be deployed.
--
-- This parameter is required for unversioned models, and optional for
-- versioned models.
inferenceSpecification_supportedTransformInstanceTypes :: Lens.Lens' InferenceSpecification (Prelude.Maybe (Prelude.NonEmpty TransformInstanceType))
inferenceSpecification_supportedTransformInstanceTypes :: (Maybe (NonEmpty TransformInstanceType)
 -> f (Maybe (NonEmpty TransformInstanceType)))
-> InferenceSpecification -> f InferenceSpecification
inferenceSpecification_supportedTransformInstanceTypes = (InferenceSpecification -> Maybe (NonEmpty TransformInstanceType))
-> (InferenceSpecification
    -> Maybe (NonEmpty TransformInstanceType)
    -> InferenceSpecification)
-> Lens
     InferenceSpecification
     InferenceSpecification
     (Maybe (NonEmpty TransformInstanceType))
     (Maybe (NonEmpty TransformInstanceType))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InferenceSpecification' {Maybe (NonEmpty TransformInstanceType)
supportedTransformInstanceTypes :: Maybe (NonEmpty TransformInstanceType)
$sel:supportedTransformInstanceTypes:InferenceSpecification' :: InferenceSpecification -> Maybe (NonEmpty TransformInstanceType)
supportedTransformInstanceTypes} -> Maybe (NonEmpty TransformInstanceType)
supportedTransformInstanceTypes) (\s :: InferenceSpecification
s@InferenceSpecification' {} Maybe (NonEmpty TransformInstanceType)
a -> InferenceSpecification
s {$sel:supportedTransformInstanceTypes:InferenceSpecification' :: Maybe (NonEmpty TransformInstanceType)
supportedTransformInstanceTypes = Maybe (NonEmpty TransformInstanceType)
a} :: InferenceSpecification) ((Maybe (NonEmpty TransformInstanceType)
  -> f (Maybe (NonEmpty TransformInstanceType)))
 -> InferenceSpecification -> f InferenceSpecification)
-> ((Maybe (NonEmpty TransformInstanceType)
     -> f (Maybe (NonEmpty TransformInstanceType)))
    -> Maybe (NonEmpty TransformInstanceType)
    -> f (Maybe (NonEmpty TransformInstanceType)))
-> (Maybe (NonEmpty TransformInstanceType)
    -> f (Maybe (NonEmpty TransformInstanceType)))
-> InferenceSpecification
-> f InferenceSpecification
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty TransformInstanceType)
  (NonEmpty TransformInstanceType)
  (NonEmpty TransformInstanceType)
  (NonEmpty TransformInstanceType)
-> Iso
     (Maybe (NonEmpty TransformInstanceType))
     (Maybe (NonEmpty TransformInstanceType))
     (Maybe (NonEmpty TransformInstanceType))
     (Maybe (NonEmpty TransformInstanceType))
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
  (NonEmpty TransformInstanceType)
  (NonEmpty TransformInstanceType)
  (NonEmpty TransformInstanceType)
  (NonEmpty TransformInstanceType)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Amazon ECR registry path of the Docker image that contains the
-- inference code.
inferenceSpecification_containers :: Lens.Lens' InferenceSpecification (Prelude.NonEmpty ModelPackageContainerDefinition)
inferenceSpecification_containers :: (NonEmpty ModelPackageContainerDefinition
 -> f (NonEmpty ModelPackageContainerDefinition))
-> InferenceSpecification -> f InferenceSpecification
inferenceSpecification_containers = (InferenceSpecification
 -> NonEmpty ModelPackageContainerDefinition)
-> (InferenceSpecification
    -> NonEmpty ModelPackageContainerDefinition
    -> InferenceSpecification)
-> Lens
     InferenceSpecification
     InferenceSpecification
     (NonEmpty ModelPackageContainerDefinition)
     (NonEmpty ModelPackageContainerDefinition)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InferenceSpecification' {NonEmpty ModelPackageContainerDefinition
containers :: NonEmpty ModelPackageContainerDefinition
$sel:containers:InferenceSpecification' :: InferenceSpecification -> NonEmpty ModelPackageContainerDefinition
containers} -> NonEmpty ModelPackageContainerDefinition
containers) (\s :: InferenceSpecification
s@InferenceSpecification' {} NonEmpty ModelPackageContainerDefinition
a -> InferenceSpecification
s {$sel:containers:InferenceSpecification' :: NonEmpty ModelPackageContainerDefinition
containers = NonEmpty ModelPackageContainerDefinition
a} :: InferenceSpecification) ((NonEmpty ModelPackageContainerDefinition
  -> f (NonEmpty ModelPackageContainerDefinition))
 -> InferenceSpecification -> f InferenceSpecification)
-> ((NonEmpty ModelPackageContainerDefinition
     -> f (NonEmpty ModelPackageContainerDefinition))
    -> NonEmpty ModelPackageContainerDefinition
    -> f (NonEmpty ModelPackageContainerDefinition))
-> (NonEmpty ModelPackageContainerDefinition
    -> f (NonEmpty ModelPackageContainerDefinition))
-> InferenceSpecification
-> f InferenceSpecification
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty ModelPackageContainerDefinition
 -> f (NonEmpty ModelPackageContainerDefinition))
-> NonEmpty ModelPackageContainerDefinition
-> f (NonEmpty ModelPackageContainerDefinition)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The supported MIME types for the input data.
inferenceSpecification_supportedContentTypes :: Lens.Lens' InferenceSpecification [Prelude.Text]
inferenceSpecification_supportedContentTypes :: ([Text] -> f [Text])
-> InferenceSpecification -> f InferenceSpecification
inferenceSpecification_supportedContentTypes = (InferenceSpecification -> [Text])
-> (InferenceSpecification -> [Text] -> InferenceSpecification)
-> Lens InferenceSpecification InferenceSpecification [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InferenceSpecification' {[Text]
supportedContentTypes :: [Text]
$sel:supportedContentTypes:InferenceSpecification' :: InferenceSpecification -> [Text]
supportedContentTypes} -> [Text]
supportedContentTypes) (\s :: InferenceSpecification
s@InferenceSpecification' {} [Text]
a -> InferenceSpecification
s {$sel:supportedContentTypes:InferenceSpecification' :: [Text]
supportedContentTypes = [Text]
a} :: InferenceSpecification) (([Text] -> f [Text])
 -> InferenceSpecification -> f InferenceSpecification)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> InferenceSpecification
-> f InferenceSpecification
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The supported MIME types for the output data.
inferenceSpecification_supportedResponseMIMETypes :: Lens.Lens' InferenceSpecification [Prelude.Text]
inferenceSpecification_supportedResponseMIMETypes :: ([Text] -> f [Text])
-> InferenceSpecification -> f InferenceSpecification
inferenceSpecification_supportedResponseMIMETypes = (InferenceSpecification -> [Text])
-> (InferenceSpecification -> [Text] -> InferenceSpecification)
-> Lens InferenceSpecification InferenceSpecification [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InferenceSpecification' {[Text]
supportedResponseMIMETypes :: [Text]
$sel:supportedResponseMIMETypes:InferenceSpecification' :: InferenceSpecification -> [Text]
supportedResponseMIMETypes} -> [Text]
supportedResponseMIMETypes) (\s :: InferenceSpecification
s@InferenceSpecification' {} [Text]
a -> InferenceSpecification
s {$sel:supportedResponseMIMETypes:InferenceSpecification' :: [Text]
supportedResponseMIMETypes = [Text]
a} :: InferenceSpecification) (([Text] -> f [Text])
 -> InferenceSpecification -> f InferenceSpecification)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> InferenceSpecification
-> f InferenceSpecification
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON InferenceSpecification where
  parseJSON :: Value -> Parser InferenceSpecification
parseJSON =
    String
-> (Object -> Parser InferenceSpecification)
-> Value
-> Parser InferenceSpecification
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"InferenceSpecification"
      ( \Object
x ->
          Maybe [ProductionVariantInstanceType]
-> Maybe (NonEmpty TransformInstanceType)
-> NonEmpty ModelPackageContainerDefinition
-> [Text]
-> [Text]
-> InferenceSpecification
InferenceSpecification'
            (Maybe [ProductionVariantInstanceType]
 -> Maybe (NonEmpty TransformInstanceType)
 -> NonEmpty ModelPackageContainerDefinition
 -> [Text]
 -> [Text]
 -> InferenceSpecification)
-> Parser (Maybe [ProductionVariantInstanceType])
-> Parser
     (Maybe (NonEmpty TransformInstanceType)
      -> NonEmpty ModelPackageContainerDefinition
      -> [Text]
      -> [Text]
      -> InferenceSpecification)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text -> Parser (Maybe (Maybe [ProductionVariantInstanceType]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SupportedRealtimeInferenceInstanceTypes"
                            Parser (Maybe (Maybe [ProductionVariantInstanceType]))
-> Maybe [ProductionVariantInstanceType]
-> Parser (Maybe [ProductionVariantInstanceType])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ProductionVariantInstanceType]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe (NonEmpty TransformInstanceType)
   -> NonEmpty ModelPackageContainerDefinition
   -> [Text]
   -> [Text]
   -> InferenceSpecification)
-> Parser (Maybe (NonEmpty TransformInstanceType))
-> Parser
     (NonEmpty ModelPackageContainerDefinition
      -> [Text] -> [Text] -> InferenceSpecification)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (NonEmpty TransformInstanceType))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SupportedTransformInstanceTypes")
            Parser
  (NonEmpty ModelPackageContainerDefinition
   -> [Text] -> [Text] -> InferenceSpecification)
-> Parser (NonEmpty ModelPackageContainerDefinition)
-> Parser ([Text] -> [Text] -> InferenceSpecification)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (NonEmpty ModelPackageContainerDefinition)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Containers")
            Parser ([Text] -> [Text] -> InferenceSpecification)
-> Parser [Text] -> Parser ([Text] -> InferenceSpecification)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SupportedContentTypes"
                            Parser (Maybe [Text]) -> [Text] -> Parser [Text]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser ([Text] -> InferenceSpecification)
-> Parser [Text] -> Parser InferenceSpecification
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SupportedResponseMIMETypes"
                            Parser (Maybe [Text]) -> [Text] -> Parser [Text]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable InferenceSpecification

instance Prelude.NFData InferenceSpecification

instance Core.ToJSON InferenceSpecification where
  toJSON :: InferenceSpecification -> Value
toJSON InferenceSpecification' {[Text]
Maybe [ProductionVariantInstanceType]
Maybe (NonEmpty TransformInstanceType)
NonEmpty ModelPackageContainerDefinition
supportedResponseMIMETypes :: [Text]
supportedContentTypes :: [Text]
containers :: NonEmpty ModelPackageContainerDefinition
supportedTransformInstanceTypes :: Maybe (NonEmpty TransformInstanceType)
supportedRealtimeInferenceInstanceTypes :: Maybe [ProductionVariantInstanceType]
$sel:supportedResponseMIMETypes:InferenceSpecification' :: InferenceSpecification -> [Text]
$sel:supportedContentTypes:InferenceSpecification' :: InferenceSpecification -> [Text]
$sel:containers:InferenceSpecification' :: InferenceSpecification -> NonEmpty ModelPackageContainerDefinition
$sel:supportedTransformInstanceTypes:InferenceSpecification' :: InferenceSpecification -> Maybe (NonEmpty TransformInstanceType)
$sel:supportedRealtimeInferenceInstanceTypes:InferenceSpecification' :: InferenceSpecification -> Maybe [ProductionVariantInstanceType]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"SupportedRealtimeInferenceInstanceTypes" Text -> [ProductionVariantInstanceType] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([ProductionVariantInstanceType] -> Pair)
-> Maybe [ProductionVariantInstanceType] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ProductionVariantInstanceType]
supportedRealtimeInferenceInstanceTypes,
            (Text
"SupportedTransformInstanceTypes" Text -> NonEmpty TransformInstanceType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty TransformInstanceType -> Pair)
-> Maybe (NonEmpty TransformInstanceType) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty TransformInstanceType)
supportedTransformInstanceTypes,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Containers" Text -> NonEmpty ModelPackageContainerDefinition -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty ModelPackageContainerDefinition
containers),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"SupportedContentTypes"
                  Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
supportedContentTypes
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"SupportedResponseMIMETypes"
                  Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
supportedResponseMIMETypes
              )
          ]
      )