{-# 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.SnowDeviceManagement.ListExecutions
-- 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)
--
-- Returns the status of tasks for one or more target devices.
--
-- This operation returns paginated results.
module Amazonka.SnowDeviceManagement.ListExecutions
  ( -- * Creating a Request
    ListExecutions (..),
    newListExecutions,

    -- * Request Lenses
    listExecutions_state,
    listExecutions_nextToken,
    listExecutions_maxResults,
    listExecutions_taskId,

    -- * Destructuring the Response
    ListExecutionsResponse (..),
    newListExecutionsResponse,

    -- * Response Lenses
    listExecutionsResponse_executions,
    listExecutionsResponse_nextToken,
    listExecutionsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newListExecutions' smart constructor.
data ListExecutions = ListExecutions'
  { -- | A structure used to filter the tasks by their current state.
    ListExecutions -> Maybe ExecutionState
state :: Prelude.Maybe ExecutionState,
    -- | A pagination token to continue to the next page of tasks.
    ListExecutions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of tasks to list per page.
    ListExecutions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The ID of the task.
    ListExecutions -> Text
taskId :: Prelude.Text
  }
  deriving (ListExecutions -> ListExecutions -> Bool
(ListExecutions -> ListExecutions -> Bool)
-> (ListExecutions -> ListExecutions -> Bool) -> Eq ListExecutions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListExecutions -> ListExecutions -> Bool
$c/= :: ListExecutions -> ListExecutions -> Bool
== :: ListExecutions -> ListExecutions -> Bool
$c== :: ListExecutions -> ListExecutions -> Bool
Prelude.Eq, ReadPrec [ListExecutions]
ReadPrec ListExecutions
Int -> ReadS ListExecutions
ReadS [ListExecutions]
(Int -> ReadS ListExecutions)
-> ReadS [ListExecutions]
-> ReadPrec ListExecutions
-> ReadPrec [ListExecutions]
-> Read ListExecutions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListExecutions]
$creadListPrec :: ReadPrec [ListExecutions]
readPrec :: ReadPrec ListExecutions
$creadPrec :: ReadPrec ListExecutions
readList :: ReadS [ListExecutions]
$creadList :: ReadS [ListExecutions]
readsPrec :: Int -> ReadS ListExecutions
$creadsPrec :: Int -> ReadS ListExecutions
Prelude.Read, Int -> ListExecutions -> ShowS
[ListExecutions] -> ShowS
ListExecutions -> String
(Int -> ListExecutions -> ShowS)
-> (ListExecutions -> String)
-> ([ListExecutions] -> ShowS)
-> Show ListExecutions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListExecutions] -> ShowS
$cshowList :: [ListExecutions] -> ShowS
show :: ListExecutions -> String
$cshow :: ListExecutions -> String
showsPrec :: Int -> ListExecutions -> ShowS
$cshowsPrec :: Int -> ListExecutions -> ShowS
Prelude.Show, (forall x. ListExecutions -> Rep ListExecutions x)
-> (forall x. Rep ListExecutions x -> ListExecutions)
-> Generic ListExecutions
forall x. Rep ListExecutions x -> ListExecutions
forall x. ListExecutions -> Rep ListExecutions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListExecutions x -> ListExecutions
$cfrom :: forall x. ListExecutions -> Rep ListExecutions x
Prelude.Generic)

-- |
-- Create a value of 'ListExecutions' 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:
--
-- 'state', 'listExecutions_state' - A structure used to filter the tasks by their current state.
--
-- 'nextToken', 'listExecutions_nextToken' - A pagination token to continue to the next page of tasks.
--
-- 'maxResults', 'listExecutions_maxResults' - The maximum number of tasks to list per page.
--
-- 'taskId', 'listExecutions_taskId' - The ID of the task.
newListExecutions ::
  -- | 'taskId'
  Prelude.Text ->
  ListExecutions
newListExecutions :: Text -> ListExecutions
newListExecutions Text
pTaskId_ =
  ListExecutions' :: Maybe ExecutionState
