{-# 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.RobOMaker.Types.ProgressDetail
-- 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.RobOMaker.Types.ProgressDetail where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.RobOMaker.Types.RobotDeploymentStep

-- | Information about the progress of a deployment job.
--
-- /See:/ 'newProgressDetail' smart constructor.
data ProgressDetail = ProgressDetail'
  { -- | The current progress status.
    --
    -- [Validating]
    --     Validating the deployment.
    --
    -- [DownloadingExtracting]
    --     Downloading and extracting the bundle on the robot.
    --
    -- [ExecutingPreLaunch]
    --     Executing pre-launch script(s) if provided.
    --
    -- [Launching]
    --     Launching the robot application.
    --
    -- [ExecutingPostLaunch]
    --     Executing post-launch script(s) if provided.
    --
    -- [Finished]
    --     Deployment is complete.
    ProgressDetail -> Maybe RobotDeploymentStep
currentProgress :: Prelude.Maybe RobotDeploymentStep,
    -- | Estimated amount of time in seconds remaining in the step. This
    -- currently only applies to the @Downloading\/Extracting@ step of the
    -- deployment. It is empty for other steps.
    ProgressDetail -> Maybe Int
estimatedTimeRemainingSeconds :: Prelude.Maybe Prelude.Int,
    -- | The Amazon Resource Name (ARN) of the deployment job.
    ProgressDetail -> Maybe Text
targetResource :: Prelude.Maybe Prelude.Text,
    -- | Precentage of the step that is done. This currently only applies to the
    -- @Downloading\/Extracting@ step of the deployment. It is empty for other
    -- steps.
    ProgressDetail -> Maybe Double
percentDone :: Prelude.Maybe Prelude.Double
  }
  deriving (ProgressDetail -> ProgressDetail -> Bool
(ProgressDetail -> ProgressDetail -> Bool)
-> (ProgressDetail -> ProgressDetail -> Bool) -> Eq ProgressDetail
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProgressDetail -> ProgressDetail -> Bool
$c/= :: ProgressDetail -> ProgressDetail -> Bool
== :: ProgressDetail -> ProgressDetail -> Bool
$c== :: ProgressDetail -> ProgressDetail -> Bool
Prelude.Eq, ReadPrec [ProgressDetail]
ReadPrec ProgressDetail
Int -> ReadS ProgressDetail
ReadS [ProgressDetail]
(Int -> ReadS ProgressDetail)
-> ReadS [ProgressDetail]
-> ReadPrec ProgressDetail
-> ReadPrec [ProgressDetail]
-> Read ProgressDetail
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProgressDetail]
$creadListPrec :: ReadPrec [ProgressDetail]
readPrec :: ReadPrec ProgressDetail
$creadPrec :: ReadPrec ProgressDetail
readList :: ReadS [ProgressDetail]
$creadList :: ReadS [ProgressDetail]
readsPrec :: Int -> ReadS ProgressDetail
$creadsPrec :: Int -> ReadS ProgressDetail
Prelude.Read, Int -> ProgressDetail -> ShowS
[ProgressDetail] -> ShowS
ProgressDetail -> String
(Int -> ProgressDetail -> ShowS)
-> (ProgressDetail -> String)
-> ([ProgressDetail] -> ShowS)
-> Show ProgressDetail
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProgressDetail] -> ShowS
$cshowList :: [ProgressDetail] -> ShowS
show :: ProgressDetail -> String
$cshow :: ProgressDetail -> String
showsPrec :: Int -> ProgressDetail -> ShowS
$cshowsPrec :: Int -> ProgressDetail -> ShowS
Prelude.Show, (forall x. ProgressDetail -> Rep ProgressDetail x)
-> (forall x. Rep ProgressDetail x -> ProgressDetail)
-> Generic ProgressDetail
forall x. Rep ProgressDetail x -> ProgressDetail
forall x. ProgressDetail -> Rep ProgressDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProgressDetail x -> ProgressDetail
$cfrom :: forall x. ProgressDetail -> Rep ProgressDetail x
Prelude.Generic)

