{-# 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.EdgeDeploymentStatus
-- 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.EdgeDeploymentStatus 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.StageStatus

-- | Contains information summarizing the deployment stage results.
--
-- /See:/ 'newEdgeDeploymentStatus' smart constructor.
data EdgeDeploymentStatus = EdgeDeploymentStatus'
  { -- | The time when the deployment API started.
    EdgeDeploymentStatus -> Maybe POSIX
edgeDeploymentStageStartTime :: Prelude.Maybe Data.POSIX,
    -- | A detailed message about deployment status in current stage.
    EdgeDeploymentStatus -> Maybe Text
edgeDeploymentStatusMessage :: Prelude.Maybe Prelude.Text,
    -- | The general status of the current stage.
    EdgeDeploymentStatus -> StageStatus
stageStatus :: StageStatus,
    -- | The number of edge devices with the successful deployment in the current
    -- stage.
    EdgeDeploymentStatus -> Int
edgeDeploymentSuccessInStage :: Prelude.Int,
    -- | The number of edge devices yet to pick up the deployment in current
    -- stage, or in progress.
    EdgeDeploymentStatus -> Int
edgeDeploymentPendingInStage :: Prelude.Int,
    -- | The number of edge devices that failed the deployment in current stage.
    EdgeDeploymentStatus -> Int
edgeDeploymentFailedInStage :: Prelude.Int
  }
  deriving (EdgeDeploymentStatus -> EdgeDeploymentStatus -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EdgeDeploymentStatus -> EdgeDeploymentStatus -> Bool
$c/= :: EdgeDeploymentStatus -> EdgeDeploymentStatus -> Bool
== :: EdgeDeploymentStatus -> EdgeDeploymentStatus -> Bool
$c== :: EdgeDeploymentStatus -> EdgeDeploymentStatus -> Bool
Prelude.Eq, ReadPrec [EdgeDeploymentStatus]
ReadPrec EdgeDeploymentStatus
Int -> ReadS EdgeDeploymentStatus
ReadS [EdgeDeploymentStatus]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EdgeDeploymentStatus]
$creadListPrec :: ReadPrec [EdgeDeploymentStatus]
readPrec :: ReadPrec EdgeDeploymentStatus
$creadPrec :: ReadPrec EdgeDeploymentStatus
readList :: ReadS [EdgeDeploymentStatus]
$creadList :: ReadS [EdgeDeploymentStatus]
readsPrec :: Int -> ReadS EdgeDeploymentStatus
$creadsPrec :: Int -> ReadS EdgeDeploymentStatus
Prelude.Read, Int -> EdgeDeploymentStatus -> ShowS
[EdgeDeploymentStatus] -> ShowS
EdgeDeploymentStatus -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EdgeDeploymentStatus] -> ShowS
$cshowList :: [EdgeDeploymentStatus] -> ShowS
show :: EdgeDeploymentStatus -> String
$cshow :: EdgeDeploymentStatus -> String
showsPrec :: Int -> EdgeDeploymentStatus -> ShowS
$cshowsPrec :: Int -> EdgeDeploymentStatus -> ShowS
Prelude.Show, forall x. Rep EdgeDeploymentStatus x -> EdgeDeploymentStatus
forall x. EdgeDeploymentStatus -> Rep EdgeDeploymentStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EdgeDeploymentStatus x -> EdgeDeploymentStatus
$cfrom :: forall x. EdgeDeploymentStatus -> Rep EdgeDeploymentStatus x
Prelude.Generic)

