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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.DeployedImage

-- | Describes weight and capacities for a production variant associated with
-- an endpoint. If you sent a request to the
-- @UpdateEndpointWeightsAndCapacities@ API and the endpoint status is
-- @Updating@, you get different desired and current values.
--
-- /See:/ 'newProductionVariantSummary' smart constructor.
data ProductionVariantSummary = ProductionVariantSummary'
  { -- | The number of instances requested in the
    -- @UpdateEndpointWeightsAndCapacities@ request.
    ProductionVariantSummary -> Maybe Natural
desiredInstanceCount :: Prelude.Maybe Prelude.Natural,
    -- | The requested weight, as specified in the
    -- @UpdateEndpointWeightsAndCapacities@ request.
    ProductionVariantSummary -> Maybe Double
desiredWeight :: Prelude.Maybe Prelude.Double,
    -- | The weight associated with the variant.
    ProductionVariantSummary -> Maybe Double
currentWeight :: Prelude.Maybe Prelude.Double,
    -- | The number of instances associated with the variant.
    ProductionVariantSummary -> Maybe Natural
currentInstanceCount :: Prelude.Maybe Prelude.Natural,
    -- | An array of @DeployedImage@ objects that specify the Amazon EC2
    -- Container Registry paths of the inference images deployed on instances
    -- of this @ProductionVariant@.
    ProductionVariantSummary -> Maybe [DeployedImage]
deployedImages :: Prelude.Maybe [DeployedImage],
    -- | The name of the variant.
    ProductionVariantSummary -> Text
variantName :: Prelude.Text
  }
  deriving (ProductionVariantSummary -> ProductionVariantSummary -> Bool
(ProductionVariantSummary -> ProductionVariantSummary -> Bool)
-> (ProductionVariantSummary -> ProductionVariantSummary -> Bool)
-> Eq ProductionVariantSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProductionVariantSummary -> ProductionVariantSummary -> Bool
$c/= :: ProductionVariantSummary -> ProductionVariantSummary -> Bool
== :: ProductionVariantSummary -> ProductionVariantSummary -> Bool
$c== :: ProductionVariantSummary -> ProductionVariantSummary -> Bool
Prelude.Eq, ReadPrec [ProductionVariantSummary]
ReadPrec ProductionVariantSummary
Int -> ReadS ProductionVariantSummary
ReadS [ProductionVariantSummary]
(Int -> ReadS ProductionVariantSummary)
-> ReadS [ProductionVariantSummary]
-> ReadPrec ProductionVariantSummary
-> ReadPrec [ProductionVariantSummary]
-> Read ProductionVariantSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProductionVariantSummary]
$creadListPrec :: ReadPrec [ProductionVariantSummary]
readPrec :: ReadPrec ProductionVariantSummary
$creadPrec :: ReadPrec ProductionVariantSummary
readList :: ReadS [ProductionVariantSummary]
$creadList :: ReadS [ProductionVariantSummary]
readsPrec :: Int -> ReadS ProductionVariantSummary
$creadsPrec :: Int -> ReadS ProductionVariantSummary
Prelude.Read, Int -> ProductionVariantSummary -> ShowS
[ProductionVariantSummary] -> ShowS
ProductionVariantSummary -> String
(Int -> ProductionVariantSummary -> ShowS)
-> (ProductionVariantSummary -> String)
-> ([ProductionVariantSummary] -> ShowS)
-> Show ProductionVariantSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProductionVariantSummary] -> ShowS
$cshowList :: [ProductionVariantSummary] -> ShowS
show :: ProductionVariantSummary -> String
$cshow :: ProductionVariantSummary -> String
showsPrec :: Int -> ProductionVariantSummary -> ShowS
$cshowsPrec :: Int -> ProductionVariantSummary -> ShowS
Prelude.Show, (forall x.
 ProductionVariantSummary -> Rep ProductionVariantSummary x)
-> (forall x.
    Rep ProductionVariantSummary x -> ProductionVariantSummary)
-> Generic ProductionVariantSummary
forall x.
Rep ProductionVariantSummary x -> ProductionVariantSummary
forall x.
ProductionVariantSummary -> Rep ProductionVariantSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ProductionVariantSummary x -> ProductionVariantSummary
$cfrom :: forall x.
ProductionVariantSummary -> Rep ProductionVariantSummary x
Prelude.Generic)