-> Maybe Text -> Maybe Natural -> Text -> ListExecutions
ListExecutions'
    { $sel:state:ListExecutions' :: Maybe ExecutionState
state = Maybe ExecutionState
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListExecutions' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListExecutions' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:taskId:ListExecutions' :: Text
taskId = Text
pTaskId_
    }

-- | A structure used to filter the tasks by their current state.
listExecutions_state :: Lens.Lens' ListExecutions (Prelude.Maybe ExecutionState)
listExecutions_state :: (Maybe ExecutionState -> f (Maybe ExecutionState))
-> ListExecutions -> f ListExecutions
listExecutions_state = (ListExecutions -> Maybe ExecutionState)
-> (ListExecutions -> Maybe ExecutionState -> ListExecutions)
-> Lens
     ListExecutions
     ListExecutions
     (Maybe ExecutionState)
     (Maybe ExecutionState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListExecutions' {Maybe ExecutionState
state :: Maybe ExecutionState
$sel:state:ListExecutions' :: ListExecutions -> Maybe ExecutionState
state} -> Maybe ExecutionState
state) (\s :: ListExecutions
s@ListExecutions' {} Maybe ExecutionState
a -> ListExecutions
s {$sel:state:ListExecutions' :: Maybe ExecutionState
state = Maybe ExecutionState
a} :: ListExecutions)

-- | A pagination token to continue to the next page of tasks.
listExecutions_nextToken :: Lens.Lens' ListExecutions (Prelude.Maybe Prelude.Text)
listExecutions_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListExecutions -> f ListExecutions
listExecutions_nextToken = (ListExecutions -> Maybe Text)
-> (ListExecutions -> Maybe Text -> ListExecutions)
-> Lens ListExecutions ListExecutions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListExecutions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListExecutions' :: ListExecutions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListExecutions
s@ListExecutions' {} Maybe Text
a -> ListExecutions
s {$sel:nextToken:ListExecutions' :: Maybe Text
nextToken = Maybe Text
a} :: ListExecutions)

-- | The maximum number of tasks to list per page.
listExecutions_maxResults :: Lens.Lens' ListExecutions (Prelude.Maybe Prelude.Natural)
listExecutions_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListExecutions -> f ListExecutions
listExecutions_maxResults = (ListExecutions -> Maybe Natural)
-> (ListExecutions -> Maybe Natural -> ListExecutions)
-> Lens
     ListExecutions ListExecutions (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListExecutions' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListExecutions' :: ListExecutions -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListExecutions
s@ListExecutions' {} Maybe Natural
a -> ListExecutions
s {$sel:maxResults:ListExecutions' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListExecutions)

-- | The ID of the task.
listExecutions_taskId :: Lens.Lens' ListExecutions Prelude.Text
listExecutions_taskId :: (Text -> f Text) -> ListExecutions -> f ListExecutions
listExecutions_taskId = (ListExecutions -> Text)
-> (ListExecutions -> Text -> ListExecutions)
-> Lens ListExecutions ListExecutions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListExecutions' {Text
taskId :: Text
$sel:taskId:ListExecutions' :: ListExecutions -> Text
taskId} -> Text
taskId) (\s :: ListExecutions
s@ListExecutions' {} Text
a -> ListExecutions
s {$sel:taskId:ListExecutions' :: Text
taskId = Text
a} :: ListExecutions)

instance Core.AWSPager ListExecutions where
  page :: ListExecutions
-> AWSResponse ListExecutions -> Maybe ListExecutions
page ListExecutions
rq AWSResponse ListExecutions
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListExecutions
ListExecutionsResponse
rs
            ListExecutionsResponse
-> Getting (First Text) ListExecutionsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListExecutionsResponse
-> Const (First Text) ListExecutionsResponse
Lens' ListExecutionsResponse (Maybe Text)
listExecutionsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListExecutionsResponse
 -> Const (First Text) ListExecutionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListExecutionsResponse 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 ListExecutions
