{-# 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.CloudControl.Types.ProgressEvent
-- 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.CloudControl.Types.ProgressEvent where

import Amazonka.CloudControl.Types.HandlerErrorCode
import Amazonka.CloudControl.Types.Operation
import Amazonka.CloudControl.Types.OperationStatus
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents the current status of a resource operation request. For more
-- information, see
-- <https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/resource-operations-manage-requests.html Managing resource operation requests>
-- in the /Amazon Web Services Cloud Control API User Guide/.
--
-- /See:/ 'newProgressEvent' smart constructor.
data ProgressEvent = ProgressEvent'
  { -- | When to next request the status of this resource operation request.
    ProgressEvent -> Maybe POSIX
retryAfter :: Prelude.Maybe Core.POSIX,
    -- | The name of the resource type used in the operation.
    ProgressEvent -> Maybe Text
typeName :: Prelude.Maybe Prelude.Text,
    -- | The unique token representing this resource operation request.
    --
    -- Use the @RequestToken@ with
    -- <https://docs.aws.amazon.com/cloudcontrolapi/latest/APIReference/API_GetResourceRequestStatus.html GetResourceRequestStatus>
    -- to return the current status of a resource operation request.
    ProgressEvent -> Maybe Text
requestToken :: Prelude.Maybe Prelude.Text,
    -- | A JSON string containing the resource model, consisting of each resource
    -- property and its current value.
    ProgressEvent -> Maybe (Sensitive Text)
resourceModel :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The resource operation type.
    ProgressEvent -> Maybe Operation
operation :: Prelude.Maybe Operation,
    -- | The primary identifier for the resource.
    --
    -- In some cases, the resource identifier may be available before the
    -- resource operation has reached a status of @SUCCESS@.
    ProgressEvent -> Maybe Text
identifier :: Prelude.Maybe Prelude.Text,
    -- | The current status of the resource operation request.
    --
    -- -   @PENDING@: The resource operation has not yet started.
    --
    -- -   @IN_PROGRESS@: The resource operation is currently in progress.
    --
    -- -   @SUCCESS@: The resource operation has successfully completed.
    --
    -- -   @FAILED@: The resource operation has failed. Refer to the error code
    --     and status message for more information.
    --
    -- -   @CANCEL_IN_PROGRESS@: The resource operation is in the process of
    --     being canceled.
    --
    -- -   @CANCEL_COMPLETE@: The resource operation has been canceled.
    ProgressEvent -> Maybe OperationStatus
operationStatus :: Prelude.Maybe OperationStatus,
    -- | When the resource operation request was initiated.
    ProgressEvent -> Maybe POSIX
eventTime :: Prelude.Maybe Core.POSIX,
    -- | Any message explaining the current status.
    ProgressEvent -> Maybe Text
statusMessage :: Prelude.Maybe Prelude.Text,
    -- | For requests with a status of @FAILED@, the associated error code.
    --
    -- For error code definitions, see
    -- <https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-test-contract-errors.html Handler error codes>
    -- in the /CloudFormation Command Line Interface User Guide for Extension
    -- Development/.
    ProgressEvent -> Maybe HandlerErrorCode
errorCode :: Prelude.Maybe HandlerErrorCode
  }
  deriving (ProgressEvent -> ProgressEvent -> Bool
(ProgressEvent -> ProgressEvent -> Bool)
-> (ProgressEvent -> ProgressEvent -> Bool) -> Eq ProgressEvent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProgressEvent -> ProgressEvent -> Bool
$c/= :: ProgressEvent -> ProgressEvent -> Bool
== :: ProgressEvent -> ProgressEvent -> Bool
$c== :: ProgressEvent -> ProgressEvent -> Bool
Prelude.Eq, Int -> ProgressEvent -> ShowS
[ProgressEvent] -> ShowS
ProgressEvent -> String
(Int -> ProgressEvent -> ShowS)
-> (ProgressEvent -> String)
-> ([ProgressEvent] -> ShowS)
-> Show ProgressEvent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProgressEvent] -> ShowS
$cshowList :: [ProgressEvent] -> ShowS
show :: ProgressEvent -> String
$cshow :: ProgressEvent -> String
showsPrec :: Int -> ProgressEvent -> ShowS
$cshowsPrec :: Int -> ProgressEvent -> ShowS
Prelude.Show, (forall x. ProgressEvent -> Rep ProgressEvent x)
-> (forall x. Rep ProgressEvent x -> ProgressEvent)
-> Generic ProgressEvent
forall x. Rep ProgressEvent x -> ProgressEvent
forall x. ProgressEvent -> Rep ProgressEvent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProgressEvent x -> ProgressEvent
$cfrom :: forall x. ProgressEvent -> Rep ProgressEvent x
Prelude.Generic)

