{-# 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.AppRunner.Types.OperationSummary
-- 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.AppRunner.Types.OperationSummary where

import Amazonka.AppRunner.Types.OperationStatus
import Amazonka.AppRunner.Types.OperationType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Provides summary information for an operation that occurred on an App
-- Runner service.
--
-- /See:/ 'newOperationSummary' smart constructor.
data OperationSummary = OperationSummary'
  { -- | The current state of the operation.
    OperationSummary -> Maybe OperationStatus
status :: Prelude.Maybe OperationStatus,
    -- | The Amazon Resource Name (ARN) of the resource that the operation acted
    -- on (for example, an App Runner service).
    OperationSummary -> Maybe Text
targetArn :: Prelude.Maybe Prelude.Text,
    -- | The time when the operation ended. It\'s in the Unix time stamp format.
    OperationSummary -> Maybe POSIX
endedAt :: Prelude.Maybe Core.POSIX,
    -- | The time when the operation started. It\'s in the Unix time stamp
    -- format.
    OperationSummary -> Maybe POSIX
startedAt :: Prelude.Maybe Core.POSIX,
    -- | A unique ID of this operation. It\'s unique in the scope of the App
    -- Runner service.
    OperationSummary -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The type of operation. It indicates a specific action that occured.
    OperationSummary -> Maybe OperationType
type' :: Prelude.Maybe OperationType,
    -- | The time when the operation was last updated. It\'s in the Unix time
    -- stamp format.
    OperationSummary -> Maybe POSIX
updatedAt :: Prelude.Maybe Core.POSIX
  }
  deriving (OperationSummary -> OperationSummary -> Bool
(OperationSummary -> OperationSummary -> Bool)
-> (OperationSummary -> OperationSummary -> Bool)
-> Eq OperationSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OperationSummary -> OperationSummary -> Bool
$c/= :: OperationSummary -> OperationSummary -> Bool
== :: OperationSummary -> OperationSummary -> Bool
$c== :: OperationSummary -> OperationSummary -> Bool
Prelude.Eq, ReadPrec [OperationSummary]
ReadPrec OperationSummary
Int -> ReadS OperationSummary
ReadS [OperationSummary]
(Int -> ReadS OperationSummary)
-> ReadS [OperationSummary]
-> ReadPrec OperationSummary
-> ReadPrec [OperationSummary]
-> Read OperationSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OperationSummary]
$creadListPrec :: ReadPrec [OperationSummary]
readPrec :: ReadPrec OperationSummary
$creadPrec :: ReadPrec OperationSummary
readList :: ReadS [OperationSummary]
$creadList :: ReadS [OperationSummary]
readsPrec :: Int -> ReadS OperationSummary
$creadsPrec :: Int -> ReadS OperationSummary
Prelude.Read, Int -> OperationSummary -> ShowS
[OperationSummary] -> ShowS
OperationSummary -> String
(Int -> OperationSummary -> ShowS)
-> (OperationSummary -> String)
-> ([OperationSummary] -> ShowS)
-> Show OperationSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OperationSummary] -> ShowS
$cshowList :: [OperationSummary] -> ShowS
show :: OperationSummary -> String
$cshow :: OperationSummary -> String
showsPrec :: Int -> OperationSummary -> ShowS
$cshowsPrec :: Int -> OperationSummary -> ShowS
Prelude.Show, (forall x. OperationSummary -> Rep OperationSummary x)
-> (forall x. Rep OperationSummary x -> OperationSummary)
-> Generic OperationSummary
forall x. Rep OperationSummary x -> OperationSummary
forall x. OperationSummary -> Rep OperationSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OperationSummary x -> OperationSummary
$cfrom :: forall x. OperationSummary -> Rep OperationSummary x
Prelude.Generic)

-- |
-- Create a value of 'OperationSummary' 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:
--
-- 'status', 'operationSummary_status' - The current state of the operation.
--
-- 'targetArn', 'operationSummary_targetArn' - The Amazon Resource Name (ARN) of the resource that the operation acted
-- on (for example, an App Runner service).
--
-- 'endedAt', 'operationSummary_endedAt' - The time when the operation ended. It\'s in the Unix time stamp format.
--
-- 'startedAt', 'operationSummary_startedAt' - The time when the operation started. It\'s in the Unix time stamp
-- format.
--
-- 'id', 'operationSummary_id' - A unique ID of this operation. It\'s unique in the scope of the App
-- Runner service.
--
-- 'type'', 'operationSummary_type' - The type of operation. It indicates a specific action that occured.
--
-- 'updatedAt', 'operationSummary_updatedAt' - The time when the operation was last updated. It\'s in the Unix time
-- stamp format.
newOperationSummary ::
  OperationSummary