-- |
-- Create a value of 'ProductionVariantSummary' 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:
--
-- 'desiredInstanceCount', 'productionVariantSummary_desiredInstanceCount' - The number of instances requested in the
-- @UpdateEndpointWeightsAndCapacities@ request.
--
-- 'desiredWeight', 'productionVariantSummary_desiredWeight' - The requested weight, as specified in the
-- @UpdateEndpointWeightsAndCapacities@ request.
--
-- 'currentWeight', 'productionVariantSummary_currentWeight' - The weight associated with the variant.
--
-- 'currentInstanceCount', 'productionVariantSummary_currentInstanceCount' - The number of instances associated with the variant.
--
-- 'deployedImages', 'productionVariantSummary_deployedImages' - An array of @DeployedImage@ objects that specify the Amazon EC2
-- Container Registry paths of the inference images deployed on instances
-- of this @ProductionVariant@.
--
-- 'variantName', 'productionVariantSummary_variantName' - The name of the variant.
newProductionVariantSummary ::
  -- | 'variantName'
  Prelude.Text ->
  ProductionVariantSummary
newProductionVariantSummary :: Text -> ProductionVariantSummary
newProductionVariantSummary Text
pVariantName_ =
  ProductionVariantSummary' :: Maybe Natural
-> Maybe Double
-> Maybe Double
-> Maybe Natural
-> Maybe [DeployedImage]
-> Text
-> ProductionVariantSummary
ProductionVariantSummary'
    { $sel:desiredInstanceCount:ProductionVariantSummary' :: Maybe Natural
desiredInstanceCount =
        Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:desiredWeight:ProductionVariantSummary' :: Maybe Double
desiredWeight = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:currentWeight:ProductionVariantSummary' :: Maybe Double
currentWeight = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:currentInstanceCount:ProductionVariantSummary' :: Maybe Natural
currentInstanceCount = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:deployedImages:ProductionVariantSummary' :: Maybe [DeployedImage]
deployedImages = Maybe [DeployedImage]
forall a. Maybe a
Prelude.Nothing,
      $sel:variantName:ProductionVariantSummary' :: Text
variantName = Text
pVariantName_
    }

-- | The number of instances requested in the
-- @UpdateEndpointWeightsAndCapacities@ request.
productionVariantSummary_desiredInstanceCount :: Lens.Lens' ProductionVariantSummary (Prelude.Maybe Prelude.Natural)
productionVariantSummary_desiredInstanceCount :: (Maybe Natural -> f (Maybe Natural))
-> ProductionVariantSummary -> f ProductionVariantSummary
productionVariantSummary_desiredInstanceCount = (ProductionVariantSummary -> Maybe Natural)
-> (ProductionVariantSummary
    -> Maybe Natural -> ProductionVariantSummary)
-> Lens
     ProductionVariantSummary
     ProductionVariantSummary
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductionVariantSummary' {Maybe Natural
desiredInstanceCount :: Maybe Natural
$sel:desiredInstanceCount:ProductionVariantSummary' :: ProductionVariantSummary -> Maybe Natural
desiredInstanceCount} -> Maybe Natural
desiredInstanceCount) (\s :: ProductionVariantSummary
s@ProductionVariantSummary' {} Maybe Natural
a -> ProductionVariantSummary
s {$sel:desiredInstanceCount:ProductionVariantSummary' :: Maybe Natural
desiredInstanceCount = Maybe Natural
a} :: ProductionVariantSummary)

-- | The requested weight, as specified in the
-- @UpdateEndpointWeightsAndCapacities@ request.
productionVariantSummary_desiredWeight :: Lens.Lens' ProductionVariantSummary (Prelude.Maybe Prelude.Double)
productionVariantSummary_desiredWeight :: (Maybe Double -> f (Maybe Double))
-> ProductionVariantSummary -> f ProductionVariantSummary
productionVariantSummary_desiredWeight = (ProductionVariantSummary -> Maybe Double)
-> (ProductionVariantSummary
    -> Maybe Double -> ProductionVariantSummary)
