{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.ListNotebookExecutions
-- 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)
--
-- Provides summaries of all notebook executions. You can filter the list
-- based on multiple criteria such as status, time range, and editor id.
-- Returns a maximum of 50 notebook executions and a marker to track the
-- paging of a longer notebook execution list across multiple
-- @ListNotebookExecution@ calls.
--
-- This operation returns paginated results.
module Amazonka.EMR.ListNotebookExecutions
  ( -- * Creating a Request
    ListNotebookExecutions (..),
    newListNotebookExecutions,

    -- * Request Lenses
    listNotebookExecutions_status,
    listNotebookExecutions_editorId,
    listNotebookExecutions_to,
    listNotebookExecutions_from,
    listNotebookExecutions_marker,

    -- * Destructuring the Response
    ListNotebookExecutionsResponse (..),
    newListNotebookExecutionsResponse,

    -- * Response Lenses
    listNotebookExecutionsResponse_notebookExecutions,
    listNotebookExecutionsResponse_marker,
    listNotebookExecutionsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.EMR.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newListNotebookExecutions' smart constructor.
data ListNotebookExecutions = ListNotebookExecutions'
  { -- | The status filter for listing notebook executions.
    --
    -- -   @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.
    ListNotebookExecutions -> Maybe NotebookExecutionStatus
status :: Prelude.Maybe NotebookExecutionStatus,
    -- | The unique ID of the editor associated with the notebook execution.
    ListNotebookExecutions -> Maybe Text
editorId :: Prelude.Maybe Prelude.Text,
    -- | The end of time range filter for listing notebook executions. The
    -- default is the current timestamp.
    ListNotebookExecutions -> Maybe POSIX
to :: Prelude.Maybe Core.POSIX,
    -- | The beginning of time range filter for listing notebook executions. The
    -- default is the timestamp of 30 days ago.
    ListNotebookExecutions -> Maybe POSIX
from :: Prelude.Maybe Core.POSIX,
    -- | The pagination token, returned by a previous @ListNotebookExecutions@
    -- call, that indicates the start of the list for this
    -- @ListNotebookExecutions@ call.
    ListNotebookExecutions -> Maybe Text
marker :: Prelude.Maybe Prelude.Text
  }
  deriving (ListNotebookExecutions -> ListNotebookExecutions -> Bool
(ListNotebookExecutions -> ListNotebookExecutions -> Bool)
-> (ListNotebookExecutions -> ListNotebookExecutions -> Bool)
-> Eq ListNotebookExecutions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListNotebookExecutions -> ListNotebookExecutions -> Bool
$c/= :: ListNotebookExecutions -> ListNotebookExecutions -> Bool
== :: ListNotebookExecutions -> ListNotebookExecutions -> Bool
$c== :: ListNotebookExecutions -> ListNotebookExecutions -> Bool
Prelude.Eq, ReadPrec [ListNotebookExecutions]
ReadPrec ListNotebookExecutions
Int -> ReadS ListNotebookExecutions
ReadS [ListNotebookExecutions]
(Int -> ReadS ListNotebookExecutions)
-> ReadS [ListNotebookExecutions]
-> ReadPrec ListNotebookExecutions
-> ReadPrec [ListNotebookExecutions]
-> Read ListNotebookExecutions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListNotebookExecutions]
$creadListPrec :: ReadPrec [ListNotebookExecutions]
readPrec :: ReadPrec ListNotebookExecutions
$creadPrec :: ReadPrec ListNotebookExecutions
readList :: ReadS [ListNotebookExecutions]
$creadList :: ReadS [ListNotebookExecutions]
readsPrec :: Int -> ReadS ListNotebookExecutions
$creadsPrec :: Int -> ReadS ListNotebookExecutions
Prelude.Read, Int -> ListNotebookExecutions -> ShowS
[ListNotebookExecutions] -> ShowS
ListNotebookExecutions -> String
(Int -> ListNotebookExecutions -> ShowS)
-> (ListNotebookExecutions -> String)
-> ([ListNotebookExecutions] -> ShowS)
-> Show ListNotebookExecutions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListNotebookExecutions] -> ShowS
$cshowList :: [ListNotebookExecutions] -> ShowS
show :: ListNotebookExecutions -> String
$cshow :: ListNotebookExecutions -> String
showsPrec :: Int -> ListNotebookExecutions -> ShowS
$cshowsPrec :: Int -> ListNotebookExecutions -> ShowS
Prelude.Show, (forall x. ListNotebookExecutions -> Rep ListNotebookExecutions x)
-> (forall x.
    Rep ListNotebookExecutions x -> ListNotebookExecutions)