-- |
-- Create a value of 'ProgressEvent' 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:
--
-- 'retryAfter', 'progressEvent_retryAfter' - When to next request the status of this resource operation request.
--
-- 'typeName', 'progressEvent_typeName' - The name of the resource type used in the operation.
--
-- 'requestToken', 'progressEvent_requestToken' - The unique token representing this resource operation request.
--
-- Use the @RequestToken@ with
-- <https://docs.aws.amazon.com/cloudcontrolapi/latest/APIReference/API_GetResourceRequestStatus.html GetResourceRequestStatus>
-- to return the current status of a resource operation request.
--
-- 'resourceModel', 'progressEvent_resourceModel' - A JSON string containing the resource model, consisting of each resource
-- property and its current value.
--
-- 'operation', 'progressEvent_operation' - The resource operation type.
--
-- 'identifier', 'progressEvent_identifier' - The primary identifier for the resource.
--
-- In some cases, the resource identifier may be available before the
-- resource operation has reached a status of @SUCCESS@.
--
-- 'operationStatus', 'progressEvent_operationStatus' - The current status of the resource operation request.
--
-- -   @PENDING@: The resource operation has not yet started.
--
-- -   @IN_PROGRESS@: The resource operation is currently in progress.
--
-- -   @SUCCESS@: The resource operation has successfully completed.
--
-- -   @FAILED@: The resource operation has failed. Refer to the error code
--     and status message for more information.
--
-- -   @CANCEL_IN_PROGRESS@: The resource operation is in the process of
--     being canceled.
--
-- -   @CANCEL_COMPLETE@: The resource operation has been canceled.
--
-- 'eventTime', 'progressEvent_eventTime' - When the resource operation request was initiated.
--
-- 'statusMessage', 'progressEvent_statusMessage' - Any message explaining the current status.
--
-- 'errorCode', 'progressEvent_errorCode' - For requests with a status of @FAILED@, the associated error code.
--
-- For error code definitions, see
-- <https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-test-contract-errors.html Handler error codes>
-- in the /CloudFormation Command Line Interface User Guide for Extension
-- Development/.
newProgressEvent ::
  ProgressEvent
newProgressEvent :: ProgressEvent
newProgressEvent =
  ProgressEvent' :: Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe (Sensitive Text)
-> Maybe Operation
-> Maybe Text
-> Maybe OperationStatus
-> Maybe POSIX
-> Maybe Text
-> Maybe HandlerErrorCode
-> ProgressEvent
ProgressEvent'
    { $sel:retryAfter:ProgressEvent' :: Maybe POSIX
retryAfter = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:typeName:ProgressEvent' :: Maybe Text
typeName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:requestToken:ProgressEvent' :: Maybe Text
requestToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceModel:ProgressEvent' :: Maybe (Sensitive Text)
resourceModel = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:operation:ProgressEvent' :: Maybe Operation
operation = Maybe Operation
forall a. Maybe a
Prelude.Nothing,
      $sel:identifier:ProgressEvent' :: Maybe Text
identifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:operationStatus:ProgressEvent' :: Maybe OperationStatus
operationStatus = Maybe OperationStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:eventTime:ProgressEvent' :: Maybe POSIX
eventTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:statusMessage:ProgressEvent' :: Maybe Text
statusMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:errorCode:ProgressEvent' :: Maybe HandlerErrorCode
errorCode = Maybe HandlerErrorCode
forall a. Maybe a
Prelude.Nothing
    }

