{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 time when the operation ended. It\'s in the Unix time stamp format.
    OperationSummary -> Maybe POSIX
endedAt :: Prelude.Maybe Data.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 time when the operation started. It\'s in the Unix time stamp
    -- format.
    OperationSummary -> Maybe POSIX
startedAt :: Prelude.Maybe Data.POSIX,
    -- | 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 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 Data.POSIX
  }
  deriving (OperationSummary -> OperationSummary -> Bool
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]
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
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. 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:
--
-- 'endedAt', 'operationSummary_endedAt' - The time when the operation ended. 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.
--
-- 'startedAt', 'operationSummary_startedAt' - The time when the operation started. It\'s in the Unix time stamp
-- format.
--
-- '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).
--
-- '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'
    { $sel:endedAt:OperationSummary' :: Maybe POSIX
endedAt = forall a. Maybe a
Prelude.Nothing,
      $sel:id:OperationSummary' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:startedAt:OperationSummary' :: Maybe POSIX
startedAt = forall a. Maybe a
Prelude.Nothing,
      $sel:status:OperationSummary' :: Maybe OperationStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:targetArn:OperationSummary' :: Maybe Text
targetArn = forall a. Maybe a
Prelude.Nothing,
      $sel:type':OperationSummary' :: Maybe OperationType
type' = forall a. Maybe a
Prelude.Nothing,
      $sel:updatedAt:OperationSummary' :: Maybe POSIX
updatedAt = forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: Lens' OperationSummary (Maybe UTCTime)
operationSummary_endedAt = 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) 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 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 :: Lens' OperationSummary (Maybe Text)
operationSummary_id = 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 time when the operation started. It\'s in the Unix time stamp
-- format.
operationSummary_startedAt :: Lens.Lens' OperationSummary (Prelude.Maybe Prelude.UTCTime)
operationSummary_startedAt :: Lens' OperationSummary (Maybe UTCTime)
operationSummary_startedAt = 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) 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

-- | The current state of the operation.
operationSummary_status :: Lens.Lens' OperationSummary (Prelude.Maybe OperationStatus)
operationSummary_status :: Lens' OperationSummary (Maybe OperationStatus)
operationSummary_status = 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 :: Lens' OperationSummary (Maybe Text)
operationSummary_targetArn = 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 type of operation. It indicates a specific action that occured.
operationSummary_type :: Lens.Lens' OperationSummary (Prelude.Maybe OperationType)
operationSummary_type :: Lens' OperationSummary (Maybe OperationType)
operationSummary_type = 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 :: Lens' OperationSummary (Maybe UTCTime)
operationSummary_updatedAt = 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) 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

instance Data.FromJSON OperationSummary where
  parseJSON :: Value -> Parser OperationSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"OperationSummary"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe OperationStatus
-> Maybe Text
-> Maybe OperationType
-> Maybe POSIX
-> OperationSummary
OperationSummary'
            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
"EndedAt")
            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
"Id")
            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
"StartedAt")
            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
"Status")
            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
"TargetArn")
            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
"Type")
            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
"UpdatedAt")
      )

instance Prelude.Hashable OperationSummary where
  hashWithSalt :: Int -> OperationSummary -> Int
hashWithSalt Int
_salt OperationSummary' {Maybe Text
Maybe POSIX
Maybe OperationStatus
Maybe OperationType
updatedAt :: Maybe POSIX
type' :: Maybe OperationType
targetArn :: Maybe Text
status :: Maybe OperationStatus
startedAt :: Maybe POSIX
id :: Maybe Text
endedAt :: Maybe POSIX
$sel:updatedAt:OperationSummary' :: OperationSummary -> Maybe POSIX
$sel:type':OperationSummary' :: OperationSummary -> Maybe OperationType
$sel:targetArn:OperationSummary' :: OperationSummary -> Maybe Text
$sel:status:OperationSummary' :: OperationSummary -> Maybe OperationStatus
$sel:startedAt:OperationSummary' :: OperationSummary -> Maybe POSIX
$sel:id:OperationSummary' :: OperationSummary -> Maybe Text
$sel:endedAt:OperationSummary' :: OperationSummary -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
endedAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
startedAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OperationStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
targetArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OperationType
type'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
updatedAt

instance Prelude.NFData OperationSummary where
  rnf :: OperationSummary -> ()
rnf OperationSummary' {Maybe Text
Maybe POSIX
Maybe OperationStatus
Maybe OperationType
updatedAt :: Maybe POSIX
type' :: Maybe OperationType
targetArn :: Maybe Text
status :: Maybe OperationStatus
startedAt :: Maybe POSIX
id :: Maybe Text
endedAt :: Maybe POSIX
$sel:updatedAt:OperationSummary' :: OperationSummary -> Maybe POSIX
$sel:type':OperationSummary' :: OperationSummary -> Maybe OperationType
$sel:targetArn:OperationSummary' :: OperationSummary -> Maybe Text
$sel:status:OperationSummary' :: OperationSummary -> Maybe OperationStatus
$sel:startedAt:OperationSummary' :: OperationSummary -> Maybe POSIX
$sel:id:OperationSummary' :: OperationSummary -> Maybe Text
$sel:endedAt:OperationSummary' :: OperationSummary -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
endedAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
startedAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe OperationStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
targetArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe OperationType
type'
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
updatedAt