-> Generic ListNotebookExecutions
forall x. Rep ListNotebookExecutions x -> ListNotebookExecutions
forall x. ListNotebookExecutions -> Rep ListNotebookExecutions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListNotebookExecutions x -> ListNotebookExecutions
$cfrom :: forall x. ListNotebookExecutions -> Rep ListNotebookExecutions x
Prelude.Generic)

-- |
-- Create a value of 'ListNotebookExecutions' 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', 'listNotebookExecutions_status' - The status filter for listing notebook executions.
--
-- -   @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.
--
-- 'editorId', 'listNotebookExecutions_editorId' - The unique ID of the editor associated with the notebook execution.
--
-- 'to', 'listNotebookExecutions_to' - The end of time range filter for listing notebook executions. The
-- default is the current timestamp.
--
-- 'from', 'listNotebookExecutions_from' - The beginning of time range filter for listing notebook executions. The
-- default is the timestamp of 30 days ago.
--
-- 'marker', 'listNotebookExecutions_marker' - The pagination token, returned by a previous @ListNotebookExecutions@
-- call, that indicates the start of the list for this
-- @ListNotebookExecutions@ call.
newListNotebookExecutions ::
  ListNotebookExecutions
newListNotebookExecutions :: ListNotebookExecutions
newListNotebookExecutions =
  ListNotebookExecutions' :: Maybe NotebookExecutionStatus
-> Maybe Text
-> Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> ListNotebookExecutions
ListNotebookExecutions'
    { $sel:status:ListNotebookExecutions' :: Maybe NotebookExecutionStatus
status = Maybe NotebookExecutionStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:editorId:ListNotebookExecutions' :: Maybe Text
editorId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:to:ListNotebookExecutions' :: Maybe POSIX
to = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:from:ListNotebookExecutions' :: Maybe POSIX
from = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:ListNotebookExecutions' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The status filter for listing notebook executions.
--
-- -   @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.
listNotebookExecutions_status :: Lens.Lens' ListNotebookExecutions (Prelude.Maybe NotebookExecutionStatus)
listNotebookExecutions_status :: (Maybe NotebookExecutionStatus
 -> f (Maybe NotebookExecutionStatus))
-> ListNotebookExecutions -> f ListNotebookExecutions
listNotebookExecutions_status = (ListNotebookExecutions -> Maybe NotebookExecutionStatus)
-> (ListNotebookExecutions
    -> Maybe NotebookExecutionStatus -> ListNotebookExecutions)
-> Lens
     ListNotebookExecutions
     ListNotebookExecutions
     (Maybe NotebookExecutionStatus)
     (Maybe NotebookExecutionStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNotebookExecutions' {Maybe NotebookExecutionStatus
status :: Maybe NotebookExecutionStatus
$sel:status:ListNotebookExecutions' :: ListNotebookExecutions -> Maybe NotebookExecutionStatus
status} -> Maybe NotebookExecutionStatus
status) (\s :: ListNotebookExecutions
s@ListNotebookExecutions' {} Maybe NotebookExecutionStatus
a -> ListNotebookExecutions
s {$sel:status:ListNotebookExecutions' :: Maybe NotebookExecutionStatus
status = Maybe NotebookExecutionStatus
a} :: ListNotebookExecutions)

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

-- | The end of time range filter for listing notebook executions. The
-- default is the current timestamp.
listNotebookExecutions_to :: Lens.Lens' ListNotebookExecutions (Prelude.Maybe Prelude.UTCTime)
listNotebookExecutions_to :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListNotebookExecutions -> f ListNotebookExecutions
listNotebookExecutions_to = (ListNotebookExecutions -> Maybe POSIX)
-> (ListNotebookExecutions
    -> Maybe POSIX -> ListNotebookExecutions)