-- |
-- Create a value of 'EdgeDeploymentStatus' 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:
--
-- 'edgeDeploymentStageStartTime', 'edgeDeploymentStatus_edgeDeploymentStageStartTime' - The time when the deployment API started.
--
-- 'edgeDeploymentStatusMessage', 'edgeDeploymentStatus_edgeDeploymentStatusMessage' - A detailed message about deployment status in current stage.
--
-- 'stageStatus', 'edgeDeploymentStatus_stageStatus' - The general status of the current stage.
--
-- 'edgeDeploymentSuccessInStage', 'edgeDeploymentStatus_edgeDeploymentSuccessInStage' - The number of edge devices with the successful deployment in the current
-- stage.
--
-- 'edgeDeploymentPendingInStage', 'edgeDeploymentStatus_edgeDeploymentPendingInStage' - The number of edge devices yet to pick up the deployment in current
-- stage, or in progress.
--
-- 'edgeDeploymentFailedInStage', 'edgeDeploymentStatus_edgeDeploymentFailedInStage' - The number of edge devices that failed the deployment in current stage.
newEdgeDeploymentStatus ::
  -- | 'stageStatus'
  StageStatus ->
  -- | 'edgeDeploymentSuccessInStage'
  Prelude.Int ->
  -- | 'edgeDeploymentPendingInStage'
  Prelude.Int ->
  -- | 'edgeDeploymentFailedInStage'
  Prelude.Int ->
  EdgeDeploymentStatus
newEdgeDeploymentStatus :: StageStatus -> Int -> Int -> Int -> EdgeDeploymentStatus
newEdgeDeploymentStatus
  StageStatus
pStageStatus_
  Int
pEdgeDeploymentSuccessInStage_
  Int
pEdgeDeploymentPendingInStage_
  Int
pEdgeDeploymentFailedInStage_ =
    EdgeDeploymentStatus'
      { $sel:edgeDeploymentStageStartTime:EdgeDeploymentStatus' :: Maybe POSIX
edgeDeploymentStageStartTime =
          forall a. Maybe a
Prelude.Nothing,
        $sel:edgeDeploymentStatusMessage:EdgeDeploymentStatus' :: Maybe Text
edgeDeploymentStatusMessage = forall a. Maybe a
Prelude.Nothing,
        $sel:stageStatus:EdgeDeploymentStatus' :: StageStatus
stageStatus = StageStatus
pStageStatus_,
        $sel:edgeDeploymentSuccessInStage:EdgeDeploymentStatus' :: Int
edgeDeploymentSuccessInStage =
          Int
pEdgeDeploymentSuccessInStage_,
        $sel:edgeDeploymentPendingInStage:EdgeDeploymentStatus' :: Int
edgeDeploymentPendingInStage =
          Int
pEdgeDeploymentPendingInStage_,
        $sel:edgeDeploymentFailedInStage:EdgeDeploymentStatus' :: Int
edgeDeploymentFailedInStage =
          Int
pEdgeDeploymentFailedInStage_
      }

-- | The time when the deployment API started.
edgeDeploymentStatus_edgeDeploymentStageStartTime :: Lens.Lens' EdgeDeploymentStatus (Prelude.Maybe Prelude.UTCTime)
edgeDeploymentStatus_edgeDeploymentStageStartTime :: Lens' EdgeDeploymentStatus (Maybe UTCTime)
edgeDeploymentStatus_edgeDeploymentStageStartTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EdgeDeploymentStatus' {Maybe POSIX
edgeDeploymentStageStartTime :: Maybe POSIX
$sel:edgeDeploymentStageStartTime:EdgeDeploymentStatus' :: EdgeDeploymentStatus -> Maybe POSIX
edgeDeploymentStageStartTime} -> Maybe POSIX
edgeDeploymentStageStartTime) (\s :: EdgeDeploymentStatus
s@EdgeDeploymentStatus' {} Maybe POSIX
a -> EdgeDeploymentStatus
s {$sel:edgeDeploymentStageStartTime:EdgeDeploymentStatus' :: Maybe POSIX
edgeDeploymentStageStartTime = Maybe POSIX
a} :: EdgeDeploymentStatus) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | A detailed message about deployment status in current stage.
edgeDeploymentStatus_edgeDeploymentStatusMessage :: Lens.Lens' EdgeDeploymentStatus (Prelude.Maybe Prelude.Text)
edgeDeploymentStatus_edgeDeploymentStatusMessage :: Lens' EdgeDeploymentStatus (Maybe Text)
edgeDeploymentStatus_edgeDeploymentStatusMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EdgeDeploymentStatus' {Maybe Text
edgeDeploymentStatusMessage :: Maybe Text
$sel:edgeDeploymentStatusMessage:EdgeDeploymentStatus' :: EdgeDeploymentStatus -> Maybe Text
edgeDeploymentStatusMessage} -> Maybe Text
edgeDeploymentStatusMessage) (\s :: EdgeDeploymentStatus
s@EdgeDeploymentStatus' {} Maybe Text
a -> EdgeDeploymentStatus
s {$sel:edgeDeploymentStatusMessage:EdgeDeploymentStatus' :: Maybe Text
edgeDeploymentStatusMessage = Maybe Text
a} :: EdgeDeploymentStatus)

