{-# 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.EMR.Types.NotebookExecutionSummary
-- 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.EMR.Types.NotebookExecutionSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EMR.Types.NotebookExecutionStatus
import qualified Amazonka.Prelude as Prelude

-- | Details for a notebook execution. The details include information such
-- as the unique ID and status of the notebook execution.
--
-- /See:/ 'newNotebookExecutionSummary' smart constructor.
data NotebookExecutionSummary = NotebookExecutionSummary'
  { -- | The unique identifier of the editor associated with the notebook
    -- execution.
    NotebookExecutionSummary -> Maybe Text
editorId :: Prelude.Maybe Prelude.Text,
    -- | The timestamp when notebook execution started.
    NotebookExecutionSummary -> Maybe POSIX
endTime :: Prelude.Maybe Data.POSIX,
    -- | The unique identifier of the notebook execution.
    NotebookExecutionSummary -> Maybe Text
notebookExecutionId :: Prelude.Maybe Prelude.Text,
    -- | The name of the notebook execution.
    NotebookExecutionSummary -> Maybe Text
notebookExecutionName :: Prelude.Maybe Prelude.Text,
    -- | The timestamp when notebook execution started.
    NotebookExecutionSummary -> Maybe POSIX
startTime :: Prelude.Maybe Data.POSIX,
    -- | The status of the notebook execution.
    --
    -- -   @START_PENDING@ indicates that the cluster has received the
    --     execution request but execution has not begun.
    --
    -- -   @STARTING@ indicates that the execution is starting on the cluster.
    --
    -- -   @RUNNING@ indicates that the execution is being processed by the
    --     cluster.
    --
    -- -   @FINISHING@ indicates that execution processing is in the final
    --     stages.
    --
    -- -   @FINISHED@ indicates that the execution has completed without error.
    --
    -- -   @FAILING@ indicates that the execution is failing and will not
    --     finish successfully.
    --
    -- -   @FAILED@ indicates that the execution failed.
    --
    -- -   @STOP_PENDING@ indicates that the cluster has received a
    --     @StopNotebookExecution@ request and the stop is pending.
    --
    -- -   @STOPPING@ indicates that the cluster is in the process of stopping
    --     the execution as a result of a @StopNotebookExecution@ request.
    --
    -- -   @STOPPED@ indicates that the execution stopped because of a
    --     @StopNotebookExecution@ request.
    NotebookExecutionSummary -> Maybe NotebookExecutionStatus
status :: Prelude.Maybe NotebookExecutionStatus
  }
  deriving (NotebookExecutionSummary -> NotebookExecutionSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NotebookExecutionSummary -> NotebookExecutionSummary -> Bool
$c/= :: NotebookExecutionSummary -> NotebookExecutionSummary -> Bool
== :: NotebookExecutionSummary -> NotebookExecutionSummary -> Bool
$c== :: NotebookExecutionSummary -> NotebookExecutionSummary -> Bool
Prelude.Eq, ReadPrec [NotebookExecutionSummary]
ReadPrec NotebookExecutionSummary
Int -> ReadS NotebookExecutionSummary
ReadS [NotebookExecutionSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NotebookExecutionSummary]
$creadListPrec :: ReadPrec [NotebookExecutionSummary]
readPrec :: ReadPrec NotebookExecutionSummary
$creadPrec :: ReadPrec NotebookExecutionSummary
readList :: ReadS [NotebookExecutionSummary]
$creadList :: ReadS [NotebookExecutionSummary]
readsPrec :: Int -> ReadS NotebookExecutionSummary
$creadsPrec :: Int -> ReadS NotebookExecutionSummary
Prelude.Read, Int -> NotebookExecutionSummary -> ShowS
[NotebookExecutionSummary] -> ShowS
NotebookExecutionSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NotebookExecutionSummary] -> ShowS
$cshowList :: [NotebookExecutionSummary] -> ShowS
show :: NotebookExecutionSummary -> String
$cshow :: NotebookExecutionSummary -> String
showsPrec :: Int -> NotebookExecutionSummary -> ShowS
$cshowsPrec :: Int -> NotebookExecutionSummary -> ShowS
Prelude.Show, forall x.
Rep NotebookExecutionSummary x -> NotebookExecutionSummary
forall x.
NotebookExecutionSummary -> Rep NotebookExecutionSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep NotebookExecutionSummary x -> NotebookExecutionSummary
$cfrom :: forall x.
NotebookExecutionSummary -> Rep NotebookExecutionSummary x
Prelude.Generic)

