{-# 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.ModelPackageStatusItem
-- 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.ModelPackageStatusItem 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.DetailedModelPackageStatus

-- | Represents the overall status of a model package.
--
-- /See:/ 'newModelPackageStatusItem' smart constructor.
data ModelPackageStatusItem = ModelPackageStatusItem'
  { -- | if the overall status is @Failed@, the reason for the failure.
    ModelPackageStatusItem -> Maybe Text
failureReason :: Prelude.Maybe Prelude.Text,
    -- | The name of the model package for which the overall status is being
    -- reported.
    ModelPackageStatusItem -> Text
name :: Prelude.Text,
    -- | The current status.
    ModelPackageStatusItem -> DetailedModelPackageStatus
status :: DetailedModelPackageStatus
  }
  deriving (ModelPackageStatusItem -> ModelPackageStatusItem -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModelPackageStatusItem -> ModelPackageStatusItem -> Bool
$c/= :: ModelPackageStatusItem -> ModelPackageStatusItem -> Bool
== :: ModelPackageStatusItem -> ModelPackageStatusItem -> Bool
$c== :: ModelPackageStatusItem -> ModelPackageStatusItem -> Bool
Prelude.Eq, ReadPrec [ModelPackageStatusItem]
ReadPrec ModelPackageStatusItem
Int -> ReadS ModelPackageStatusItem
ReadS [ModelPackageStatusItem]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModelPackageStatusItem]
$creadListPrec :: ReadPrec [ModelPackageStatusItem]
readPrec :: ReadPrec ModelPackageStatusItem
$creadPrec :: ReadPrec ModelPackageStatusItem
readList :: ReadS [ModelPackageStatusItem]
$creadList :: ReadS [ModelPackageStatusItem]
readsPrec :: Int -> ReadS ModelPackageStatusItem
$creadsPrec :: Int -> ReadS ModelPackageStatusItem
Prelude.Read, Int -> ModelPackageStatusItem -> ShowS
[ModelPackageStatusItem] -> ShowS
ModelPackageStatusItem -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModelPackageStatusItem] -> ShowS
$cshowList :: [ModelPackageStatusItem] -> ShowS
show :: ModelPackageStatusItem -> String
$cshow :: ModelPackageStatusItem -> String
showsPrec :: Int -> ModelPackageStatusItem -> ShowS
$cshowsPrec :: Int -> ModelPackageStatusItem -> ShowS
Prelude.Show, forall x. Rep ModelPackageStatusItem x -> ModelPackageStatusItem
forall x. ModelPackageStatusItem -> Rep ModelPackageStatusItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModelPackageStatusItem x -> ModelPackageStatusItem
$cfrom :: forall x. ModelPackageStatusItem -> Rep ModelPackageStatusItem x
Prelude.Generic)

-- |
-- Create a value of 'ModelPackageStatusItem' 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:
--
-- 'failureReason', 'modelPackageStatusItem_failureReason' - if the overall status is @Failed@, the reason for the failure.
--
-- 'name', 'modelPackageStatusItem_name' - The name of the model package for which the overall status is being
-- reported.
--
-- 'status', 'modelPackageStatusItem_status' - The current status.
newModelPackageStatusItem ::
  -- | 'name'
  Prelude.Text ->
  -- | 'status'
  DetailedModelPackageStatus ->
  ModelPackageStatusItem
newModelPackageStatusItem :: Text -> DetailedModelPackageStatus -> ModelPackageStatusItem
newModelPackageStatusItem Text
pName_ DetailedModelPackageStatus
pStatus_ =
  ModelPackageStatusItem'
    { $sel:failureReason:ModelPackageStatusItem' :: Maybe Text
failureReason =
        forall a. Maybe a
Prelude.Nothing,
      $sel:name:ModelPackageStatusItem' :: Text
name = Text
pName_,
      $sel:status:ModelPackageStatusItem' :: DetailedModelPackageStatus
status = DetailedModelPackageStatus
pStatus_
    }