-- |
-- Create a value of 'ProgressDetail' 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:
--
-- 'currentProgress', 'progressDetail_currentProgress' - The current progress status.
--
-- [Validating]
--     Validating the deployment.
--
-- [DownloadingExtracting]
--     Downloading and extracting the bundle on the robot.
--
-- [ExecutingPreLaunch]
--     Executing pre-launch script(s) if provided.
--
-- [Launching]
--     Launching the robot application.
--
-- [ExecutingPostLaunch]
--     Executing post-launch script(s) if provided.
--
-- [Finished]
--     Deployment is complete.
--
-- 'estimatedTimeRemainingSeconds', 'progressDetail_estimatedTimeRemainingSeconds' - Estimated amount of time in seconds remaining in the step. This
-- currently only applies to the @Downloading\/Extracting@ step of the
-- deployment. It is empty for other steps.
--
-- 'targetResource', 'progressDetail_targetResource' - The Amazon Resource Name (ARN) of the deployment job.
--
-- 'percentDone', 'progressDetail_percentDone' - Precentage of the step that is done. This currently only applies to the
-- @Downloading\/Extracting@ step of the deployment. It is empty for other
-- steps.
newProgressDetail ::
  ProgressDetail
newProgressDetail :: ProgressDetail
newProgressDetail =
  ProgressDetail' :: Maybe RobotDeploymentStep
-> Maybe Int -> Maybe Text -> Maybe Double -> ProgressDetail
ProgressDetail'
    { $sel:currentProgress:ProgressDetail' :: Maybe RobotDeploymentStep
currentProgress = Maybe RobotDeploymentStep
forall a. Maybe a
Prelude.Nothing,
      $sel:estimatedTimeRemainingSeconds:ProgressDetail' :: Maybe Int
estimatedTimeRemainingSeconds = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:targetResource:ProgressDetail' :: Maybe Text
targetResource = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:percentDone:ProgressDetail' :: Maybe Double
percentDone = Maybe Double
forall a. Maybe a
Prelude.Nothing
    }

-- | The current progress status.
--
-- [Validating]
--     Validating the deployment.
--
-- [DownloadingExtracting]
--     Downloading and extracting the bundle on the robot.
--
-- [ExecutingPreLaunch]
--     Executing pre-launch script(s) if provided.
--
-- [Launching]
--     Launching the robot application.
--
-- [ExecutingPostLaunch]
--     Executing post-launch script(s) if provided.
--
-- [Finished]
--     Deployment is complete.
progressDetail_currentProgress :: Lens.Lens' ProgressDetail (Prelude.Maybe RobotDeploymentStep)
progressDetail_currentProgress :: (Maybe RobotDeploymentStep -> f (Maybe RobotDeploymentStep))
-> ProgressDetail -> f ProgressDetail
progressDetail_currentProgress = (ProgressDetail -> Maybe RobotDeploymentStep)
-> (ProgressDetail -> Maybe RobotDeploymentStep -> ProgressDetail)
-> Lens
     ProgressDetail
     ProgressDetail
     (Maybe RobotDeploymentStep)
     (Maybe RobotDeploymentStep)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProgressDetail' {Maybe RobotDeploymentStep
currentProgress :: Maybe RobotDeploymentStep
$sel:currentProgress:ProgressDetail' :: ProgressDetail -> Maybe RobotDeploymentStep
currentProgress} -> Maybe RobotDeploymentStep
currentProgress) (\s :: ProgressDetail
s@ProgressDetail' {} Maybe RobotDeploymentStep
a -> ProgressDetail
s {$sel:currentProgress:ProgressDetail' :: Maybe RobotDeploymentStep
currentProgress = Maybe RobotDeploymentStep
a} :: ProgressDetail)