-- | When to next request the status of this resource operation request.
progressEvent_retryAfter :: Lens.Lens' ProgressEvent (Prelude.Maybe Prelude.UTCTime)
progressEvent_retryAfter :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ProgressEvent -> f ProgressEvent
progressEvent_retryAfter = (ProgressEvent -> Maybe POSIX)
-> (ProgressEvent -> Maybe POSIX -> ProgressEvent)
-> Lens ProgressEvent ProgressEvent (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProgressEvent' {Maybe POSIX
retryAfter :: Maybe POSIX
$sel:retryAfter:ProgressEvent' :: ProgressEvent -> Maybe POSIX
retryAfter} -> Maybe POSIX
retryAfter) (\s :: ProgressEvent
s@ProgressEvent' {} Maybe POSIX
a -> ProgressEvent
s {$sel:retryAfter:ProgressEvent' :: Maybe POSIX
retryAfter = Maybe POSIX
a} :: ProgressEvent) ((Maybe POSIX -> f (Maybe POSIX))
 -> ProgressEvent -> f ProgressEvent)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ProgressEvent
-> f ProgressEvent
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

-- | The name of the resource type used in the operation.
progressEvent_typeName :: Lens.Lens' ProgressEvent (Prelude.Maybe Prelude.Text)
progressEvent_typeName :: (Maybe Text -> f (Maybe Text)) -> ProgressEvent -> f ProgressEvent
progressEvent_typeName = (ProgressEvent -> Maybe Text)
-> (ProgressEvent -> Maybe Text -> ProgressEvent)
-> Lens ProgressEvent ProgressEvent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProgressEvent' {Maybe Text
typeName :: Maybe Text
$sel:typeName:ProgressEvent' :: ProgressEvent -> Maybe Text
typeName} -> Maybe Text
typeName) (\s :: ProgressEvent
s@ProgressEvent' {} Maybe Text
a -> ProgressEvent
s {$sel:typeName:ProgressEvent' :: Maybe Text
typeName = Maybe Text
a} :: ProgressEvent)

-- | The unique token representing this resource operation request.
--
-- Use the @RequestToken@ with
-- <https://docs.aws.amazon.com/cloudcontrolapi/latest/APIReference/API_GetResourceRequestStatus.html GetResourceRequestStatus>
-- to return the current status of a resource operation request.
progressEvent_requestToken :: Lens.Lens' ProgressEvent (Prelude.Maybe Prelude.Text)
progressEvent_requestToken :: (Maybe Text -> f (Maybe Text)) -> ProgressEvent -> f ProgressEvent
progressEvent_requestToken = (ProgressEvent -> Maybe Text)
-> (ProgressEvent -> Maybe Text -> ProgressEvent)
-> Lens ProgressEvent ProgressEvent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProgressEvent' {Maybe Text
requestToken :: Maybe Text
$sel:requestToken:ProgressEvent' :: ProgressEvent -> Maybe Text
requestToken} -> Maybe Text
requestToken) (\s :: ProgressEvent
s@ProgressEvent' {} Maybe Text
a -> ProgressEvent
s {$sel:requestToken:ProgressEvent' :: Maybe Text
requestToken = Maybe Text
a} :: ProgressEvent)