newOperationSummary :: OperationSummary
newOperationSummary =
  OperationSummary' :: Maybe OperationStatus
-> Maybe Text
-> Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Maybe OperationType
-> Maybe POSIX
-> OperationSummary
OperationSummary'
    { $sel:status:OperationSummary' :: Maybe OperationStatus
status = Maybe OperationStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:targetArn:OperationSummary' :: Maybe Text
targetArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:endedAt:OperationSummary' :: Maybe POSIX
endedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:startedAt:OperationSummary' :: Maybe POSIX
startedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:id:OperationSummary' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':OperationSummary' :: Maybe OperationType
type' = Maybe OperationType
forall a. Maybe a
Prelude.Nothing,
      $sel:updatedAt:OperationSummary' :: Maybe POSIX
updatedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The current state of the operation.
operationSummary_status :: Lens.Lens' OperationSummary (Prelude.Maybe OperationStatus)
operationSummary_status :: (Maybe OperationStatus -> f (Maybe OperationStatus))
-> OperationSummary -> f OperationSummary
operationSummary_status = (OperationSummary -> Maybe OperationStatus)
-> (OperationSummary -> Maybe OperationStatus -> OperationSummary)
-> Lens
     OperationSummary
     OperationSummary
     (Maybe OperationStatus)
     (Maybe OperationStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OperationSummary' {Maybe OperationStatus
status :: Maybe OperationStatus
$sel:status:OperationSummary' :: OperationSummary -> Maybe OperationStatus
status} -> Maybe OperationStatus
status) (\s :: OperationSummary
s@OperationSummary' {} Maybe OperationStatus
a -> OperationSummary
s {$sel:status:OperationSummary' :: Maybe OperationStatus
status = Maybe OperationStatus
a} :: OperationSummary)

-- | The Amazon Resource Name (ARN) of the resource that the operation acted
-- on (for example, an App Runner service).
operationSummary_targetArn :: Lens.Lens' OperationSummary (Prelude.Maybe Prelude.Text)
operationSummary_targetArn :: (Maybe Text -> f (Maybe Text))
-> OperationSummary -> f OperationSummary
operationSummary_targetArn = (OperationSummary -> Maybe Text)
-> (OperationSummary -> Maybe Text -> OperationSummary)
-> Lens OperationSummary OperationSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OperationSummary' {Maybe Text
targetArn :: Maybe Text
$sel:targetArn:OperationSummary' :: OperationSummary -> Maybe Text
targetArn} -> Maybe Text
targetArn) (\s :: OperationSummary
s@OperationSummary' {} Maybe Text
a -> OperationSummary
s {$sel:targetArn:OperationSummary' :: Maybe Text
targetArn = Maybe Text
a} :: OperationSummary)

-- | The time when the operation ended. It\'s in the Unix time stamp format.
operationSummary_endedAt :: Lens.Lens' OperationSummary (Prelude.Maybe Prelude.UTCTime)
operationSummary_endedAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> OperationSummary -> f OperationSummary
operationSummary_endedAt = (OperationSummary -> Maybe POSIX)
-> (OperationSummary -> Maybe POSIX -> OperationSummary)
-> Lens
     OperationSummary OperationSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OperationSummary' {Maybe POSIX
endedAt :: Maybe POSIX
$sel:endedAt:OperationSummary' :: OperationSummary -> Maybe POSIX
endedAt} -> Maybe POSIX
endedAt) (\s :: OperationSummary
s@OperationSummary' {} Maybe POSIX
a -> OperationSummary
s {$sel:endedAt:OperationSummary' :: Maybe POSIX
endedAt = Maybe POSIX
a} :: OperationSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> OperationSummary -> f OperationSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> OperationSummary
-> f OperationSummary
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 time when the operation started. It\'s in the Unix time stamp
-- format.
operationSummary_startedAt :: Lens.Lens' OperationSummary (Prelude.Maybe Prelude.UTCTime)
operationSummary_startedAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> OperationSummary -> f OperationSummary
operationSummary_startedAt = (OperationSummary -> Maybe POSIX)
-> (OperationSummary -> Maybe POSIX -> OperationSummary)
-> Lens
     OperationSummary OperationSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OperationSummary' {Maybe POSIX
startedAt :: Maybe POSIX
$sel:startedAt:OperationSummary' :: OperationSummary -> Maybe POSIX
startedAt} -> Maybe POSIX
startedAt) (\s :: OperationSummary
s@OperationSummary' {} Maybe POSIX
a -> OperationSummary
s {$sel:startedAt:OperationSummary' :: Maybe POSIX
startedAt = Maybe POSIX
a} :: OperationSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> OperationSummary -> f OperationSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> OperationSummary
-> f OperationSummary
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 unique ID of this operation. It\'s unique in the scope of the App
-- Runner service.
operationSummary_id :: Lens.Lens' OperationSummary (Prelude.Maybe Prelude.Text)
operationSummary_id :: (Maybe Text -> f (Maybe Text))
-> OperationSummary -> f OperationSummary
operationSummary_id = (OperationSummary -> Maybe Text)
-> (OperationSummary -> Maybe Text -> OperationSummary)
-> Lens OperationSummary OperationSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OperationSummary' {Maybe Text
id :: Maybe Text
$sel:id:OperationSummary' :: OperationSummary -> Maybe Text
id} -> Maybe Text
id) (\s :: OperationSummary
s@OperationSummary' {} Maybe Text
a -> OperationSummary
s {$sel:id:OperationSummary' :: Maybe Text
id = Maybe Text
a} :: OperationSummary)

