{-# 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.IoTThingsGraph.SearchFlowExecutions
-- 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)
--
-- Searches for AWS IoT Things Graph workflow execution instances.
--
-- This operation returns paginated results.
module Amazonka.IoTThingsGraph.SearchFlowExecutions
  ( -- * Creating a Request
    SearchFlowExecutions (..),
    newSearchFlowExecutions,

    -- * Request Lenses
    searchFlowExecutions_startTime,
    searchFlowExecutions_flowExecutionId,
    searchFlowExecutions_nextToken,
    searchFlowExecutions_endTime,
    searchFlowExecutions_maxResults,
    searchFlowExecutions_systemInstanceId,

    -- * Destructuring the Response
    SearchFlowExecutionsResponse (..),
    newSearchFlowExecutionsResponse,

    -- * Response Lenses
    searchFlowExecutionsResponse_nextToken,
    searchFlowExecutionsResponse_summaries,
    searchFlowExecutionsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IoTThingsGraph.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:/ 'newSearchFlowExecutions' smart constructor.
data SearchFlowExecutions = SearchFlowExecutions'
  { -- | The date and time of the earliest flow execution to return.
    SearchFlowExecutions -> Maybe POSIX
startTime :: Prelude.Maybe Core.POSIX,
    -- | The ID of a flow execution.
    SearchFlowExecutions -> Maybe Text
flowExecutionId :: Prelude.Maybe Prelude.Text,
    -- | The string that specifies the next page of results. Use this when
    -- you\'re paginating results.
    SearchFlowExecutions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The date and time of the latest flow execution to return.
    SearchFlowExecutions -> Maybe POSIX
endTime :: Prelude.Maybe Core.POSIX,
    -- | The maximum number of results to return in the response.
    SearchFlowExecutions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The ID of the system instance that contains the flow.
    SearchFlowExecutions -> Text
systemInstanceId :: Prelude.Text
  }
  deriving (SearchFlowExecutions -> SearchFlowExecutions -> Bool
(SearchFlowExecutions -> SearchFlowExecutions -> Bool)
-> (SearchFlowExecutions -> SearchFlowExecutions -> Bool)
-> Eq SearchFlowExecutions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchFlowExecutions -> SearchFlowExecutions -> Bool
$c/= :: SearchFlowExecutions -> SearchFlowExecutions -> Bool
== :: SearchFlowExecutions -> SearchFlowExecutions -> Bool
$c== :: SearchFlowExecutions -> SearchFlowExecutions -> Bool
Prelude.Eq, ReadPrec [SearchFlowExecutions]
ReadPrec SearchFlowExecutions
Int -> ReadS SearchFlowExecutions
ReadS [SearchFlowExecutions]
(Int -> ReadS SearchFlowExecutions)
-> ReadS [SearchFlowExecutions]
-> ReadPrec SearchFlowExecutions
-> ReadPrec [SearchFlowExecutions]
-> Read SearchFlowExecutions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchFlowExecutions]
$creadListPrec :: ReadPrec [SearchFlowExecutions]
readPrec :: ReadPrec SearchFlowExecutions
$creadPrec :: ReadPrec SearchFlowExecutions
readList :: ReadS [SearchFlowExecutions]
$creadList :: ReadS [SearchFlowExecutions]
readsPrec :: Int -> ReadS SearchFlowExecutions
$creadsPrec :: Int -> ReadS SearchFlowExecutions
Prelude.Read, Int -> SearchFlowExecutions -> ShowS
[SearchFlowExecutions] -> ShowS
SearchFlowExecutions -> String
(Int -> SearchFlowExecutions -> ShowS)
-> (SearchFlowExecutions -> String)
-> ([SearchFlowExecutions] -> ShowS)
-> Show SearchFlowExecutions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchFlowExecutions] -> ShowS
$cshowList :: [SearchFlowExecutions] -> ShowS
show :: SearchFlowExecutions -> String
$cshow :: SearchFlowExecutions -> String
showsPrec :: Int -> SearchFlowExecutions -> ShowS
$cshowsPrec :: Int -> SearchFlowExecutions -> ShowS
Prelude.Show, (forall x. SearchFlowExecutions -> Rep SearchFlowExecutions x)
-> (forall x. Rep SearchFlowExecutions x -> SearchFlowExecutions)
-> Generic SearchFlowExecutions
forall x. Rep SearchFlowExecutions x -> SearchFlowExecutions
forall x. SearchFlowExecutions -> Rep SearchFlowExecutions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchFlowExecutions x -> SearchFlowExecutions
$cfrom :: forall x. SearchFlowExecutions -> Rep SearchFlowExecutions x
Prelude.Generic)