forall a. Maybe a
Prelude.Nothing
    | Maybe [ExecutionSummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListExecutions
ListExecutionsResponse
rs
            ListExecutionsResponse
-> Getting
     (First [ExecutionSummary])
     ListExecutionsResponse
     [ExecutionSummary]
-> Maybe [ExecutionSummary]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [ExecutionSummary]
 -> Const (First [ExecutionSummary]) (Maybe [ExecutionSummary]))
-> ListExecutionsResponse
-> Const (First [ExecutionSummary]) ListExecutionsResponse
Lens' ListExecutionsResponse (Maybe [ExecutionSummary])
listExecutionsResponse_executions
              ((Maybe [ExecutionSummary]
  -> Const (First [ExecutionSummary]) (Maybe [ExecutionSummary]))
 -> ListExecutionsResponse
 -> Const (First [ExecutionSummary]) ListExecutionsResponse)
-> (([ExecutionSummary]
     -> Const (First [ExecutionSummary]) [ExecutionSummary])
    -> Maybe [ExecutionSummary]
    -> Const (First [ExecutionSummary]) (Maybe [ExecutionSummary]))
-> Getting
     (First [ExecutionSummary])
     ListExecutionsResponse
     [ExecutionSummary]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ExecutionSummary]
 -> Const (First [ExecutionSummary]) [ExecutionSummary])
-> Maybe [ExecutionSummary]
-> Const (First [ExecutionSummary]) (Maybe [ExecutionSummary])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListExecutions
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListExecutions -> Maybe ListExecutions
forall a. a -> Maybe a
Prelude.Just (ListExecutions -> Maybe ListExecutions)
-> ListExecutions -> Maybe ListExecutions
forall a b. (a -> b) -> a -> b
Prelude.$
        ListExecutions
rq
          ListExecutions
-> (ListExecutions -> ListExecutions) -> ListExecutions
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListExecutions -> Identity ListExecutions
Lens ListExecutions ListExecutions (Maybe Text) (Maybe Text)
listExecutions_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListExecutions -> Identity ListExecutions)
-> Maybe Text -> ListExecutions -> ListExecutions
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListExecutions
ListExecutionsResponse
rs
          ListExecutionsResponse
-> Getting (First Text) ListExecutionsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListExecutionsResponse
-> Const (First Text) ListExecutionsResponse
Lens' ListExecutionsResponse (Maybe Text)
listExecutionsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListExecutionsResponse
 -> Const (First Text) ListExecutionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListExecutionsResponse 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 ListExecutions where
  type
    AWSResponse ListExecutions =
      ListExecutionsResponse
  request :: ListExecutions -> Request ListExecutions
request = Service -> ListExecutions -> Request ListExecutions
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ListExecutions
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListExecutions)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListExecutions))
-> Logger
-> Service
-> Proxy ListExecutions
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListExecutions)))
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 [ExecutionSummary]
-> Maybe Text -> Int -> ListExecutionsResponse
ListExecutionsResponse'
            (Maybe [ExecutionSummary]
 -> Maybe Text -> Int -> ListExecutionsResponse)
-> Either String (Maybe [ExecutionSummary])
-> Either String (Maybe Text -> Int -> ListExecutionsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [ExecutionSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"executions" Either String (Maybe (Maybe [ExecutionSummary]))
-> Maybe [ExecutionSummary]
-> Either String (Maybe [ExecutionSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ExecutionSummary]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Maybe Text -> Int -> ListExecutionsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListExecutionsResponse)
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
"nextToken")
            Either String (Int -> ListExecutionsResponse)
-> Either String Int -> Either String ListExecutionsResponse
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 ListExecutions

instance Prelude.NFData ListExecutions

instance Core.ToHeaders ListExecutions where
  toHeaders :: ListExecutions -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListExecutions -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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.ToPath ListExecutions where
  toPath :: ListExecutions -> ByteString
toPath = ByteString -> ListExecutions -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/executions"

instance Core.ToQuery ListExecutions where
  toQuery :: ListExecutions -> QueryString
toQuery ListExecutions' {Maybe Natural
Maybe Text
Maybe ExecutionState
Text
taskId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
state :: Maybe ExecutionState
$sel:taskId:ListExecutions' :: ListExecutions -> Text
$sel:maxResults:ListExecutions' :: ListExecutions -> Maybe Natural
$sel:nextToken:ListExecutions' :: ListExecutions -> Maybe Text
$sel:state:ListExecutions' :: ListExecutions -> Maybe ExecutionState
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"state" ByteString -> Maybe ExecutionState -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe ExecutionState
state,
        ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults,
        ByteString
"taskId" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
taskId
      ]