-- | Estimated amount of time in seconds remaining in the step. This
-- currently only applies to the @Downloading\/Extracting@ step of the
-- deployment. It is empty for other steps.
progressDetail_estimatedTimeRemainingSeconds :: Lens.Lens' ProgressDetail (Prelude.Maybe Prelude.Int)
progressDetail_estimatedTimeRemainingSeconds :: (Maybe Int -> f (Maybe Int)) -> ProgressDetail -> f ProgressDetail
progressDetail_estimatedTimeRemainingSeconds = (ProgressDetail -> Maybe Int)
-> (ProgressDetail -> Maybe Int -> ProgressDetail)
-> Lens ProgressDetail ProgressDetail (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProgressDetail' {Maybe Int
estimatedTimeRemainingSeconds :: Maybe Int
$sel:estimatedTimeRemainingSeconds:ProgressDetail' :: ProgressDetail -> Maybe Int
estimatedTimeRemainingSeconds} -> Maybe Int
estimatedTimeRemainingSeconds) (\s :: ProgressDetail
s@ProgressDetail' {} Maybe Int
a -> ProgressDetail
s {$sel:estimatedTimeRemainingSeconds:ProgressDetail' :: Maybe Int
estimatedTimeRemainingSeconds = Maybe Int
a} :: ProgressDetail)

-- | The Amazon Resource Name (ARN) of the deployment job.
progressDetail_targetResource :: Lens.Lens' ProgressDetail (Prelude.Maybe Prelude.Text)
progressDetail_targetResource :: (Maybe Text -> f (Maybe Text))
-> ProgressDetail -> f ProgressDetail
progressDetail_targetResource = (ProgressDetail -> Maybe Text)
-> (ProgressDetail -> Maybe Text -> ProgressDetail)
-> Lens ProgressDetail ProgressDetail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProgressDetail' {Maybe Text
targetResource :: Maybe Text
$sel:targetResource:ProgressDetail' :: ProgressDetail -> Maybe Text
targetResource} -> Maybe Text
targetResource) (\s :: ProgressDetail
s@ProgressDetail' {} Maybe Text
a -> ProgressDetail
s {$sel:targetResource:ProgressDetail' :: Maybe Text
targetResource = Maybe Text
a} :: ProgressDetail)

-- | Precentage of the step that is done. This currently only applies to the
-- @Downloading\/Extracting@ step of the deployment. It is empty for other
-- steps.
progressDetail_percentDone :: Lens.Lens' ProgressDetail (Prelude.Maybe Prelude.Double)
progressDetail_percentDone :: (Maybe Double -> f (Maybe Double))
-> ProgressDetail -> f ProgressDetail
progressDetail_percentDone = (ProgressDetail -> Maybe Double)
-> (ProgressDetail -> Maybe Double -> ProgressDetail)
-> Lens ProgressDetail ProgressDetail (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProgressDetail' {Maybe Double
percentDone :: Maybe Double
$sel:percentDone:ProgressDetail' :: ProgressDetail -> Maybe Double
percentDone} -> Maybe Double
percentDone) (\s :: ProgressDetail
s@ProgressDetail' {} Maybe Double
a -> ProgressDetail
s {$sel:percentDone:ProgressDetail' :: Maybe Double
percentDone = Maybe Double
a} :: ProgressDetail)

instance Core.FromJSON ProgressDetail where
  parseJSON :: Value -> Parser ProgressDetail
parseJSON =
    String
-> (Object -> Parser ProgressDetail)
-> Value
-> Parser ProgressDetail
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ProgressDetail"
      ( \Object
x ->
          Maybe RobotDeploymentStep
-> Maybe Int -> Maybe Text -> Maybe Double -> ProgressDetail
ProgressDetail'
            (Maybe RobotDeploymentStep
 -> Maybe Int -> Maybe Text -> Maybe Double -> ProgressDetail)
-> Parser (Maybe RobotDeploymentStep)
-> Parser
     (Maybe Int -> Maybe Text -> Maybe Double -> ProgressDetail)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe RobotDeploymentStep)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"currentProgress")
            Parser (Maybe Int -> Maybe Text -> Maybe Double -> ProgressDetail)
-> Parser (Maybe Int)
-> Parser (Maybe Text -> Maybe Double -> ProgressDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"estimatedTimeRemainingSeconds")
            Parser (Maybe Text -> Maybe Double -> ProgressDetail)
-> Parser (Maybe Text) -> Parser (Maybe Double -> ProgressDetail)
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
"targetResource")
            Parser (Maybe Double -> ProgressDetail)
-> Parser (Maybe Double) -> Parser ProgressDetail
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
"percentDone")
      )

instance Prelude.Hashable ProgressDetail

instance Prelude.NFData ProgressDetail