-- |
-- Create a value of 'NotebookExecutionSummary' 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:
--
-- 'editorId', 'notebookExecutionSummary_editorId' - The unique identifier of the editor associated with the notebook
-- execution.
--
-- 'endTime', 'notebookExecutionSummary_endTime' - The timestamp when notebook execution started.
--
-- 'notebookExecutionId', 'notebookExecutionSummary_notebookExecutionId' - The unique identifier of the notebook execution.
--
-- 'notebookExecutionName', 'notebookExecutionSummary_notebookExecutionName' - The name of the notebook execution.
--
-- 'startTime', 'notebookExecutionSummary_startTime' - The timestamp when notebook execution started.
--
-- 'status', 'notebookExecutionSummary_status' - The status of the notebook execution.
--
-- -   @START_PENDING@ indicates that the cluster has received the
--     execution request but execution has not begun.
--
-- -   @STARTING@ indicates that the execution is starting on the cluster.
--
-- -   @RUNNING@ indicates that the execution is being processed by the
--     cluster.
--
-- -   @FINISHING@ indicates that execution processing is in the final
--     stages.
--
-- -   @FINISHED@ indicates that the execution has completed without error.
--
-- -   @FAILING@ indicates that the execution is failing and will not
--     finish successfully.
--
-- -   @FAILED@ indicates that the execution failed.
--
-- -   @STOP_PENDING@ indicates that the cluster has received a
--     @StopNotebookExecution@ request and the stop is pending.
--
-- -   @STOPPING@ indicates that the cluster is in the process of stopping
--     the execution as a result of a @StopNotebookExecution@ request.
--
-- -   @STOPPED@ indicates that the execution stopped because of a
--     @StopNotebookExecution@ request.
newNotebookExecutionSummary ::
  NotebookExecutionSummary
newNotebookExecutionSummary :: NotebookExecutionSummary
newNotebookExecutionSummary =
  NotebookExecutionSummary'
    { $sel:editorId:NotebookExecutionSummary' :: Maybe Text
editorId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:endTime:NotebookExecutionSummary' :: Maybe POSIX
endTime = forall a. Maybe a
Prelude.Nothing,
      $sel:notebookExecutionId:NotebookExecutionSummary' :: Maybe Text
notebookExecutionId = forall a. Maybe a
Prelude.Nothing,
      $sel:notebookExecutionName:NotebookExecutionSummary' :: Maybe Text
notebookExecutionName = forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:NotebookExecutionSummary' :: Maybe POSIX
startTime = forall a. Maybe a
Prelude.Nothing,
      $sel:status:NotebookExecutionSummary' :: Maybe NotebookExecutionStatus
status = forall a. Maybe a
Prelude.Nothing
    }

-- | The unique identifier of the editor associated with the notebook
-- execution.
notebookExecutionSummary_editorId :: Lens.Lens' NotebookExecutionSummary (Prelude.Maybe Prelude.Text)
notebookExecutionSummary_editorId :: Lens' NotebookExecutionSummary (Maybe Text)
notebookExecutionSummary_editorId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotebookExecutionSummary' {Maybe Text
editorId :: Maybe Text
$sel:editorId:NotebookExecutionSummary' :: NotebookExecutionSummary -> Maybe Text
editorId} -> Maybe Text
editorId) (\s :: NotebookExecutionSummary
s@NotebookExecutionSummary' {} Maybe Text
a -> NotebookExecutionSummary
s {$sel:editorId:NotebookExecutionSummary' :: Maybe Text
editorId = Maybe Text
a} :: NotebookExecutionSummary)