-- |
-- Create a value of 'SearchFlowExecutions' 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:
--
-- 'startTime', 'searchFlowExecutions_startTime' - The date and time of the earliest flow execution to return.
--
-- 'flowExecutionId', 'searchFlowExecutions_flowExecutionId' - The ID of a flow execution.
--
-- 'nextToken', 'searchFlowExecutions_nextToken' - The string that specifies the next page of results. Use this when
-- you\'re paginating results.
--
-- 'endTime', 'searchFlowExecutions_endTime' - The date and time of the latest flow execution to return.
--
-- 'maxResults', 'searchFlowExecutions_maxResults' - The maximum number of results to return in the response.
--
-- 'systemInstanceId', 'searchFlowExecutions_systemInstanceId' - The ID of the system instance that contains the flow.
newSearchFlowExecutions ::
  -- | 'systemInstanceId'
  Prelude.Text ->
  SearchFlowExecutions
newSearchFlowExecutions :: Text -> SearchFlowExecutions
newSearchFlowExecutions Text
pSystemInstanceId_ =
  SearchFlowExecutions' :: Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Natural
-> Text
-> SearchFlowExecutions
SearchFlowExecutions'
    { $sel:startTime:SearchFlowExecutions' :: Maybe POSIX
startTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:flowExecutionId:SearchFlowExecutions' :: Maybe Text
flowExecutionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:SearchFlowExecutions' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:endTime:SearchFlowExecutions' :: Maybe POSIX
endTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:SearchFlowExecutions' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:systemInstanceId:SearchFlowExecutions' :: Text
systemInstanceId = Text
pSystemInstanceId_
    }

-- | The date and time of the earliest flow execution to return.
searchFlowExecutions_startTime :: Lens.Lens' SearchFlowExecutions (Prelude.Maybe Prelude.UTCTime)
searchFlowExecutions_startTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> SearchFlowExecutions -> f SearchFlowExecutions
searchFlowExecutions_startTime = (SearchFlowExecutions -> Maybe POSIX)
-> (SearchFlowExecutions -> Maybe POSIX -> SearchFlowExecutions)
-> Lens
     SearchFlowExecutions
     SearchFlowExecutions
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchFlowExecutions' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:SearchFlowExecutions' :: SearchFlowExecutions -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: SearchFlowExecutions
s@SearchFlowExecutions' {} Maybe POSIX
a -> SearchFlowExecutions
s {$sel:startTime:SearchFlowExecutions' :: Maybe POSIX
startTime = Maybe POSIX
a} :: SearchFlowExecutions) ((Maybe POSIX -> f (Maybe POSIX))
 -> SearchFlowExecutions -> f SearchFlowExecutions)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> SearchFlowExecutions
-> f SearchFlowExecutions
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 ID of a flow execution.
searchFlowExecutions_flowExecutionId :: Lens.Lens' SearchFlowExecutions (Prelude.Maybe Prelude.Text)
searchFlowExecutions_flowExecutionId :: (Maybe Text -> f (Maybe Text))
-> SearchFlowExecutions -> f SearchFlowExecutions
searchFlowExecutions_flowExecutionId = (SearchFlowExecutions -> Maybe Text)
-> (SearchFlowExecutions -> Maybe Text -> SearchFlowExecutions)
-> Lens
     SearchFlowExecutions SearchFlowExecutions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchFlowExecutions' {Maybe Text
flowExecutionId :: Maybe Text
$sel:flowExecutionId:SearchFlowExecutions' :: SearchFlowExecutions -> Maybe Text
flowExecutionId} -> Maybe Text
flowExecutionId) (\s :: SearchFlowExecutions
s@SearchFlowExecutions' {} Maybe Text
a -> SearchFlowExecutions
s {$sel:flowExecutionId:SearchFlowExecutions' :: Maybe Text
flowExecutionId = Maybe Text
a} :: SearchFlowExecutions)

-- | The string that specifies the next page of results. Use this when
-- you\'re paginating results.
searchFlowExecutions_nextToken :: Lens.Lens' SearchFlowExecutions (Prelude.Maybe Prelude.Text)
searchFlowExecutions_nextToken :: (Maybe Text -> f (Maybe Text))
-> SearchFlowExecutions -> f SearchFlowExecutions
searchFlowExecutions_nextToken = (SearchFlowExecutions -> Maybe Text)
-> (SearchFlowExecutions -> Maybe Text -> SearchFlowExecutions)
-> Lens
     SearchFlowExecutions SearchFlowExecutions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchFlowExecutions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:SearchFlowExecutions' :: SearchFlowExecutions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: SearchFlowExecutions