-> Lens
     ListNotebookExecutions
     ListNotebookExecutions
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNotebookExecutions' {Maybe POSIX
to :: Maybe POSIX
$sel:to:ListNotebookExecutions' :: ListNotebookExecutions -> Maybe POSIX
to} -> Maybe POSIX
to) (\s :: ListNotebookExecutions
s@ListNotebookExecutions' {} Maybe POSIX
a -> ListNotebookExecutions
s {$sel:to:ListNotebookExecutions' :: Maybe POSIX
to = Maybe POSIX
a} :: ListNotebookExecutions) ((Maybe POSIX -> f (Maybe POSIX))
 -> ListNotebookExecutions -> f ListNotebookExecutions)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListNotebookExecutions
-> f ListNotebookExecutions
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 beginning of time range filter for listing notebook executions. The
-- default is the timestamp of 30 days ago.
listNotebookExecutions_from :: Lens.Lens' ListNotebookExecutions (Prelude.Maybe Prelude.UTCTime)
listNotebookExecutions_from :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListNotebookExecutions -> f ListNotebookExecutions
listNotebookExecutions_from = (ListNotebookExecutions -> Maybe POSIX)
-> (ListNotebookExecutions
    -> Maybe POSIX -> ListNotebookExecutions)
-> Lens
     ListNotebookExecutions
     ListNotebookExecutions
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNotebookExecutions' {Maybe POSIX
from :: Maybe POSIX
$sel:from:ListNotebookExecutions' :: ListNotebookExecutions -> Maybe POSIX
from} -> Maybe POSIX
from) (\s :: ListNotebookExecutions
s@ListNotebookExecutions' {} Maybe POSIX
a -> ListNotebookExecutions
s {$sel:from:ListNotebookExecutions' :: Maybe POSIX
from = Maybe POSIX
a} :: ListNotebookExecutions) ((Maybe POSIX -> f (Maybe POSIX))
 -> ListNotebookExecutions -> f ListNotebookExecutions)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListNotebookExecutions
-> f ListNotebookExecutions
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 pagination token, returned by a previous @ListNotebookExecutions@
-- call, that indicates the start of the list for this
-- @ListNotebookExecutions@ call.
listNotebookExecutions_marker :: Lens.Lens' ListNotebookExecutions (Prelude.Maybe Prelude.Text)
listNotebookExecutions_marker :: (Maybe Text -> f (Maybe Text))
-> ListNotebookExecutions -> f ListNotebookExecutions
listNotebookExecutions_marker = (ListNotebookExecutions -> Maybe Text)
-> (ListNotebookExecutions -> Maybe Text -> ListNotebookExecutions)
-> Lens
     ListNotebookExecutions
     ListNotebookExecutions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNotebookExecutions' {Maybe Text
marker :: Maybe Text
$sel:marker:ListNotebookExecutions' :: ListNotebookExecutions -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListNotebookExecutions
s@ListNotebookExecutions' {} Maybe Text
a -> ListNotebookExecutions
s {$sel:marker:ListNotebookExecutions' :: Maybe Text
marker = Maybe Text
a} :: ListNotebookExecutions)

instance Core.AWSPager ListNotebookExecutions where
  page :: ListNotebookExecutions
-> AWSResponse ListNotebookExecutions
-> Maybe ListNotebookExecutions
page ListNotebookExecutions
rq AWSResponse ListNotebookExecutions
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListNotebookExecutions
ListNotebookExecutionsResponse
rs
            ListNotebookExecutionsResponse
-> Getting (First Text) ListNotebookExecutionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListNotebookExecutionsResponse
-> Const (First Text) ListNotebookExecutionsResponse
Lens' ListNotebookExecutionsResponse (Maybe Text)
listNotebookExecutionsResponse_marker
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListNotebookExecutionsResponse
 -> Const (First Text) ListNotebookExecutionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListNotebookExecutionsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListNotebookExecutions
forall a. Maybe a
Prelude.Nothing
    | Maybe [NotebookExecutionSummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListNotebookExecutions
ListNotebookExecutionsResponse
rs
            ListNotebookExecutionsResponse
-> Getting
     (First [NotebookExecutionSummary])
     ListNotebookExecutionsResponse
     [NotebookExecutionSummary]
-> Maybe [NotebookExecutionSummary]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [NotebookExecutionSummary]
 -> Const
      (First [NotebookExecutionSummary])
      (Maybe [NotebookExecutionSummary]))
-> ListNotebookExecutionsResponse
-> Const
     (First [NotebookExecutionSummary]) ListNotebookExecutionsResponse
Lens'
  ListNotebookExecutionsResponse (Maybe [NotebookExecutionSummary])
listNotebookExecutionsResponse_notebookExecutions
              ((Maybe [NotebookExecutionSummary]
  -> Const
       (First [NotebookExecutionSummary])
       (Maybe [NotebookExecutionSummary]))
 -> ListNotebookExecutionsResponse
 -> Const
      (First [NotebookExecutionSummary]) ListNotebookExecutionsResponse)
-> (([NotebookExecutionSummary]
     -> Const
          (First [NotebookExecutionSummary]) [NotebookExecutionSummary])
    -> Maybe [NotebookExecutionSummary]
    -> Const
         (First [NotebookExecutionSummary])
         (Maybe [NotebookExecutionSummary]))
-> Getting
     (First [NotebookExecutionSummary])
     ListNotebookExecutionsResponse
     [NotebookExecutionSummary]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([NotebookExecutionSummary]
 -> Const
      (First [NotebookExecutionSummary]) [NotebookExecutionSummary])
-> Maybe [NotebookExecutionSummary]
-> Const
     (First [NotebookExecutionSummary])
     (Maybe [NotebookExecutionSummary])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListNotebookExecutions
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListNotebookExecutions -> Maybe ListNotebookExecutions
forall a. a -> Maybe a
Prelude.Just (ListNotebookExecutions -> Maybe ListNotebookExecutions)
-> ListNotebookExecutions -> Maybe ListNotebookExecutions
forall a b. (a -> b) -> a -> b
Prelude.$
        ListNotebookExecutions
rq
          ListNotebookExecutions
-> (ListNotebookExecutions -> ListNotebookExecutions)
-> ListNotebookExecutions
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListNotebookExecutions -> Identity ListNotebookExecutions
Lens
  ListNotebookExecutions
  ListNotebookExecutions
  (Maybe Text)
  (Maybe Text)
listNotebookExecutions_marker
          ((Maybe Text -> Identity (Maybe Text))
 -> ListNotebookExecutions -> Identity ListNotebookExecutions)
-> Maybe Text -> ListNotebookExecutions -> ListNotebookExecutions
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListNotebookExecutions
ListNotebookExecutionsResponse
rs
          ListNotebookExecutionsResponse
-> Getting (First Text) ListNotebookExecutionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListNotebookExecutionsResponse
-> Const (First Text) ListNotebookExecutionsResponse
Lens' ListNotebookExecutionsResponse (Maybe Text)
listNotebookExecutionsResponse_marker
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListNotebookExecutionsResponse
 -> Const (First Text) ListNotebookExecutionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListNotebookExecutionsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListNotebookExecutions where
  type
    AWSResponse ListNotebookExecutions =
      ListNotebookExecutionsResponse
  request :: ListNotebookExecutions -> Request ListNotebookExecutions
request = Service -> ListNotebookExecutions -> Request ListNotebookExecutions
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListNotebookExecutions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListNotebookExecutions)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListNotebookExecutions))
-> Logger
-> Service
-> Proxy ListNotebookExecutions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListNotebookExecutions)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [NotebookExecutionSummary]
-> Maybe Text -> Int -> ListNotebookExecutionsResponse
ListNotebookExecutionsResponse'
            (Maybe [NotebookExecutionSummary]
 -> Maybe Text -> Int -> ListNotebookExecutionsResponse)