-- | A JSON string containing the resource model, consisting of each resource
-- property and its current value.
progressEvent_resourceModel :: Lens.Lens' ProgressEvent (Prelude.Maybe Prelude.Text)
progressEvent_resourceModel :: (Maybe Text -> f (Maybe Text)) -> ProgressEvent -> f ProgressEvent
progressEvent_resourceModel = (ProgressEvent -> Maybe (Sensitive Text))
-> (ProgressEvent -> Maybe (Sensitive Text) -> ProgressEvent)
-> Lens
     ProgressEvent
     ProgressEvent
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProgressEvent' {Maybe (Sensitive Text)
resourceModel :: Maybe (Sensitive Text)
$sel:resourceModel:ProgressEvent' :: ProgressEvent -> Maybe (Sensitive Text)
resourceModel} -> Maybe (Sensitive Text)
resourceModel) (\s :: ProgressEvent
s@ProgressEvent' {} Maybe (Sensitive Text)
a -> ProgressEvent
s {$sel:resourceModel:ProgressEvent' :: Maybe (Sensitive Text)
resourceModel = Maybe (Sensitive Text)
a} :: ProgressEvent) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> ProgressEvent -> f ProgressEvent)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> ProgressEvent
-> f ProgressEvent
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The resource operation type.
progressEvent_operation :: Lens.Lens' ProgressEvent (Prelude.Maybe Operation)
progressEvent_operation :: (Maybe Operation -> f (Maybe Operation))
-> ProgressEvent -> f ProgressEvent
progressEvent_operation = (ProgressEvent -> Maybe Operation)
-> (ProgressEvent -> Maybe Operation -> ProgressEvent)
-> Lens
     ProgressEvent ProgressEvent (Maybe Operation) (Maybe Operation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProgressEvent' {Maybe Operation
operation :: Maybe Operation
$sel:operation:ProgressEvent' :: ProgressEvent -> Maybe Operation
operation} -> Maybe Operation
operation) (\s :: ProgressEvent
s@ProgressEvent' {} Maybe Operation
a -> ProgressEvent
s {$sel:operation:ProgressEvent' :: Maybe Operation
operation = Maybe Operation
a} :: ProgressEvent)

-- | The primary identifier for the resource.
--
-- In some cases, the resource identifier may be available before the
-- resource operation has reached a status of @SUCCESS@.
progressEvent_identifier :: Lens.Lens' ProgressEvent (Prelude.Maybe Prelude.Text)
progressEvent_identifier :: (Maybe Text -> f (Maybe Text)) -> ProgressEvent -> f ProgressEvent
progressEvent_identifier = (ProgressEvent -> Maybe Text)
-> (ProgressEvent -> Maybe Text -> ProgressEvent)
-> Lens ProgressEvent ProgressEvent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProgressEvent' {Maybe Text
identifier :: Maybe Text
$sel:identifier:ProgressEvent' :: ProgressEvent -> Maybe Text
identifier} -> Maybe Text
identifier) (\s :: ProgressEvent
s@ProgressEvent' {} Maybe Text
a -> ProgressEvent
s {$sel:identifier:ProgressEvent' :: Maybe Text
identifier = Maybe Text
a} :: ProgressEvent)

-- | The current status of the resource operation request.
--
-- -   @PENDING@: The resource operation has not yet started.
--
-- -   @IN_PROGRESS@: The resource operation is currently in progress.
--
-- -   @SUCCESS@: The resource operation has successfully completed.
--
-- -   @FAILED@: The resource operation has failed. Refer to the error code
--     and status message for more information.
--
-- -   @CANCEL_IN_PROGRESS@: The resource operation is in the process of
--     being canceled.
--
-- -   @CANCEL_COMPLETE@: The resource operation has been canceled.
progressEvent_operationStatus :: Lens.Lens' ProgressEvent (Prelude.Maybe OperationStatus)
progressEvent_operationStatus :: (Maybe OperationStatus -> f (Maybe OperationStatus))
-> ProgressEvent -> f ProgressEvent
progressEvent_operationStatus = (ProgressEvent -> Maybe OperationStatus)
-> (ProgressEvent -> Maybe OperationStatus -> ProgressEvent)
-> Lens
     ProgressEvent
     ProgressEvent
     (Maybe OperationStatus)
     (Maybe OperationStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProgressEvent' {Maybe OperationStatus
operationStatus :: Maybe OperationStatus
$sel:operationStatus:ProgressEvent' :: ProgressEvent -> Maybe OperationStatus
operationStatus} -> Maybe OperationStatus
operationStatus) (\s :: ProgressEvent
s@ProgressEvent' {} Maybe OperationStatus
a -> ProgressEvent
s {$sel:operationStatus:ProgressEvent' :: Maybe OperationStatus
operationStatus = Maybe OperationStatus
a} :: ProgressEvent)