s@SearchFlowExecutions' {} Maybe Text
a -> SearchFlowExecutions
s {$sel:nextToken:SearchFlowExecutions' :: Maybe Text
nextToken = Maybe Text
a} :: SearchFlowExecutions)

-- | The date and time of the latest flow execution to return.
searchFlowExecutions_endTime :: Lens.Lens' SearchFlowExecutions (Prelude.Maybe Prelude.UTCTime)
searchFlowExecutions_endTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> SearchFlowExecutions -> f SearchFlowExecutions
searchFlowExecutions_endTime = (SearchFlowExecutions -> Maybe POSIX)
-> (SearchFlowExecutions -> Maybe POSIX -> SearchFlowExecutions)
-> Lens
     SearchFlowExecutions
     SearchFlowExecutions
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchFlowExecutions' {Maybe POSIX
endTime :: Maybe POSIX
$sel:endTime:SearchFlowExecutions' :: SearchFlowExecutions -> Maybe POSIX
endTime} -> Maybe POSIX
endTime) (\s :: SearchFlowExecutions
s@SearchFlowExecutions' {} Maybe POSIX
a -> SearchFlowExecutions
s {$sel:endTime:SearchFlowExecutions' :: Maybe POSIX
endTime = Maybe POSIX
a} :: SearchFlowExecutions) ((Maybe POSIX -> f (Maybe POSIX))
 -> SearchFlowExecutions -> f SearchFlowExecutions)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> SearchFlowExecutions
-> f SearchFlowExecutions
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 maximum number of results to return in the response.
searchFlowExecutions_maxResults :: Lens.Lens' SearchFlowExecutions (Prelude.Maybe Prelude.Natural)
searchFlowExecutions_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> SearchFlowExecutions -> f SearchFlowExecutions
searchFlowExecutions_maxResults = (SearchFlowExecutions -> Maybe Natural)
-> (SearchFlowExecutions -> Maybe Natural -> SearchFlowExecutions)
-> Lens
     SearchFlowExecutions
     SearchFlowExecutions
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchFlowExecutions' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:SearchFlowExecutions' :: SearchFlowExecutions -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: SearchFlowExecutions
s@SearchFlowExecutions' {} Maybe Natural
a -> SearchFlowExecutions
s {$sel:maxResults:SearchFlowExecutions' :: Maybe Natural
maxResults = Maybe Natural
a} :: SearchFlowExecutions)

-- | The ID of the system instance that contains the flow.
searchFlowExecutions_systemInstanceId :: Lens.Lens' SearchFlowExecutions Prelude.Text
searchFlowExecutions_systemInstanceId :: (Text -> f Text) -> SearchFlowExecutions -> f SearchFlowExecutions
searchFlowExecutions_systemInstanceId = (SearchFlowExecutions -> Text)
-> (SearchFlowExecutions -> Text -> SearchFlowExecutions)
-> Lens SearchFlowExecutions SearchFlowExecutions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchFlowExecutions' {Text
systemInstanceId :: Text
$sel:systemInstanceId:SearchFlowExecutions' :: SearchFlowExecutions -> Text
systemInstanceId} -> Text
systemInstanceId) (\s :: SearchFlowExecutions
s@SearchFlowExecutions' {} Text
a -> SearchFlowExecutions
s {$sel:systemInstanceId:SearchFlowExecutions' :: Text
systemInstanceId = Text
a} :: SearchFlowExecutions)

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

instance Prelude.NFData SearchFlowExecutions

instance Core.ToHeaders SearchFlowExecutions where
  toHeaders :: SearchFlowExecutions -> ResponseHeaders
toHeaders =
    ResponseHeaders -> SearchFlowExecutions -> 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
"IotThingsGraphFrontEndService.SearchFlowExecutions" ::
                          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 SearchFlowExecutions where
  toJSON :: SearchFlowExecutions -> Value
