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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.RobOMaker.Types.DeploymentJobErrorCode
import Amazonka.RobOMaker.Types.ProgressDetail
import Amazonka.RobOMaker.Types.RobotStatus

-- | Information about a robot deployment.
--
-- /See:/ 'newRobotDeployment' smart constructor.
data RobotDeployment = RobotDeployment'
  { -- | The time, in milliseconds since the epoch, when the deployment was
    -- started.
    RobotDeployment -> Maybe POSIX
deploymentStartTime :: Prelude.Maybe Core.POSIX,
    -- | A short description of the reason why the robot deployment failed.
    RobotDeployment -> Maybe Text
failureReason :: Prelude.Maybe Prelude.Text,
    -- | The status of the robot deployment.
    RobotDeployment -> Maybe RobotStatus
status :: Prelude.Maybe RobotStatus,
    -- | The robot deployment Amazon Resource Name (ARN).
    RobotDeployment -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The robot deployment failure code.
    RobotDeployment -> Maybe DeploymentJobErrorCode
failureCode :: Prelude.Maybe DeploymentJobErrorCode,
    -- | Information about how the deployment is progressing.
    RobotDeployment -> Maybe ProgressDetail
progressDetail :: Prelude.Maybe ProgressDetail,
    -- | The time, in milliseconds since the epoch, when the deployment finished.
    RobotDeployment -> Maybe POSIX
deploymentFinishTime :: Prelude.Maybe Core.POSIX
  }
  deriving (RobotDeployment -> RobotDeployment -> Bool
(RobotDeployment -> RobotDeployment -> Bool)
-> (RobotDeployment -> RobotDeployment -> Bool)
-> Eq RobotDeployment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RobotDeployment -> RobotDeployment -> Bool
$c/= :: RobotDeployment -> RobotDeployment -> Bool
== :: RobotDeployment -> RobotDeployment -> Bool
$c== :: RobotDeployment -> RobotDeployment -> Bool
Prelude.Eq, ReadPrec [RobotDeployment]
ReadPrec RobotDeployment
Int -> ReadS RobotDeployment
ReadS [RobotDeployment]
(Int -> ReadS RobotDeployment)
-> ReadS [RobotDeployment]
-> ReadPrec RobotDeployment
-> ReadPrec [RobotDeployment]
-> Read RobotDeployment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RobotDeployment]
$creadListPrec :: ReadPrec [RobotDeployment]
readPrec :: ReadPrec RobotDeployment
$creadPrec :: ReadPrec RobotDeployment
readList :: ReadS [RobotDeployment]
$creadList :: ReadS [RobotDeployment]
readsPrec :: Int -> ReadS RobotDeployment
$creadsPrec :: Int -> ReadS RobotDeployment
Prelude.Read, Int -> RobotDeployment -> ShowS
[RobotDeployment] -> ShowS
RobotDeployment -> String
(Int -> RobotDeployment -> ShowS)
-> (RobotDeployment -> String)
-> ([RobotDeployment] -> ShowS)
-> Show RobotDeployment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RobotDeployment] -> ShowS
$cshowList :: [RobotDeployment] -> ShowS
show :: RobotDeployment -> String
$cshow :: RobotDeployment -> String
showsPrec :: Int -> RobotDeployment -> ShowS
$cshowsPrec :: Int -> RobotDeployment -> ShowS
Prelude.Show, (forall x. RobotDeployment -> Rep RobotDeployment x)
-> (forall x. Rep RobotDeployment x -> RobotDeployment)
-> Generic RobotDeployment
forall x. Rep RobotDeployment x -> RobotDeployment
forall x. RobotDeployment -> Rep RobotDeployment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RobotDeployment x -> RobotDeployment
$cfrom :: forall x. RobotDeployment -> Rep RobotDeployment x
Prelude.Generic)