-- | When the resource operation request was initiated.
progressEvent_eventTime :: Lens.Lens' ProgressEvent (Prelude.Maybe Prelude.UTCTime)
progressEvent_eventTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ProgressEvent -> f ProgressEvent
progressEvent_eventTime = (ProgressEvent -> Maybe POSIX)
-> (ProgressEvent -> Maybe POSIX -> ProgressEvent)
-> Lens ProgressEvent ProgressEvent (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProgressEvent' {Maybe POSIX
eventTime :: Maybe POSIX
$sel:eventTime:ProgressEvent' :: ProgressEvent -> Maybe POSIX
eventTime} -> Maybe POSIX
eventTime) (\s :: ProgressEvent
s@ProgressEvent' {} Maybe POSIX
a -> ProgressEvent
s {$sel:eventTime:ProgressEvent' :: Maybe POSIX
eventTime = Maybe POSIX
a} :: ProgressEvent) ((Maybe POSIX -> f (Maybe POSIX))
 -> ProgressEvent -> f ProgressEvent)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ProgressEvent
-> f ProgressEvent
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

-- | Any message explaining the current status.
progressEvent_statusMessage :: Lens.Lens' ProgressEvent (Prelude.Maybe Prelude.Text)
progressEvent_statusMessage :: (Maybe Text -> f (Maybe Text)) -> ProgressEvent -> f ProgressEvent
progressEvent_statusMessage = (ProgressEvent -> Maybe Text)
-> (ProgressEvent -> Maybe Text -> ProgressEvent)
-> Lens ProgressEvent ProgressEvent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProgressEvent' {Maybe Text
statusMessage :: Maybe Text
$sel:statusMessage:ProgressEvent' :: ProgressEvent -> Maybe Text
statusMessage} -> Maybe Text
statusMessage) (\s :: ProgressEvent
s@ProgressEvent' {} Maybe Text
a -> ProgressEvent
s {$sel:statusMessage:ProgressEvent' :: Maybe Text
statusMessage = Maybe Text
a} :: ProgressEvent)

-- | For requests with a status of @FAILED@, the associated error code.
--
-- For error code definitions, see
-- <https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-test-contract-errors.html Handler error codes>
-- in the /CloudFormation Command Line Interface User Guide for Extension
-- Development/.
progressEvent_errorCode :: Lens.Lens' ProgressEvent (Prelude.Maybe HandlerErrorCode)
progressEvent_errorCode :: (Maybe HandlerErrorCode -> f (Maybe HandlerErrorCode))
-> ProgressEvent -> f ProgressEvent
progressEvent_errorCode = (ProgressEvent -> Maybe HandlerErrorCode)
-> (ProgressEvent -> Maybe HandlerErrorCode -> ProgressEvent)
-> Lens
     ProgressEvent
     ProgressEvent
     (Maybe HandlerErrorCode)
     (Maybe HandlerErrorCode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProgressEvent' {Maybe HandlerErrorCode
errorCode :: Maybe HandlerErrorCode
$sel:errorCode:ProgressEvent' :: ProgressEvent -> Maybe HandlerErrorCode
errorCode} -> Maybe HandlerErrorCode
errorCode) (\s :: ProgressEvent
s@ProgressEvent' {} Maybe HandlerErrorCode
a -> ProgressEvent
s {$sel:errorCode:ProgressEvent' :: Maybe HandlerErrorCode
errorCode = Maybe HandlerErrorCode
a} :: ProgressEvent)