-- | The general status of the current stage.
edgeDeploymentStatus_stageStatus :: Lens.Lens' EdgeDeploymentStatus StageStatus
edgeDeploymentStatus_stageStatus :: Lens' EdgeDeploymentStatus StageStatus
edgeDeploymentStatus_stageStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EdgeDeploymentStatus' {StageStatus
stageStatus :: StageStatus
$sel:stageStatus:EdgeDeploymentStatus' :: EdgeDeploymentStatus -> StageStatus
stageStatus} -> StageStatus
stageStatus) (\s :: EdgeDeploymentStatus
s@EdgeDeploymentStatus' {} StageStatus
a -> EdgeDeploymentStatus
s {$sel:stageStatus:EdgeDeploymentStatus' :: StageStatus
stageStatus = StageStatus
a} :: EdgeDeploymentStatus)

-- | The number of edge devices with the successful deployment in the current
-- stage.
edgeDeploymentStatus_edgeDeploymentSuccessInStage :: Lens.Lens' EdgeDeploymentStatus Prelude.Int
edgeDeploymentStatus_edgeDeploymentSuccessInStage :: Lens' EdgeDeploymentStatus Int
edgeDeploymentStatus_edgeDeploymentSuccessInStage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EdgeDeploymentStatus' {Int
edgeDeploymentSuccessInStage :: Int
$sel:edgeDeploymentSuccessInStage:EdgeDeploymentStatus' :: EdgeDeploymentStatus -> Int
edgeDeploymentSuccessInStage} -> Int
edgeDeploymentSuccessInStage) (\s :: EdgeDeploymentStatus
s@EdgeDeploymentStatus' {} Int
a -> EdgeDeploymentStatus
s {$sel:edgeDeploymentSuccessInStage:EdgeDeploymentStatus' :: Int
edgeDeploymentSuccessInStage = Int
a} :: EdgeDeploymentStatus)

-- | The number of edge devices yet to pick up the deployment in current
-- stage, or in progress.
edgeDeploymentStatus_edgeDeploymentPendingInStage :: Lens.Lens' EdgeDeploymentStatus Prelude.Int
edgeDeploymentStatus_edgeDeploymentPendingInStage :: Lens' EdgeDeploymentStatus Int
edgeDeploymentStatus_edgeDeploymentPendingInStage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EdgeDeploymentStatus' {Int
edgeDeploymentPendingInStage :: Int
$sel:edgeDeploymentPendingInStage:EdgeDeploymentStatus' :: EdgeDeploymentStatus -> Int
edgeDeploymentPendingInStage} -> Int
edgeDeploymentPendingInStage) (\s :: EdgeDeploymentStatus
s@EdgeDeploymentStatus' {} Int
a -> EdgeDeploymentStatus
s {$sel:edgeDeploymentPendingInStage:EdgeDeploymentStatus' :: Int
edgeDeploymentPendingInStage = Int
a} :: EdgeDeploymentStatus)

-- | The number of edge devices that failed the deployment in current stage.
edgeDeploymentStatus_edgeDeploymentFailedInStage :: Lens.Lens' EdgeDeploymentStatus Prelude.Int
edgeDeploymentStatus_edgeDeploymentFailedInStage :: Lens' EdgeDeploymentStatus Int
edgeDeploymentStatus_edgeDeploymentFailedInStage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EdgeDeploymentStatus' {Int
edgeDeploymentFailedInStage :: Int
$sel:edgeDeploymentFailedInStage:EdgeDeploymentStatus' :: EdgeDeploymentStatus -> Int
edgeDeploymentFailedInStage} -> Int
edgeDeploymentFailedInStage) (\s :: EdgeDeploymentStatus
s@EdgeDeploymentStatus' {} Int
a -> EdgeDeploymentStatus
s {$sel:edgeDeploymentFailedInStage:EdgeDeploymentStatus' :: Int
edgeDeploymentFailedInStage = Int
a} :: EdgeDeploymentStatus)