-- |
-- Create a value of 'RobotDeployment' 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:
--
-- 'deploymentStartTime', 'robotDeployment_deploymentStartTime' - The time, in milliseconds since the epoch, when the deployment was
-- started.
--
-- 'failureReason', 'robotDeployment_failureReason' - A short description of the reason why the robot deployment failed.
--
-- 'status', 'robotDeployment_status' - The status of the robot deployment.
--
-- 'arn', 'robotDeployment_arn' - The robot deployment Amazon Resource Name (ARN).
--
-- 'failureCode', 'robotDeployment_failureCode' - The robot deployment failure code.
--
-- 'progressDetail', 'robotDeployment_progressDetail' - Information about how the deployment is progressing.
--
-- 'deploymentFinishTime', 'robotDeployment_deploymentFinishTime' - The time, in milliseconds since the epoch, when the deployment finished.
newRobotDeployment ::
  RobotDeployment
newRobotDeployment :: RobotDeployment
newRobotDeployment =
  RobotDeployment' :: Maybe POSIX
-> Maybe Text
-> Maybe RobotStatus
-> Maybe Text
-> Maybe DeploymentJobErrorCode
-> Maybe ProgressDetail
-> Maybe POSIX
-> RobotDeployment
RobotDeployment'
    { $sel:deploymentStartTime:RobotDeployment' :: Maybe POSIX
deploymentStartTime =
        Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:failureReason:RobotDeployment' :: Maybe Text
failureReason = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:status:RobotDeployment' :: Maybe RobotStatus
status = Maybe RobotStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:RobotDeployment' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:failureCode:RobotDeployment' :: Maybe DeploymentJobErrorCode
failureCode = Maybe DeploymentJobErrorCode
forall a. Maybe a
Prelude.Nothing,
      $sel:progressDetail:RobotDeployment' :: Maybe ProgressDetail
progressDetail = Maybe ProgressDetail
forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentFinishTime:RobotDeployment' :: Maybe POSIX
deploymentFinishTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The time, in milliseconds since the epoch, when the deployment was
-- started.
robotDeployment_deploymentStartTime :: Lens.Lens' RobotDeployment (Prelude.Maybe Prelude.UTCTime)
robotDeployment_deploymentStartTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> RobotDeployment -> f RobotDeployment
robotDeployment_deploymentStartTime = (RobotDeployment -> Maybe POSIX)
-> (RobotDeployment -> Maybe POSIX -> RobotDeployment)
-> Lens RobotDeployment RobotDeployment (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RobotDeployment' {Maybe POSIX
deploymentStartTime :: Maybe POSIX
$sel:deploymentStartTime:RobotDeployment' :: RobotDeployment -> Maybe POSIX
deploymentStartTime} -> Maybe POSIX
deploymentStartTime) (\s :: RobotDeployment
s@RobotDeployment' {} Maybe POSIX
a -> RobotDeployment
s {$sel:deploymentStartTime:RobotDeployment' :: Maybe POSIX
deploymentStartTime = Maybe POSIX
a} :: RobotDeployment) ((Maybe POSIX -> f (Maybe POSIX))
 -> RobotDeployment -> f RobotDeployment)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> RobotDeployment
-> f RobotDeployment
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | A short description of the reason why the robot deployment failed.
robotDeployment_failureReason :: Lens.Lens' RobotDeployment (Prelude.Maybe Prelude.Text)
robotDeployment_failureReason :: (Maybe Text -> f (Maybe Text))
-> RobotDeployment -> f RobotDeployment
robotDeployment_failureReason = (RobotDeployment -> Maybe Text)
-> (RobotDeployment -> Maybe Text -> RobotDeployment)
-> Lens RobotDeployment RobotDeployment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RobotDeployment' {Maybe Text
failureReason :: Maybe Text
$sel:failureReason:RobotDeployment' :: RobotDeployment -> Maybe Text
failureReason} -> Maybe Text
failureReason) (\s :: RobotDeployment
s@RobotDeployment' {} Maybe Text
a -> RobotDeployment
s {$sel:failureReason:RobotDeployment' :: Maybe Text
failureReason = Maybe Text
a} :: RobotDeployment)