-> Lens
     ProductionVariantSummary
     ProductionVariantSummary
     (Maybe Double)
     (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductionVariantSummary' {Maybe Double
desiredWeight :: Maybe Double
$sel:desiredWeight:ProductionVariantSummary' :: ProductionVariantSummary -> Maybe Double
desiredWeight} -> Maybe Double
desiredWeight) (\s :: ProductionVariantSummary
s@ProductionVariantSummary' {} Maybe Double
a -> ProductionVariantSummary
s {$sel:desiredWeight:ProductionVariantSummary' :: Maybe Double
desiredWeight = Maybe Double
a} :: ProductionVariantSummary)

-- | The weight associated with the variant.
productionVariantSummary_currentWeight :: Lens.Lens' ProductionVariantSummary (Prelude.Maybe Prelude.Double)
productionVariantSummary_currentWeight :: (Maybe Double -> f (Maybe Double))
-> ProductionVariantSummary -> f ProductionVariantSummary
productionVariantSummary_currentWeight = (ProductionVariantSummary -> Maybe Double)
-> (ProductionVariantSummary
    -> Maybe Double -> ProductionVariantSummary)
-> Lens
     ProductionVariantSummary
     ProductionVariantSummary
     (Maybe Double)
     (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductionVariantSummary' {Maybe Double
currentWeight :: Maybe Double
$sel:currentWeight:ProductionVariantSummary' :: ProductionVariantSummary -> Maybe Double
currentWeight} -> Maybe Double
currentWeight) (\s :: ProductionVariantSummary
s@ProductionVariantSummary' {} Maybe Double
a -> ProductionVariantSummary
s {$sel:currentWeight:ProductionVariantSummary' :: Maybe Double
currentWeight = Maybe Double
a} :: ProductionVariantSummary)

-- | The number of instances associated with the variant.
productionVariantSummary_currentInstanceCount :: Lens.Lens' ProductionVariantSummary (Prelude.Maybe Prelude.Natural)
productionVariantSummary_currentInstanceCount :: (Maybe Natural -> f (Maybe Natural))
-> ProductionVariantSummary -> f ProductionVariantSummary
productionVariantSummary_currentInstanceCount = (ProductionVariantSummary -> Maybe Natural)
-> (ProductionVariantSummary
    -> Maybe Natural -> ProductionVariantSummary)
-> Lens
     ProductionVariantSummary
     ProductionVariantSummary
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductionVariantSummary' {Maybe Natural
currentInstanceCount :: Maybe Natural
$sel:currentInstanceCount:ProductionVariantSummary' :: ProductionVariantSummary -> Maybe Natural
currentInstanceCount} -> Maybe Natural
currentInstanceCount) (\s :: ProductionVariantSummary
s@ProductionVariantSummary' {} Maybe Natural
a -> ProductionVariantSummary
s {$sel:currentInstanceCount:ProductionVariantSummary' :: Maybe Natural
currentInstanceCount = Maybe Natural
a} :: ProductionVariantSummary)

-- | An array of @DeployedImage@ objects that specify the Amazon EC2
-- Container Registry paths of the inference images deployed on instances
-- of this @ProductionVariant@.
productionVariantSummary_deployedImages :: Lens.Lens' ProductionVariantSummary (Prelude.Maybe [DeployedImage])
productionVariantSummary_deployedImages :: (Maybe [DeployedImage] -> f (Maybe [DeployedImage]))
-> ProductionVariantSummary -> f ProductionVariantSummary
productionVariantSummary_deployedImages = (ProductionVariantSummary -> Maybe [DeployedImage])
-> (ProductionVariantSummary
    -> Maybe [DeployedImage] -> ProductionVariantSummary)
-> Lens
     ProductionVariantSummary
     ProductionVariantSummary
     (Maybe [DeployedImage])
     (Maybe [DeployedImage])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductionVariantSummary' {Maybe [DeployedImage]
deployedImages :: Maybe [DeployedImage]
$sel:deployedImages:ProductionVariantSummary' :: ProductionVariantSummary -> Maybe [DeployedImage]
deployedImages} -> Maybe [DeployedImage]
deployedImages) (\s :: ProductionVariantSummary
s@ProductionVariantSummary' {} Maybe [DeployedImage]
a -> ProductionVariantSummary
s {$sel:deployedImages:ProductionVariantSummary' :: Maybe [DeployedImage]
deployedImages = Maybe [DeployedImage]
a} :: ProductionVariantSummary) ((Maybe [DeployedImage] -> f (Maybe [DeployedImage]))
 -> ProductionVariantSummary -> f ProductionVariantSummary)