instance Core.FromJSON ProgressEvent where
  parseJSON :: Value -> Parser ProgressEvent
parseJSON =
    String
-> (Object -> Parser ProgressEvent)
-> Value
-> Parser ProgressEvent
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ProgressEvent"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe (Sensitive Text)
-> Maybe Operation
-> Maybe Text
-> Maybe OperationStatus
-> Maybe POSIX
-> Maybe Text
-> Maybe HandlerErrorCode
-> ProgressEvent
ProgressEvent'
            (Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe (Sensitive Text)
 -> Maybe Operation
 -> Maybe Text
 -> Maybe OperationStatus
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe HandlerErrorCode
 -> ProgressEvent)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe (Sensitive Text)
      -> Maybe Operation
      -> Maybe Text
      -> Maybe OperationStatus
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe HandlerErrorCode
      -> ProgressEvent)
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
"RetryAfter")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe (Sensitive Text)
   -> Maybe Operation
   -> Maybe Text
   -> Maybe OperationStatus
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe HandlerErrorCode
   -> ProgressEvent)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe (Sensitive Text)
      -> Maybe Operation
      -> Maybe Text
      -> Maybe OperationStatus
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe HandlerErrorCode
      -> ProgressEvent)
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
"TypeName")
            Parser
  (Maybe Text
   -> Maybe (Sensitive Text)
   -> Maybe Operation
   -> Maybe Text
   -> Maybe OperationStatus
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe HandlerErrorCode
   -> ProgressEvent)
-> Parser (Maybe Text)
-> Parser
     (Maybe (Sensitive Text)
      -> Maybe Operation
      -> Maybe Text
      -> Maybe OperationStatus
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe HandlerErrorCode
      -> ProgressEvent)
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
"RequestToken")
            Parser
  (Maybe (Sensitive Text)
   -> Maybe Operation
   -> Maybe Text
   -> Maybe OperationStatus
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe HandlerErrorCode
   -> ProgressEvent)
-> Parser (Maybe (Sensitive Text))
-> Parser
     (Maybe Operation
      -> Maybe Text
      -> Maybe OperationStatus
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe HandlerErrorCode
      -> ProgressEvent)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ResourceModel")
            Parser
  (Maybe Operation
   -> Maybe Text
   -> Maybe OperationStatus
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe HandlerErrorCode
   -> ProgressEvent)
-> Parser (Maybe Operation)
-> Parser
     (Maybe Text
      -> Maybe OperationStatus
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe HandlerErrorCode
      -> ProgressEvent)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Operation)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Operation")
            Parser
  (Maybe Text
   -> Maybe OperationStatus
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe HandlerErrorCode
   -> ProgressEvent)
-> Parser (Maybe Text)
-> Parser
     (Maybe OperationStatus
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe HandlerErrorCode
      -> ProgressEvent)
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
"Identifier")
            Parser
  (Maybe OperationStatus
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe HandlerErrorCode
   -> ProgressEvent)
-> Parser (Maybe OperationStatus)
-> Parser
     (Maybe POSIX
      -> Maybe Text -> Maybe HandlerErrorCode -> ProgressEvent)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe OperationStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OperationStatus")
            Parser
  (Maybe POSIX
   -> Maybe Text -> Maybe HandlerErrorCode -> ProgressEvent)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> Maybe HandlerErrorCode -> ProgressEvent)
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
"EventTime")
            Parser (Maybe Text -> Maybe HandlerErrorCode -> ProgressEvent)
-> Parser (Maybe Text)
-> Parser (Maybe HandlerErrorCode -> ProgressEvent)
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
"StatusMessage")
            Parser (Maybe HandlerErrorCode -> ProgressEvent)
-> Parser (Maybe HandlerErrorCode) -> Parser ProgressEvent
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe HandlerErrorCode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ErrorCode")
      )

instance Prelude.Hashable ProgressEvent

instance Prelude.NFData ProgressEvent