-- | The type of operation. It indicates a specific action that occured.
operationSummary_type :: Lens.Lens' OperationSummary (Prelude.Maybe OperationType)
operationSummary_type :: (Maybe OperationType -> f (Maybe OperationType))
-> OperationSummary -> f OperationSummary
operationSummary_type = (OperationSummary -> Maybe OperationType)
-> (OperationSummary -> Maybe OperationType -> OperationSummary)
-> Lens
     OperationSummary
     OperationSummary
     (Maybe OperationType)
     (Maybe OperationType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OperationSummary' {Maybe OperationType
type' :: Maybe OperationType
$sel:type':OperationSummary' :: OperationSummary -> Maybe OperationType
type'} -> Maybe OperationType
type') (\s :: OperationSummary
s@OperationSummary' {} Maybe OperationType
a -> OperationSummary
s {$sel:type':OperationSummary' :: Maybe OperationType
type' = Maybe OperationType
a} :: OperationSummary)

-- | The time when the operation was last updated. It\'s in the Unix time
-- stamp format.
operationSummary_updatedAt :: Lens.Lens' OperationSummary (Prelude.Maybe Prelude.UTCTime)
operationSummary_updatedAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> OperationSummary -> f OperationSummary
operationSummary_updatedAt = (OperationSummary -> Maybe POSIX)
-> (OperationSummary -> Maybe POSIX -> OperationSummary)
-> Lens
     OperationSummary OperationSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OperationSummary' {Maybe POSIX
updatedAt :: Maybe POSIX
$sel:updatedAt:OperationSummary' :: OperationSummary -> Maybe POSIX
updatedAt} -> Maybe POSIX
updatedAt) (\s :: OperationSummary
s@OperationSummary' {} Maybe POSIX
a -> OperationSummary
s {$sel:updatedAt:OperationSummary' :: Maybe POSIX
updatedAt = Maybe POSIX
a} :: OperationSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> OperationSummary -> f OperationSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> OperationSummary
-> f OperationSummary
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 OperationSummary where
  parseJSON :: Value -> Parser OperationSummary
parseJSON =
    String
-> (Object -> Parser OperationSummary)
-> Value
-> Parser OperationSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"OperationSummary"
      ( \Object
x ->
          Maybe OperationStatus
-> Maybe Text
-> Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Maybe OperationType
-> Maybe POSIX
-> OperationSummary
OperationSummary'
            (Maybe OperationStatus
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe OperationType
 -> Maybe POSIX
 -> OperationSummary)
-> Parser (Maybe OperationStatus)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe OperationType
      -> Maybe POSIX
      -> OperationSummary)
forall (f :: * -> *) a b. Functor 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
"Status")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe OperationType
   -> Maybe POSIX
   -> OperationSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe OperationType
      -> Maybe POSIX
      -> OperationSummary)
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
"TargetArn")
            Parser
  (Maybe POSIX
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe OperationType
   -> Maybe POSIX
   -> OperationSummary)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe OperationType
      -> Maybe POSIX
      -> OperationSummary)
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
"EndedAt")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe OperationType
   -> Maybe POSIX
   -> OperationSummary)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe OperationType -> Maybe POSIX -> OperationSummary)
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
"StartedAt")
            Parser
  (Maybe Text
   -> Maybe OperationType -> Maybe POSIX -> OperationSummary)
-> Parser (Maybe Text)
-> Parser (Maybe OperationType -> Maybe POSIX -> OperationSummary)
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
"Id")
            Parser (Maybe OperationType -> Maybe POSIX -> OperationSummary)
-> Parser (Maybe OperationType)
-> Parser (Maybe POSIX -> OperationSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe OperationType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
            Parser (Maybe POSIX -> OperationSummary)
-> Parser (Maybe POSIX) -> Parser OperationSummary
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
"UpdatedAt")
      )

instance Prelude.Hashable OperationSummary

instance Prelude.NFData OperationSummary