-> ((Maybe [DeployedImage] -> f (Maybe [DeployedImage]))
    -> Maybe [DeployedImage] -> f (Maybe [DeployedImage]))
-> (Maybe [DeployedImage] -> f (Maybe [DeployedImage]))
-> ProductionVariantSummary
-> f ProductionVariantSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [DeployedImage] [DeployedImage] [DeployedImage] [DeployedImage]
-> Iso
     (Maybe [DeployedImage])
     (Maybe [DeployedImage])
     (Maybe [DeployedImage])
     (Maybe [DeployedImage])
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
  [DeployedImage] [DeployedImage] [DeployedImage] [DeployedImage]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the variant.
productionVariantSummary_variantName :: Lens.Lens' ProductionVariantSummary Prelude.Text
productionVariantSummary_variantName :: (Text -> f Text)
-> ProductionVariantSummary -> f ProductionVariantSummary
productionVariantSummary_variantName = (ProductionVariantSummary -> Text)
-> (ProductionVariantSummary -> Text -> ProductionVariantSummary)
-> Lens ProductionVariantSummary ProductionVariantSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductionVariantSummary' {Text
variantName :: Text
$sel:variantName:ProductionVariantSummary' :: ProductionVariantSummary -> Text
variantName} -> Text
variantName) (\s :: ProductionVariantSummary
s@ProductionVariantSummary' {} Text
a -> ProductionVariantSummary
s {$sel:variantName:ProductionVariantSummary' :: Text
variantName = Text
a} :: ProductionVariantSummary)

instance Core.FromJSON ProductionVariantSummary where
  parseJSON :: Value -> Parser ProductionVariantSummary
parseJSON =
    String
-> (Object -> Parser ProductionVariantSummary)
-> Value
-> Parser ProductionVariantSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ProductionVariantSummary"
      ( \Object
x ->
          Maybe Natural
-> Maybe Double
-> Maybe Double
-> Maybe Natural
-> Maybe [DeployedImage]
-> Text
-> ProductionVariantSummary
ProductionVariantSummary'
            (Maybe Natural
 -> Maybe Double
 -> Maybe Double
 -> Maybe Natural
 -> Maybe [DeployedImage]
 -> Text
 -> ProductionVariantSummary)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Double
      -> Maybe Double
      -> Maybe Natural
      -> Maybe [DeployedImage]
      -> Text
      -> ProductionVariantSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DesiredInstanceCount")
            Parser
  (Maybe Double
   -> Maybe Double
   -> Maybe Natural
   -> Maybe [DeployedImage]
   -> Text
   -> ProductionVariantSummary)
-> Parser (Maybe Double)
-> Parser
     (Maybe Double
      -> Maybe Natural
      -> Maybe [DeployedImage]
      -> Text
      -> ProductionVariantSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DesiredWeight")
            Parser
  (Maybe Double
   -> Maybe Natural
   -> Maybe [DeployedImage]
   -> Text
   -> ProductionVariantSummary)
-> Parser (Maybe Double)
-> Parser
     (Maybe Natural
      -> Maybe [DeployedImage] -> Text -> ProductionVariantSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CurrentWeight")
            Parser
  (Maybe Natural
   -> Maybe [DeployedImage] -> Text -> ProductionVariantSummary)
-> Parser (Maybe Natural)
-> Parser
     (Maybe [DeployedImage] -> Text -> ProductionVariantSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CurrentInstanceCount")
            Parser (Maybe [DeployedImage] -> Text -> ProductionVariantSummary)
-> Parser (Maybe [DeployedImage])
-> Parser (Text -> ProductionVariantSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [DeployedImage]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DeployedImages" Parser (Maybe (Maybe [DeployedImage]))
-> Maybe [DeployedImage] -> Parser (Maybe [DeployedImage])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [DeployedImage]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Text -> ProductionVariantSummary)
-> Parser Text -> Parser ProductionVariantSummary
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
"VariantName")
      )

instance Prelude.Hashable ProductionVariantSummary

instance Prelude.NFData ProductionVariantSummary