-- | if the overall status is @Failed@, the reason for the failure.
modelPackageStatusItem_failureReason :: Lens.Lens' ModelPackageStatusItem (Prelude.Maybe Prelude.Text)
modelPackageStatusItem_failureReason :: Lens' ModelPackageStatusItem (Maybe Text)
modelPackageStatusItem_failureReason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelPackageStatusItem' {Maybe Text
failureReason :: Maybe Text
$sel:failureReason:ModelPackageStatusItem' :: ModelPackageStatusItem -> Maybe Text
failureReason} -> Maybe Text
failureReason) (\s :: ModelPackageStatusItem
s@ModelPackageStatusItem' {} Maybe Text
a -> ModelPackageStatusItem
s {$sel:failureReason:ModelPackageStatusItem' :: Maybe Text
failureReason = Maybe Text
a} :: ModelPackageStatusItem)

-- | The name of the model package for which the overall status is being
-- reported.
modelPackageStatusItem_name :: Lens.Lens' ModelPackageStatusItem Prelude.Text
modelPackageStatusItem_name :: Lens' ModelPackageStatusItem Text
modelPackageStatusItem_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelPackageStatusItem' {Text
name :: Text
$sel:name:ModelPackageStatusItem' :: ModelPackageStatusItem -> Text
name} -> Text
name) (\s :: ModelPackageStatusItem
s@ModelPackageStatusItem' {} Text
a -> ModelPackageStatusItem
s {$sel:name:ModelPackageStatusItem' :: Text
name = Text
a} :: ModelPackageStatusItem)

-- | The current status.
modelPackageStatusItem_status :: Lens.Lens' ModelPackageStatusItem DetailedModelPackageStatus
modelPackageStatusItem_status :: Lens' ModelPackageStatusItem DetailedModelPackageStatus
modelPackageStatusItem_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelPackageStatusItem' {DetailedModelPackageStatus
status :: DetailedModelPackageStatus
$sel:status:ModelPackageStatusItem' :: ModelPackageStatusItem -> DetailedModelPackageStatus
status} -> DetailedModelPackageStatus
status) (\s :: ModelPackageStatusItem
s@ModelPackageStatusItem' {} DetailedModelPackageStatus
a -> ModelPackageStatusItem
s {$sel:status:ModelPackageStatusItem' :: DetailedModelPackageStatus
status = DetailedModelPackageStatus
a} :: ModelPackageStatusItem)

instance Data.FromJSON ModelPackageStatusItem where
  parseJSON :: Value -> Parser ModelPackageStatusItem
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ModelPackageStatusItem"
      ( \Object
x ->
          Maybe Text
-> Text -> DetailedModelPackageStatus -> ModelPackageStatusItem
ModelPackageStatusItem'
            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
"FailureReason")
            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
"Name")
            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
"Status")
      )

instance Prelude.Hashable ModelPackageStatusItem where
  hashWithSalt :: Int -> ModelPackageStatusItem -> Int
hashWithSalt Int
_salt ModelPackageStatusItem' {Maybe Text
Text
DetailedModelPackageStatus
status :: DetailedModelPackageStatus
name :: Text
failureReason :: Maybe Text
$sel:status:ModelPackageStatusItem' :: ModelPackageStatusItem -> DetailedModelPackageStatus
$sel:name:ModelPackageStatusItem' :: ModelPackageStatusItem -> Text
$sel:failureReason:ModelPackageStatusItem' :: ModelPackageStatusItem -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
failureReason
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DetailedModelPackageStatus
status

instance Prelude.NFData ModelPackageStatusItem where
  rnf :: ModelPackageStatusItem -> ()
rnf ModelPackageStatusItem' {Maybe Text
Text
DetailedModelPackageStatus
status :: DetailedModelPackageStatus
name :: Text
failureReason :: Maybe Text
$sel:status:ModelPackageStatusItem' :: ModelPackageStatusItem -> DetailedModelPackageStatus
$sel:name:ModelPackageStatusItem' :: ModelPackageStatusItem -> Text
$sel:failureReason:ModelPackageStatusItem' :: ModelPackageStatusItem -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
failureReason
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf DetailedModelPackageStatus
status