-- | /See:/ 'newListExecutionsResponse' smart constructor.
data ListExecutionsResponse = ListExecutionsResponse'
  { -- | A list of executions. Each execution contains the task ID, the device
    -- that the task is executing on, the execution ID, and the status of the
    -- execution.
    ListExecutionsResponse -> Maybe [ExecutionSummary]
executions :: Prelude.Maybe [ExecutionSummary],
    -- | A pagination token to continue to the next page of executions.
    ListExecutionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListExecutionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListExecutionsResponse -> ListExecutionsResponse -> Bool
(ListExecutionsResponse -> ListExecutionsResponse -> Bool)
-> (ListExecutionsResponse -> ListExecutionsResponse -> Bool)
-> Eq ListExecutionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListExecutionsResponse -> ListExecutionsResponse -> Bool
$c/= :: ListExecutionsResponse -> ListExecutionsResponse -> Bool
== :: ListExecutionsResponse -> ListExecutionsResponse -> Bool
$c== :: ListExecutionsResponse -> ListExecutionsResponse -> Bool
Prelude.Eq, ReadPrec [ListExecutionsResponse]
ReadPrec ListExecutionsResponse
Int -> ReadS ListExecutionsResponse
ReadS [ListExecutionsResponse]
(Int -> ReadS ListExecutionsResponse)
-> ReadS [ListExecutionsResponse]
-> ReadPrec ListExecutionsResponse
-> ReadPrec [ListExecutionsResponse]
-> Read ListExecutionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListExecutionsResponse]
$creadListPrec :: ReadPrec [ListExecutionsResponse]
readPrec :: ReadPrec ListExecutionsResponse
$creadPrec :: ReadPrec ListExecutionsResponse
readList :: ReadS [ListExecutionsResponse]
$creadList :: ReadS [ListExecutionsResponse]
readsPrec :: Int -> ReadS ListExecutionsResponse
$creadsPrec :: Int -> ReadS ListExecutionsResponse
Prelude.Read, Int -> ListExecutionsResponse -> ShowS
[ListExecutionsResponse] -> ShowS
ListExecutionsResponse -> String
(Int -> ListExecutionsResponse -> ShowS)
-> (ListExecutionsResponse -> String)
-> ([ListExecutionsResponse] -> ShowS)
-> Show ListExecutionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListExecutionsResponse] -> ShowS
$cshowList :: [ListExecutionsResponse] -> ShowS
show :: ListExecutionsResponse -> String
$cshow :: ListExecutionsResponse -> String
showsPrec :: Int -> ListExecutionsResponse -> ShowS
$cshowsPrec :: Int -> ListExecutionsResponse -> ShowS
Prelude.Show, (forall x. ListExecutionsResponse -> Rep ListExecutionsResponse x)
-> (forall x.
    Rep ListExecutionsResponse x -> ListExecutionsResponse)