instance Data.FromJSON EdgeDeploymentStatus where
  parseJSON :: Value -> Parser EdgeDeploymentStatus
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EdgeDeploymentStatus"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> StageStatus
-> Int
-> Int
-> Int
-> EdgeDeploymentStatus
EdgeDeploymentStatus'
            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
"EdgeDeploymentStageStartTime")
            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
"EdgeDeploymentStatusMessage")
            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
"StageStatus")
            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
"EdgeDeploymentSuccessInStage")
            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
"EdgeDeploymentPendingInStage")
            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
"EdgeDeploymentFailedInStage")
      )

instance Prelude.Hashable EdgeDeploymentStatus where
  hashWithSalt :: Int -> EdgeDeploymentStatus -> Int
hashWithSalt Int
_salt EdgeDeploymentStatus' {Int
Maybe Text
Maybe POSIX
StageStatus
edgeDeploymentFailedInStage :: Int
edgeDeploymentPendingInStage :: Int
edgeDeploymentSuccessInStage :: Int
stageStatus :: StageStatus
edgeDeploymentStatusMessage :: Maybe Text
edgeDeploymentStageStartTime :: Maybe POSIX
$sel:edgeDeploymentFailedInStage:EdgeDeploymentStatus' :: EdgeDeploymentStatus -> Int
$sel:edgeDeploymentPendingInStage:EdgeDeploymentStatus' :: EdgeDeploymentStatus -> Int
$sel:edgeDeploymentSuccessInStage:EdgeDeploymentStatus' :: EdgeDeploymentStatus -> Int
$sel:stageStatus:EdgeDeploymentStatus' :: EdgeDeploymentStatus -> StageStatus
$sel:edgeDeploymentStatusMessage:EdgeDeploymentStatus' :: EdgeDeploymentStatus -> Maybe Text
$sel:edgeDeploymentStageStartTime:EdgeDeploymentStatus' :: EdgeDeploymentStatus -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
edgeDeploymentStageStartTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
edgeDeploymentStatusMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` StageStatus
stageStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
edgeDeploymentSuccessInStage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
edgeDeploymentPendingInStage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
edgeDeploymentFailedInStage

instance Prelude.NFData EdgeDeploymentStatus where
  rnf :: EdgeDeploymentStatus -> ()
rnf EdgeDeploymentStatus' {Int
Maybe Text
Maybe POSIX
StageStatus
edgeDeploymentFailedInStage :: Int
edgeDeploymentPendingInStage :: Int
edgeDeploymentSuccessInStage :: Int
stageStatus :: StageStatus
edgeDeploymentStatusMessage :: Maybe Text
edgeDeploymentStageStartTime :: Maybe POSIX
$sel:edgeDeploymentFailedInStage:EdgeDeploymentStatus' :: EdgeDeploymentStatus -> Int
$sel:edgeDeploymentPendingInStage:EdgeDeploymentStatus' :: EdgeDeploymentStatus -> Int
$sel:edgeDeploymentSuccessInStage:EdgeDeploymentStatus' :: EdgeDeploymentStatus -> Int
$sel:stageStatus:EdgeDeploymentStatus' :: EdgeDeploymentStatus -> StageStatus
$sel:edgeDeploymentStatusMessage:EdgeDeploymentStatus' :: EdgeDeploymentStatus -> Maybe Text
$sel:edgeDeploymentStageStartTime:EdgeDeploymentStatus' :: EdgeDeploymentStatus -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
edgeDeploymentStageStartTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
edgeDeploymentStatusMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf StageStatus
stageStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
edgeDeploymentSuccessInStage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
edgeDeploymentPendingInStage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
edgeDeploymentFailedInStage