-- | The timestamp when notebook execution started.
notebookExecutionSummary_endTime :: Lens.Lens' NotebookExecutionSummary (Prelude.Maybe Prelude.UTCTime)
notebookExecutionSummary_endTime :: Lens' NotebookExecutionSummary (Maybe UTCTime)
notebookExecutionSummary_endTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotebookExecutionSummary' {Maybe POSIX
endTime :: Maybe POSIX
$sel:endTime:NotebookExecutionSummary' :: NotebookExecutionSummary -> Maybe POSIX
endTime} -> Maybe POSIX
endTime) (\s :: NotebookExecutionSummary
s@NotebookExecutionSummary' {} Maybe POSIX
a -> NotebookExecutionSummary
s {$sel:endTime:NotebookExecutionSummary' :: Maybe POSIX
endTime = Maybe POSIX
a} :: NotebookExecutionSummary) 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 unique identifier of the notebook execution.
notebookExecutionSummary_notebookExecutionId :: Lens.Lens' NotebookExecutionSummary (Prelude.Maybe Prelude.Text)
notebookExecutionSummary_notebookExecutionId :: Lens' NotebookExecutionSummary (Maybe Text)
notebookExecutionSummary_notebookExecutionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotebookExecutionSummary' {Maybe Text
notebookExecutionId :: Maybe Text
$sel:notebookExecutionId:NotebookExecutionSummary' :: NotebookExecutionSummary -> Maybe Text
notebookExecutionId} -> Maybe Text
notebookExecutionId) (\s :: NotebookExecutionSummary
s@NotebookExecutionSummary' {} Maybe Text
a -> NotebookExecutionSummary
s {$sel:notebookExecutionId:NotebookExecutionSummary' :: Maybe Text
notebookExecutionId = Maybe Text
a} :: NotebookExecutionSummary)

-- | The name of the notebook execution.
notebookExecutionSummary_notebookExecutionName :: Lens.Lens' NotebookExecutionSummary (Prelude.Maybe Prelude.Text)
notebookExecutionSummary_notebookExecutionName :: Lens' NotebookExecutionSummary (Maybe Text)
notebookExecutionSummary_notebookExecutionName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotebookExecutionSummary' {Maybe Text
notebookExecutionName :: Maybe Text
$sel:notebookExecutionName:NotebookExecutionSummary' :: NotebookExecutionSummary -> Maybe Text
notebookExecutionName} -> Maybe Text
notebookExecutionName) (\s :: NotebookExecutionSummary
s@NotebookExecutionSummary' {} Maybe Text
a -> NotebookExecutionSummary
s {$sel:notebookExecutionName:NotebookExecutionSummary' :: Maybe Text
notebookExecutionName = Maybe Text
a} :: NotebookExecutionSummary)

-- | The timestamp when notebook execution started.
notebookExecutionSummary_startTime :: Lens.Lens' NotebookExecutionSummary (Prelude.Maybe Prelude.UTCTime)
notebookExecutionSummary_startTime :: Lens' NotebookExecutionSummary (Maybe UTCTime)
notebookExecutionSummary_startTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotebookExecutionSummary' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:NotebookExecutionSummary' :: NotebookExecutionSummary -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: NotebookExecutionSummary
s@NotebookExecutionSummary' {} Maybe POSIX
a -> NotebookExecutionSummary
s {$sel:startTime:NotebookExecutionSummary' :: Maybe POSIX
startTime = Maybe POSIX
a} :: NotebookExecutionSummary) 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 status of the notebook execution.
--
-- -   @START_PENDING@ indicates that the cluster has received the
--     execution request but execution has not begun.
--
-- -   @STARTING@ indicates that the execution is starting on the cluster.
--
-- -   @RUNNING@ indicates that the execution is being processed by the
--     cluster.
--
-- -   @FINISHING@ indicates that execution processing is in the final
--     stages.
--
-- -   @FINISHED@ indicates that the execution has completed without error.
--
-- -   @FAILING@ indicates that the execution is failing and will not
--     finish successfully.
--
-- -   @FAILED@ indicates that the execution failed.
--
-- -   @STOP_PENDING@ indicates that the cluster has received a
--     @StopNotebookExecution@ request and the stop is pending.
--
-- -   @STOPPING@ indicates that the cluster is in the process of stopping
--     the execution as a result of a @StopNotebookExecution@ request.
--
-- -   @STOPPED@ indicates that the execution stopped because of a
--     @StopNotebookExecution@ request.
notebookExecutionSummary_status :: Lens.Lens' NotebookExecutionSummary (Prelude.Maybe NotebookExecutionStatus)
notebookExecutionSummary_status :: Lens' NotebookExecutionSummary (Maybe NotebookExecutionStatus)
notebookExecutionSummary_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotebookExecutionSummary' {Maybe NotebookExecutionStatus
status :: Maybe NotebookExecutionStatus
$sel:status:NotebookExecutionSummary' :: NotebookExecutionSummary -> Maybe NotebookExecutionStatus
status} -> Maybe NotebookExecutionStatus
status) (\s :: NotebookExecutionSummary
s@NotebookExecutionSummary' {} Maybe NotebookExecutionStatus
a -> NotebookExecutionSummary
s {$sel:status:NotebookExecutionSummary' :: Maybe NotebookExecutionStatus
status = Maybe NotebookExecutionStatus
a} :: NotebookExecutionSummary)