-- | The status of the robot deployment.
robotDeployment_status :: Lens.Lens' RobotDeployment (Prelude.Maybe RobotStatus)
robotDeployment_status :: (Maybe RobotStatus -> f (Maybe RobotStatus))
-> RobotDeployment -> f RobotDeployment
robotDeployment_status = (RobotDeployment -> Maybe RobotStatus)
-> (RobotDeployment -> Maybe RobotStatus -> RobotDeployment)
-> Lens
     RobotDeployment
     RobotDeployment
     (Maybe RobotStatus)
     (Maybe RobotStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RobotDeployment' {Maybe RobotStatus
status :: Maybe RobotStatus
$sel:status:RobotDeployment' :: RobotDeployment -> Maybe RobotStatus
status} -> Maybe RobotStatus
status) (\s :: RobotDeployment
s@RobotDeployment' {} Maybe RobotStatus
a -> RobotDeployment
s {$sel:status:RobotDeployment' :: Maybe RobotStatus
status = Maybe RobotStatus
a} :: RobotDeployment)

-- | The robot deployment Amazon Resource Name (ARN).
robotDeployment_arn :: Lens.Lens' RobotDeployment (Prelude.Maybe Prelude.Text)
robotDeployment_arn :: (Maybe Text -> f (Maybe Text))
-> RobotDeployment -> f RobotDeployment
robotDeployment_arn = (RobotDeployment -> Maybe Text)
-> (RobotDeployment -> Maybe Text -> RobotDeployment)
-> Lens RobotDeployment RobotDeployment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RobotDeployment' {Maybe Text
arn :: Maybe Text
$sel:arn:RobotDeployment' :: RobotDeployment -> Maybe Text
arn} -> Maybe Text
arn) (\s :: RobotDeployment
s@RobotDeployment' {} Maybe Text
a -> RobotDeployment
s {$sel:arn:RobotDeployment' :: Maybe Text
arn = Maybe Text
a} :: RobotDeployment)

-- | The robot deployment failure code.
robotDeployment_failureCode :: Lens.Lens' RobotDeployment (Prelude.Maybe DeploymentJobErrorCode)
robotDeployment_failureCode :: (Maybe DeploymentJobErrorCode -> f (Maybe DeploymentJobErrorCode))
-> RobotDeployment -> f RobotDeployment
robotDeployment_failureCode = (RobotDeployment -> Maybe DeploymentJobErrorCode)
-> (RobotDeployment
    -> Maybe DeploymentJobErrorCode -> RobotDeployment)
-> Lens
     RobotDeployment
     RobotDeployment
     (Maybe DeploymentJobErrorCode)
     (Maybe DeploymentJobErrorCode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RobotDeployment' {Maybe DeploymentJobErrorCode
failureCode :: Maybe DeploymentJobErrorCode
$sel:failureCode:RobotDeployment' :: RobotDeployment -> Maybe DeploymentJobErrorCode
failureCode} -> Maybe DeploymentJobErrorCode
failureCode) (\s :: RobotDeployment
s@RobotDeployment' {} Maybe DeploymentJobErrorCode
a -> RobotDeployment
s {$sel:failureCode:RobotDeployment' :: Maybe DeploymentJobErrorCode
failureCode = Maybe DeploymentJobErrorCode
a} :: RobotDeployment)

-- | Information about how the deployment is progressing.
robotDeployment_progressDetail :: Lens.Lens' RobotDeployment (Prelude.Maybe ProgressDetail)
robotDeployment_progressDetail :: (Maybe ProgressDetail -> f (Maybe ProgressDetail))
-> RobotDeployment -> f RobotDeployment
robotDeployment_progressDetail = (RobotDeployment -> Maybe ProgressDetail)
-> (RobotDeployment -> Maybe ProgressDetail -> RobotDeployment)
-> Lens
     RobotDeployment
     RobotDeployment
     (Maybe ProgressDetail)
     (Maybe ProgressDetail)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RobotDeployment' {Maybe ProgressDetail
progressDetail :: Maybe ProgressDetail
$sel:progressDetail:RobotDeployment' :: RobotDeployment -> Maybe ProgressDetail
progressDetail} -> Maybe ProgressDetail
progressDetail) (\s :: RobotDeployment
s@RobotDeployment' {} Maybe ProgressDetail
a -> RobotDeployment
s {$sel:progressDetail:RobotDeployment' :: Maybe ProgressDetail
progressDetail = Maybe ProgressDetail
a} :: RobotDeployment)