-> Generic ListExecutionsResponse
forall x. Rep ListExecutionsResponse x -> ListExecutionsResponse
forall x. ListExecutionsResponse -> Rep ListExecutionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListExecutionsResponse x -> ListExecutionsResponse
$cfrom :: forall x. ListExecutionsResponse -> Rep ListExecutionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListExecutionsResponse' 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:
--
-- 'executions', 'listExecutionsResponse_executions' - A list of executions. Each execution contains the task ID, the device
-- that the task is executing on, the execution ID, and the status of the
-- execution.
--
-- 'nextToken', 'listExecutionsResponse_nextToken' - A pagination token to continue to the next page of executions.
--
-- 'httpStatus', 'listExecutionsResponse_httpStatus' - The response's http status code.
newListExecutionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListExecutionsResponse
newListExecutionsResponse :: Int -> ListExecutionsResponse
newListExecutionsResponse Int
pHttpStatus_ =
  ListExecutionsResponse' :: Maybe [ExecutionSummary]
-> Maybe Text -> Int -> ListExecutionsResponse
ListExecutionsResponse'
    { $sel:executions:ListExecutionsResponse' :: Maybe [ExecutionSummary]
executions =
        Maybe [ExecutionSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListExecutionsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListExecutionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of executions. Each execution contains the task ID, the device
-- that the task is executing on, the execution ID, and the status of the
-- execution.
listExecutionsResponse_executions :: Lens.Lens' ListExecutionsResponse (Prelude.Maybe [ExecutionSummary])
listExecutionsResponse_executions :: (Maybe [ExecutionSummary] -> f (Maybe [ExecutionSummary]))
-> ListExecutionsResponse -> f ListExecutionsResponse
listExecutionsResponse_executions = (ListExecutionsResponse -> Maybe [ExecutionSummary])
-> (ListExecutionsResponse
    -> Maybe [ExecutionSummary] -> ListExecutionsResponse)
-> Lens' ListExecutionsResponse (Maybe [ExecutionSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListExecutionsResponse' {Maybe [ExecutionSummary]
executions :: Maybe [ExecutionSummary]
$sel:executions:ListExecutionsResponse' :: ListExecutionsResponse -> Maybe [ExecutionSummary]
executions} -> Maybe [ExecutionSummary]
executions) (\s :: ListExecutionsResponse
s@ListExecutionsResponse' {} Maybe [ExecutionSummary]
a -> ListExecutionsResponse
s {$sel:executions:ListExecutionsResponse' :: Maybe [ExecutionSummary]
executions = Maybe [ExecutionSummary]
a} :: ListExecutionsResponse) ((Maybe [ExecutionSummary] -> f (Maybe [ExecutionSummary]))
 -> ListExecutionsResponse -> f ListExecutionsResponse)
-> ((Maybe [ExecutionSummary] -> f (Maybe [ExecutionSummary]))
    -> Maybe [ExecutionSummary] -> f (Maybe [ExecutionSummary]))
-> (Maybe [ExecutionSummary] -> f (Maybe [ExecutionSummary]))
-> ListExecutionsResponse
-> f ListExecutionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ExecutionSummary]
  [ExecutionSummary]
  [ExecutionSummary]
  [ExecutionSummary]
-> Iso
     (Maybe [ExecutionSummary])
     (Maybe [ExecutionSummary])
     (Maybe [ExecutionSummary])
     (Maybe [ExecutionSummary])
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
  [ExecutionSummary]
  [ExecutionSummary]
  [ExecutionSummary]
  [ExecutionSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A pagination token to continue to the next page of executions.
listExecutionsResponse_nextToken :: Lens.Lens' ListExecutionsResponse (Prelude.Maybe Prelude.Text)
listExecutionsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListExecutionsResponse -> f ListExecutionsResponse
listExecutionsResponse_nextToken = (ListExecutionsResponse -> Maybe Text)
-> (ListExecutionsResponse -> Maybe Text -> ListExecutionsResponse)
-> Lens' ListExecutionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListExecutionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListExecutionsResponse' :: ListExecutionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListExecutionsResponse
s@ListExecutionsResponse' {} Maybe Text
a -> ListExecutionsResponse
s {$sel:nextToken:ListExecutionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListExecutionsResponse)

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

instance Prelude.NFData ListExecutionsResponse