-> Either String (Maybe [NotebookExecutionSummary])
-> Either
     String (Maybe Text -> Int -> ListNotebookExecutionsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text -> Either String (Maybe (Maybe [NotebookExecutionSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NotebookExecutions"
                            Either String (Maybe (Maybe [NotebookExecutionSummary]))
-> Maybe [NotebookExecutionSummary]
-> Either String (Maybe [NotebookExecutionSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [NotebookExecutionSummary]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Maybe Text -> Int -> ListNotebookExecutionsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListNotebookExecutionsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Marker")
            Either String (Int -> ListNotebookExecutionsResponse)
-> Either String Int
-> Either String ListNotebookExecutionsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListNotebookExecutions

instance Prelude.NFData ListNotebookExecutions

instance Core.ToHeaders ListNotebookExecutions where
  toHeaders :: ListNotebookExecutions -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListNotebookExecutions -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"ElasticMapReduce.ListNotebookExecutions" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON ListNotebookExecutions where
  toJSON :: ListNotebookExecutions -> Value
toJSON ListNotebookExecutions' {Maybe Text
Maybe POSIX
Maybe NotebookExecutionStatus
marker :: Maybe Text
from :: Maybe POSIX
to :: Maybe POSIX
editorId :: Maybe Text
status :: Maybe NotebookExecutionStatus
$sel:marker:ListNotebookExecutions' :: ListNotebookExecutions -> Maybe Text
$sel:from:ListNotebookExecutions' :: ListNotebookExecutions -> Maybe POSIX
$sel:to:ListNotebookExecutions' :: ListNotebookExecutions -> Maybe POSIX
$sel:editorId:ListNotebookExecutions' :: ListNotebookExecutions -> Maybe Text
$sel:status:ListNotebookExecutions' :: ListNotebookExecutions -> Maybe NotebookExecutionStatus
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Status" Text -> NotebookExecutionStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NotebookExecutionStatus -> Pair)
-> Maybe NotebookExecutionStatus -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe NotebookExecutionStatus
status,
            (Text
"EditorId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
editorId,
            (Text
"To" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
to,
            (Text
"From" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
from,
            (Text
"Marker" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
marker
          ]
      )

instance Core.ToPath ListNotebookExecutions where
  toPath :: ListNotebookExecutions -> ByteString
toPath = ByteString -> ListNotebookExecutions -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery ListNotebookExecutions where
  toQuery :: ListNotebookExecutions -> QueryString
toQuery = QueryString -> ListNotebookExecutions -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newListNotebookExecutionsResponse' smart constructor.
data ListNotebookExecutionsResponse = ListNotebookExecutionsResponse'
  { -- | A list of notebook executions.
    ListNotebookExecutionsResponse -> Maybe [NotebookExecutionSummary]
notebookExecutions :: Prelude.Maybe [NotebookExecutionSummary],
    -- | A pagination token that a subsequent @ListNotebookExecutions@ can use to
    -- determine the next set of results to retrieve.
    ListNotebookExecutionsResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListNotebookExecutionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListNotebookExecutionsResponse
-> ListNotebookExecutionsResponse -> Bool
(ListNotebookExecutionsResponse
 -> ListNotebookExecutionsResponse -> Bool)
-> (ListNotebookExecutionsResponse
    -> ListNotebookExecutionsResponse -> Bool)
-> Eq ListNotebookExecutionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListNotebookExecutionsResponse
-> ListNotebookExecutionsResponse -> Bool
$c/= :: ListNotebookExecutionsResponse
-> ListNotebookExecutionsResponse -> Bool
== :: ListNotebookExecutionsResponse
-> ListNotebookExecutionsResponse -> Bool
$c== :: ListNotebookExecutionsResponse
-> ListNotebookExecutionsResponse -> Bool
Prelude.Eq, ReadPrec [ListNotebookExecutionsResponse]
ReadPrec ListNotebookExecutionsResponse
Int -> ReadS ListNotebookExecutionsResponse
ReadS [ListNotebookExecutionsResponse]
(Int -> ReadS ListNotebookExecutionsResponse)
-> ReadS [ListNotebookExecutionsResponse]
-> ReadPrec ListNotebookExecutionsResponse
-> ReadPrec [ListNotebookExecutionsResponse]
-> Read ListNotebookExecutionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListNotebookExecutionsResponse]
$creadListPrec :: ReadPrec [ListNotebookExecutionsResponse]
readPrec :: ReadPrec ListNotebookExecutionsResponse
$creadPrec :: ReadPrec ListNotebookExecutionsResponse
readList :: ReadS [ListNotebookExecutionsResponse]
$creadList :: ReadS [ListNotebookExecutionsResponse]
readsPrec :: Int -> ReadS ListNotebookExecutionsResponse
$creadsPrec :: Int -> ReadS ListNotebookExecutionsResponse
Prelude.Read, Int -> ListNotebookExecutionsResponse -> ShowS
[ListNotebookExecutionsResponse] -> ShowS
ListNotebookExecutionsResponse -> String
(Int -> ListNotebookExecutionsResponse -> ShowS)
-> (ListNotebookExecutionsResponse -> String)
-> ([ListNotebookExecutionsResponse] -> ShowS)
-> Show ListNotebookExecutionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListNotebookExecutionsResponse] -> ShowS
$cshowList :: [ListNotebookExecutionsResponse] -> ShowS
show :: ListNotebookExecutionsResponse -> String
$cshow :: ListNotebookExecutionsResponse -> String
showsPrec :: Int -> ListNotebookExecutionsResponse -> ShowS
$cshowsPrec :: Int -> ListNotebookExecutionsResponse -> ShowS
Prelude.Show, (forall x.
 ListNotebookExecutionsResponse
 -> Rep ListNotebookExecutionsResponse x)
-> (forall x.
    Rep ListNotebookExecutionsResponse x
    -> ListNotebookExecutionsResponse)
-> Generic ListNotebookExecutionsResponse
forall x.
Rep ListNotebookExecutionsResponse x
-> ListNotebookExecutionsResponse
forall x.
ListNotebookExecutionsResponse
-> Rep ListNotebookExecutionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListNotebookExecutionsResponse x
-> ListNotebookExecutionsResponse
$cfrom :: forall x.
ListNotebookExecutionsResponse
-> Rep ListNotebookExecutionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListNotebookExecutionsResponse' 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:
--
-- 'notebookExecutions', 'listNotebookExecutionsResponse_notebookExecutions' - A list of notebook executions.
--
-- 'marker', 'listNotebookExecutionsResponse_marker' - A pagination token that a subsequent @ListNotebookExecutions@ can use to
-- determine the next set of results to retrieve.
--
-- 'httpStatus', 'listNotebookExecutionsResponse_httpStatus' - The response's http status code.
newListNotebookExecutionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListNotebookExecutionsResponse
newListNotebookExecutionsResponse :: Int -> ListNotebookExecutionsResponse
newListNotebookExecutionsResponse Int
pHttpStatus_ =
  ListNotebookExecutionsResponse' :: Maybe [NotebookExecutionSummary]
-> Maybe Text -> Int -> ListNotebookExecutionsResponse
ListNotebookExecutionsResponse'
    { $sel:notebookExecutions:ListNotebookExecutionsResponse' :: Maybe [NotebookExecutionSummary]
notebookExecutions =
        Maybe [NotebookExecutionSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:ListNotebookExecutionsResponse' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListNotebookExecutionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of notebook executions.
listNotebookExecutionsResponse_notebookExecutions :: Lens.Lens' ListNotebookExecutionsResponse (Prelude.Maybe [NotebookExecutionSummary])
listNotebookExecutionsResponse_notebookExecutions :: (Maybe [NotebookExecutionSummary]
 -> f (Maybe [NotebookExecutionSummary]))
-> ListNotebookExecutionsResponse
-> f ListNotebookExecutionsResponse
listNotebookExecutionsResponse_notebookExecutions = (ListNotebookExecutionsResponse
 -> Maybe [NotebookExecutionSummary])
-> (ListNotebookExecutionsResponse
    -> Maybe [NotebookExecutionSummary]
    -> ListNotebookExecutionsResponse)
-> Lens'
     ListNotebookExecutionsResponse (Maybe [NotebookExecutionSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNotebookExecutionsResponse' {Maybe [NotebookExecutionSummary]
notebookExecutions :: Maybe [NotebookExecutionSummary]
$sel:notebookExecutions:ListNotebookExecutionsResponse' :: ListNotebookExecutionsResponse -> Maybe [NotebookExecutionSummary]
notebookExecutions} -> Maybe [NotebookExecutionSummary]
notebookExecutions) (\s :: ListNotebookExecutionsResponse
s@ListNotebookExecutionsResponse' {} Maybe [NotebookExecutionSummary]
a -> ListNotebookExecutionsResponse
s {$sel:notebookExecutions:ListNotebookExecutionsResponse' :: Maybe [NotebookExecutionSummary]
notebookExecutions = Maybe [NotebookExecutionSummary]
a} :: ListNotebookExecutionsResponse) ((Maybe [NotebookExecutionSummary]
  -> f (Maybe [NotebookExecutionSummary]))
 -> ListNotebookExecutionsResponse
 -> f ListNotebookExecutionsResponse)
-> ((Maybe [NotebookExecutionSummary]
     -> f (Maybe [NotebookExecutionSummary]))
    -> Maybe [NotebookExecutionSummary]
    -> f (Maybe [NotebookExecutionSummary]))
-> (Maybe [NotebookExecutionSummary]
    -> f (Maybe [NotebookExecutionSummary]))
-> ListNotebookExecutionsResponse
-> f ListNotebookExecutionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [NotebookExecutionSummary]
  [NotebookExecutionSummary]
  [NotebookExecutionSummary]
  [NotebookExecutionSummary]
-> Iso
     (Maybe [NotebookExecutionSummary])
     (Maybe [NotebookExecutionSummary])
     (Maybe [NotebookExecutionSummary])
     (Maybe [NotebookExecutionSummary])
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
  [NotebookExecutionSummary]
  [NotebookExecutionSummary]
  [NotebookExecutionSummary]
  [NotebookExecutionSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A pagination token that a subsequent @ListNotebookExecutions@ can use to
-- determine the next set of results to retrieve.
listNotebookExecutionsResponse_marker :: Lens.Lens' ListNotebookExecutionsResponse (Prelude.Maybe Prelude.Text)
listNotebookExecutionsResponse_marker :: (Maybe Text -> f (Maybe Text))
-> ListNotebookExecutionsResponse
-> f ListNotebookExecutionsResponse
listNotebookExecutionsResponse_marker = (ListNotebookExecutionsResponse -> Maybe Text)
-> (ListNotebookExecutionsResponse
    -> Maybe Text -> ListNotebookExecutionsResponse)
-> Lens' ListNotebookExecutionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNotebookExecutionsResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:ListNotebookExecutionsResponse' :: ListNotebookExecutionsResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListNotebookExecutionsResponse
s@ListNotebookExecutionsResponse' {} Maybe Text
a -> ListNotebookExecutionsResponse
s {$sel:marker:ListNotebookExecutionsResponse' :: Maybe Text
marker = Maybe Text
a} :: ListNotebookExecutionsResponse)

-- | The response's http status code.
listNotebookExecutionsResponse_httpStatus :: Lens.Lens' ListNotebookExecutionsResponse Prelude.Int
listNotebookExecutionsResponse_httpStatus :: (Int -> f Int)
-> ListNotebookExecutionsResponse
-> f ListNotebookExecutionsResponse
listNotebookExecutionsResponse_httpStatus = (ListNotebookExecutionsResponse -> Int)
-> (ListNotebookExecutionsResponse
    -> Int -> ListNotebookExecutionsResponse)
-> Lens
     ListNotebookExecutionsResponse
     ListNotebookExecutionsResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNotebookExecutionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListNotebookExecutionsResponse' :: ListNotebookExecutionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListNotebookExecutionsResponse
s@ListNotebookExecutionsResponse' {} Int
a -> ListNotebookExecutionsResponse
s {$sel:httpStatus:ListNotebookExecutionsResponse' :: Int
httpStatus = Int
a} :: ListNotebookExecutionsResponse)

instance
  Prelude.NFData
    ListNotebookExecutionsResponse