toJSON SearchFlowExecutions' {Maybe Natural
Maybe Text
Maybe POSIX
Text
systemInstanceId :: Text
maxResults :: Maybe Natural
endTime :: Maybe POSIX
nextToken :: Maybe Text
flowExecutionId :: Maybe Text
startTime :: Maybe POSIX
$sel:systemInstanceId:SearchFlowExecutions' :: SearchFlowExecutions -> Text
$sel:maxResults:SearchFlowExecutions' :: SearchFlowExecutions -> Maybe Natural
$sel:endTime:SearchFlowExecutions' :: SearchFlowExecutions -> Maybe POSIX
$sel:nextToken:SearchFlowExecutions' :: SearchFlowExecutions -> Maybe Text
$sel:flowExecutionId:SearchFlowExecutions' :: SearchFlowExecutions -> Maybe Text
$sel:startTime:SearchFlowExecutions' :: SearchFlowExecutions -> Maybe POSIX
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"startTime" 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
startTime,
            (Text
"flowExecutionId" 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
flowExecutionId,
            (Text
"nextToken" 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
nextToken,
            (Text
"endTime" 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
endTime,
            (Text
"maxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"systemInstanceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
systemInstanceId)
          ]
      )

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

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

-- | /See:/ 'newSearchFlowExecutionsResponse' smart constructor.
data SearchFlowExecutionsResponse = SearchFlowExecutionsResponse'
  { -- | The string to specify as @nextToken@ when you request the next page of
    -- results.
    SearchFlowExecutionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | An array of objects that contain summary information about each workflow
    -- execution in the result set.
    SearchFlowExecutionsResponse -> Maybe [FlowExecutionSummary]
summaries :: Prelude.Maybe [FlowExecutionSummary],
    -- | The response's http status code.
    SearchFlowExecutionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (SearchFlowExecutionsResponse
-> SearchFlowExecutionsResponse -> Bool
(SearchFlowExecutionsResponse
 -> SearchFlowExecutionsResponse -> Bool)
-> (SearchFlowExecutionsResponse
    -> SearchFlowExecutionsResponse -> Bool)
-> Eq SearchFlowExecutionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchFlowExecutionsResponse
-> SearchFlowExecutionsResponse -> Bool
$c/= :: SearchFlowExecutionsResponse
-> SearchFlowExecutionsResponse -> Bool
== :: SearchFlowExecutionsResponse
-> SearchFlowExecutionsResponse -> Bool
$c== :: SearchFlowExecutionsResponse
-> SearchFlowExecutionsResponse -> Bool
Prelude.Eq, ReadPrec [SearchFlowExecutionsResponse]
ReadPrec SearchFlowExecutionsResponse
Int -> ReadS SearchFlowExecutionsResponse
ReadS [SearchFlowExecutionsResponse]
(Int -> ReadS SearchFlowExecutionsResponse)
-> ReadS [SearchFlowExecutionsResponse]
-> ReadPrec SearchFlowExecutionsResponse
-> ReadPrec [SearchFlowExecutionsResponse]
-> Read SearchFlowExecutionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchFlowExecutionsResponse]
$creadListPrec :: ReadPrec [SearchFlowExecutionsResponse]
readPrec :: ReadPrec SearchFlowExecutionsResponse
$creadPrec :: ReadPrec SearchFlowExecutionsResponse
readList :: ReadS [SearchFlowExecutionsResponse]
$creadList :: ReadS [SearchFlowExecutionsResponse]
readsPrec :: Int -> ReadS SearchFlowExecutionsResponse
$creadsPrec :: Int -> ReadS SearchFlowExecutionsResponse
Prelude.Read, Int -> SearchFlowExecutionsResponse -> ShowS
[SearchFlowExecutionsResponse] -> ShowS
SearchFlowExecutionsResponse -> String
(Int -> SearchFlowExecutionsResponse -> ShowS)
-> (SearchFlowExecutionsResponse -> String)
-> ([SearchFlowExecutionsResponse] -> ShowS)
-> Show SearchFlowExecutionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchFlowExecutionsResponse] -> ShowS
$cshowList :: [SearchFlowExecutionsResponse] -> ShowS
show :: SearchFlowExecutionsResponse -> String
$cshow :: SearchFlowExecutionsResponse -> String
showsPrec :: Int -> SearchFlowExecutionsResponse -> ShowS
$cshowsPrec :: Int -> SearchFlowExecutionsResponse -> ShowS
Prelude.Show, (forall x.
 SearchFlowExecutionsResponse -> Rep SearchFlowExecutionsResponse x)
-> (forall x.
    Rep SearchFlowExecutionsResponse x -> SearchFlowExecutionsResponse)
-> Generic SearchFlowExecutionsResponse
forall x.
Rep SearchFlowExecutionsResponse x -> SearchFlowExecutionsResponse
forall x.
SearchFlowExecutionsResponse -> Rep SearchFlowExecutionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SearchFlowExecutionsResponse x -> SearchFlowExecutionsResponse
$cfrom :: forall x.
SearchFlowExecutionsResponse -> Rep SearchFlowExecutionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'SearchFlowExecutionsResponse' 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:
--
-- 'nextToken', 'searchFlowExecutionsResponse_nextToken' - The string to specify as @nextToken@ when you request the next page of
-- results.
--
-- 'summaries', 'searchFlowExecutionsResponse_summaries' - An array of objects that contain summary information about each workflow
-- execution in the result set.
--
-- 'httpStatus', 'searchFlowExecutionsResponse_httpStatus' - The response's http status code.
newSearchFlowExecutionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  SearchFlowExecutionsResponse
newSearchFlowExecutionsResponse :: Int -> SearchFlowExecutionsResponse
newSearchFlowExecutionsResponse Int
pHttpStatus_ =
  SearchFlowExecutionsResponse' :: Maybe Text
-> Maybe [FlowExecutionSummary]
-> Int
-> SearchFlowExecutionsResponse
SearchFlowExecutionsResponse'
    { $sel:nextToken:SearchFlowExecutionsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:summaries:SearchFlowExecutionsResponse' :: Maybe [FlowExecutionSummary]
summaries = Maybe [FlowExecutionSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:SearchFlowExecutionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The string to specify as @nextToken@ when you request the next page of
-- results.
searchFlowExecutionsResponse_nextToken :: Lens.Lens' SearchFlowExecutionsResponse (Prelude.Maybe Prelude.Text)
searchFlowExecutionsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> SearchFlowExecutionsResponse -> f SearchFlowExecutionsResponse
searchFlowExecutionsResponse_nextToken = (SearchFlowExecutionsResponse -> Maybe Text)
-> (SearchFlowExecutionsResponse
    -> Maybe Text -> SearchFlowExecutionsResponse)
-> Lens' SearchFlowExecutionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchFlowExecutionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:SearchFlowExecutionsResponse' :: SearchFlowExecutionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: SearchFlowExecutionsResponse
s@SearchFlowExecutionsResponse' {} Maybe Text
a -> SearchFlowExecutionsResponse
s {$sel:nextToken:SearchFlowExecutionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: SearchFlowExecutionsResponse)

-- | An array of objects that contain summary information about each workflow
-- execution in the result set.
searchFlowExecutionsResponse_summaries :: Lens.Lens' SearchFlowExecutionsResponse (Prelude.Maybe [FlowExecutionSummary])
searchFlowExecutionsResponse_summaries :: (Maybe [FlowExecutionSummary] -> f (Maybe [FlowExecutionSummary]))
-> SearchFlowExecutionsResponse -> f SearchFlowExecutionsResponse
searchFlowExecutionsResponse_summaries = (SearchFlowExecutionsResponse -> Maybe [FlowExecutionSummary])
-> (SearchFlowExecutionsResponse
    -> Maybe [FlowExecutionSummary] -> SearchFlowExecutionsResponse)
-> Lens'
     SearchFlowExecutionsResponse (Maybe [FlowExecutionSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchFlowExecutionsResponse' {Maybe [FlowExecutionSummary]
summaries :: Maybe [FlowExecutionSummary]
$sel:summaries:SearchFlowExecutionsResponse' :: SearchFlowExecutionsResponse -> Maybe [FlowExecutionSummary]
summaries} -> Maybe [FlowExecutionSummary]
summaries) (\s :: SearchFlowExecutionsResponse
s@SearchFlowExecutionsResponse' {} Maybe [FlowExecutionSummary]
a -> SearchFlowExecutionsResponse
s {$sel:summaries:SearchFlowExecutionsResponse' :: Maybe [FlowExecutionSummary]
summaries = Maybe [FlowExecutionSummary]
a} :: SearchFlowExecutionsResponse) ((Maybe [FlowExecutionSummary] -> f (Maybe [FlowExecutionSummary]))
 -> SearchFlowExecutionsResponse -> f SearchFlowExecutionsResponse)
-> ((Maybe [FlowExecutionSummary]
     -> f (Maybe [FlowExecutionSummary]))
    -> Maybe [FlowExecutionSummary]
    -> f (Maybe [FlowExecutionSummary]))
-> (Maybe [FlowExecutionSummary]
    -> f (Maybe [FlowExecutionSummary]))
-> SearchFlowExecutionsResponse
-> f SearchFlowExecutionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [FlowExecutionSummary]
  [FlowExecutionSummary]
  [FlowExecutionSummary]
  [FlowExecutionSummary]
-> Iso
     (Maybe [FlowExecutionSummary])
     (Maybe [FlowExecutionSummary])
     (Maybe [FlowExecutionSummary])
     (Maybe [FlowExecutionSummary])
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
  [FlowExecutionSummary]
  [FlowExecutionSummary]
  [FlowExecutionSummary]
  [FlowExecutionSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData SearchFlowExecutionsResponse