-- | The time, in milliseconds since the epoch, when the deployment finished.
robotDeployment_deploymentFinishTime :: Lens.Lens' RobotDeployment (Prelude.Maybe Prelude.UTCTime)
robotDeployment_deploymentFinishTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> RobotDeployment -> f RobotDeployment
robotDeployment_deploymentFinishTime = (RobotDeployment -> Maybe POSIX)
-> (RobotDeployment -> Maybe POSIX -> RobotDeployment)
-> Lens RobotDeployment RobotDeployment (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RobotDeployment' {Maybe POSIX
deploymentFinishTime :: Maybe POSIX
$sel:deploymentFinishTime:RobotDeployment' :: RobotDeployment -> Maybe POSIX
deploymentFinishTime} -> Maybe POSIX
deploymentFinishTime) (\s :: RobotDeployment
s@RobotDeployment' {} Maybe POSIX
a -> RobotDeployment
s {$sel:deploymentFinishTime:RobotDeployment' :: Maybe POSIX
deploymentFinishTime = Maybe POSIX
a} :: RobotDeployment) ((Maybe POSIX -> f (Maybe POSIX))
 -> RobotDeployment -> f RobotDeployment)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> RobotDeployment
-> f RobotDeployment
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON RobotDeployment where
  parseJSON :: Value -> Parser RobotDeployment
parseJSON =
    String
-> (Object -> Parser RobotDeployment)
-> Value
-> Parser RobotDeployment
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RobotDeployment"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe RobotStatus
-> Maybe Text
-> Maybe DeploymentJobErrorCode
-> Maybe ProgressDetail
-> Maybe POSIX
-> RobotDeployment
RobotDeployment'
            (Maybe POSIX
 -> Maybe Text
 -> Maybe RobotStatus
 -> Maybe Text
 -> Maybe DeploymentJobErrorCode
 -> Maybe ProgressDetail
 -> Maybe POSIX
 -> RobotDeployment)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe RobotStatus
      -> Maybe Text
      -> Maybe DeploymentJobErrorCode
      -> Maybe ProgressDetail
      -> Maybe POSIX
      -> RobotDeployment)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"deploymentStartTime")
            Parser
  (Maybe Text
   -> Maybe RobotStatus
   -> Maybe Text
   -> Maybe DeploymentJobErrorCode
   -> Maybe ProgressDetail
   -> Maybe POSIX
   -> RobotDeployment)
-> Parser (Maybe Text)
-> Parser
     (Maybe RobotStatus
      -> Maybe Text
      -> Maybe DeploymentJobErrorCode
      -> Maybe ProgressDetail
      -> Maybe POSIX
      -> RobotDeployment)
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
"failureReason")
            Parser
  (Maybe RobotStatus
   -> Maybe Text
   -> Maybe DeploymentJobErrorCode
   -> Maybe ProgressDetail
   -> Maybe POSIX
   -> RobotDeployment)
-> Parser (Maybe RobotStatus)
-> Parser
     (Maybe Text
      -> Maybe DeploymentJobErrorCode
      -> Maybe ProgressDetail
      -> Maybe POSIX
      -> RobotDeployment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe RobotStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
            Parser
  (Maybe Text
   -> Maybe DeploymentJobErrorCode
   -> Maybe ProgressDetail
   -> Maybe POSIX
   -> RobotDeployment)
-> Parser (Maybe Text)
-> Parser
     (Maybe DeploymentJobErrorCode
      -> Maybe ProgressDetail -> Maybe POSIX -> RobotDeployment)
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
"arn")
            Parser
  (Maybe DeploymentJobErrorCode
   -> Maybe ProgressDetail -> Maybe POSIX -> RobotDeployment)
-> Parser (Maybe DeploymentJobErrorCode)
-> Parser (Maybe ProgressDetail -> Maybe POSIX -> RobotDeployment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DeploymentJobErrorCode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"failureCode")
            Parser (Maybe ProgressDetail -> Maybe POSIX -> RobotDeployment)
-> Parser (Maybe ProgressDetail)
-> Parser (Maybe POSIX -> RobotDeployment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ProgressDetail)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"progressDetail")
            Parser (Maybe POSIX -> RobotDeployment)
-> Parser (Maybe POSIX) -> Parser RobotDeployment
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"deploymentFinishTime")
      )

instance Prelude.Hashable RobotDeployment

instance Prelude.NFData RobotDeployment