instance Data.FromJSON NotebookExecutionSummary where
  parseJSON :: Value -> Parser NotebookExecutionSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"NotebookExecutionSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe NotebookExecutionStatus
-> NotebookExecutionSummary
NotebookExecutionSummary'
            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
"EditorId")
            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
"EndTime")
            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
"NotebookExecutionId")
            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
"NotebookExecutionName")
            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
"StartTime")
            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")
      )

instance Prelude.Hashable NotebookExecutionSummary where
  hashWithSalt :: Int -> NotebookExecutionSummary -> Int
hashWithSalt Int
_salt NotebookExecutionSummary' {Maybe Text
Maybe POSIX
Maybe NotebookExecutionStatus
status :: Maybe NotebookExecutionStatus
startTime :: Maybe POSIX
notebookExecutionName :: Maybe Text
notebookExecutionId :: Maybe Text
endTime :: Maybe POSIX
editorId :: Maybe Text
$sel:status:NotebookExecutionSummary' :: NotebookExecutionSummary -> Maybe NotebookExecutionStatus
$sel:startTime:NotebookExecutionSummary' :: NotebookExecutionSummary -> Maybe POSIX
$sel:notebookExecutionName:NotebookExecutionSummary' :: NotebookExecutionSummary -> Maybe Text
$sel:notebookExecutionId:NotebookExecutionSummary' :: NotebookExecutionSummary -> Maybe Text
$sel:endTime:NotebookExecutionSummary' :: NotebookExecutionSummary -> Maybe POSIX
$sel:editorId:NotebookExecutionSummary' :: NotebookExecutionSummary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
editorId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
endTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
notebookExecutionId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
notebookExecutionName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
startTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NotebookExecutionStatus
status

instance Prelude.NFData NotebookExecutionSummary where
  rnf :: NotebookExecutionSummary -> ()
rnf NotebookExecutionSummary' {Maybe Text
Maybe POSIX
Maybe NotebookExecutionStatus
status :: Maybe NotebookExecutionStatus
startTime :: Maybe POSIX
notebookExecutionName :: Maybe Text
notebookExecutionId :: Maybe Text
endTime :: Maybe POSIX
editorId :: Maybe Text
$sel:status:NotebookExecutionSummary' :: NotebookExecutionSummary -> Maybe NotebookExecutionStatus
$sel:startTime:NotebookExecutionSummary' :: NotebookExecutionSummary -> Maybe POSIX
$sel:notebookExecutionName:NotebookExecutionSummary' :: NotebookExecutionSummary -> Maybe Text
$sel:notebookExecutionId:NotebookExecutionSummary' :: NotebookExecutionSummary -> Maybe Text
$sel:endTime:NotebookExecutionSummary' :: NotebookExecutionSummary -> Maybe POSIX
$sel:editorId:NotebookExecutionSummary' :: NotebookExecutionSummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
editorId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
endTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
notebookExecutionId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
notebookExecutionName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
startTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe NotebookExecutionStatus
status