{-# 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.SWF.ListOpenWorkflowExecutions
-- 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 a list of open workflow executions in the specified domain that
-- meet the filtering criteria. The results may be split into multiple
-- pages. To retrieve subsequent pages, make the call again using the
-- nextPageToken returned by the initial call.
--
-- This operation is eventually consistent. The results are best effort and
-- may not exactly reflect recent updates and changes.
--
-- __Access Control__
--
-- You can use IAM policies to control this action\'s access to Amazon SWF
-- resources as follows:
--
-- -   Use a @Resource@ element with the domain name to limit the action to
--     only specified domains.
--
-- -   Use an @Action@ element to allow or deny permission to call this
--     action.
--
-- -   Constrain the following parameters by using a @Condition@ element
--     with the appropriate keys.
--
--     -   @tagFilter.tag@: String constraint. The key is
--         @swf:tagFilter.tag@.
--
--     -   @typeFilter.name@: String constraint. The key is
--         @swf:typeFilter.name@.
--
--     -   @typeFilter.version@: String constraint. The key is
--         @swf:typeFilter.version@.
--
-- If the caller doesn\'t have sufficient permissions to invoke the action,
-- or the parameter values fall outside the specified constraints, the
-- action fails. The associated event attribute\'s @cause@ parameter is set
-- to @OPERATION_NOT_PERMITTED@. For details and example IAM policies, see
-- <https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html Using IAM to Manage Access to Amazon SWF Workflows>
-- in the /Amazon SWF Developer Guide/.
--
-- This operation returns paginated results.
module Amazonka.SWF.ListOpenWorkflowExecutions
  ( -- * Creating a Request
    ListOpenWorkflowExecutions (..),
    newListOpenWorkflowExecutions,

    -- * Request Lenses
    listOpenWorkflowExecutions_nextPageToken,
    listOpenWorkflowExecutions_executionFilter,
    listOpenWorkflowExecutions_typeFilter,
    listOpenWorkflowExecutions_reverseOrder,
    listOpenWorkflowExecutions_tagFilter,
    listOpenWorkflowExecutions_maximumPageSize,
    listOpenWorkflowExecutions_domain,
    listOpenWorkflowExecutions_startTimeFilter,

    -- * Destructuring the Response
    WorkflowExecutionInfos (..),
    newWorkflowExecutionInfos,

    -- * Response Lenses
    workflowExecutionInfos_nextPageToken,
    workflowExecutionInfos_executionInfos,
  )
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.SWF.Types

-- | /See:/ 'newListOpenWorkflowExecutions' smart constructor.
data ListOpenWorkflowExecutions = ListOpenWorkflowExecutions'
  { -- | If @NextPageToken@ is returned there are more results available. The
    -- value of @NextPageToken@ is a unique pagination token for each page.
    -- Make the call again using the returned token to retrieve the next page.
    -- Keep all other arguments unchanged. Each pagination token expires after
    -- 60 seconds. Using an expired pagination token will return a @400@ error:
    -- \"@Specified token has exceeded its maximum lifetime@\".
    --
    -- The configured @maximumPageSize@ determines how many results can be
    -- returned in a single call.
    ListOpenWorkflowExecutions -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
    -- | If specified, only workflow executions matching the workflow ID
    -- specified in the filter are returned.
    --
    -- @executionFilter@, @typeFilter@ and @tagFilter@ are mutually exclusive.
    -- You can specify at most one of these in a request.
    ListOpenWorkflowExecutions -> Maybe WorkflowExecutionFilter
executionFilter :: Prelude.Maybe WorkflowExecutionFilter,
    -- | If specified, only executions of the type specified in the filter are
    -- returned.
    --
    -- @executionFilter@, @typeFilter@ and @tagFilter@ are mutually exclusive.
    -- You can specify at most one of these in a request.
    ListOpenWorkflowExecutions -> Maybe WorkflowTypeFilter
typeFilter :: Prelude.Maybe WorkflowTypeFilter,
    -- | When set to @true@, returns the results in reverse order. By default the
    -- results are returned in descending order of the start time of the
    -- executions.
    ListOpenWorkflowExecutions -> Maybe Bool
reverseOrder :: Prelude.Maybe Prelude.Bool,
    -- | If specified, only executions that have the matching tag are listed.
    --
    -- @executionFilter@, @typeFilter@ and @tagFilter@ are mutually exclusive.
    -- You can specify at most one of these in a request.
    ListOpenWorkflowExecutions -> Maybe TagFilter
tagFilter :: Prelude.Maybe TagFilter,
    -- | The maximum number of results that are returned per call. Use
    -- @nextPageToken@ to obtain further pages of results.
    ListOpenWorkflowExecutions -> Maybe Natural
maximumPageSize :: Prelude.Maybe Prelude.Natural,
    -- | The name of the domain that contains the workflow executions to list.
    ListOpenWorkflowExecutions -> Text
domain :: Prelude.Text,
    -- | Workflow executions are included in the returned results based on
    -- whether their start times are within the range specified by this filter.
    ListOpenWorkflowExecutions -> ExecutionTimeFilter
startTimeFilter :: ExecutionTimeFilter
  }
  deriving (ListOpenWorkflowExecutions -> ListOpenWorkflowExecutions -> Bool
(ListOpenWorkflowExecutions -> ListOpenWorkflowExecutions -> Bool)
-> (ListOpenWorkflowExecutions
    -> ListOpenWorkflowExecutions -> Bool)
-> Eq ListOpenWorkflowExecutions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListOpenWorkflowExecutions -> ListOpenWorkflowExecutions -> Bool
$c/= :: ListOpenWorkflowExecutions -> ListOpenWorkflowExecutions -> Bool
== :: ListOpenWorkflowExecutions -> ListOpenWorkflowExecutions -> Bool
$c== :: ListOpenWorkflowExecutions -> ListOpenWorkflowExecutions -> Bool
Prelude.Eq, ReadPrec [ListOpenWorkflowExecutions]
ReadPrec ListOpenWorkflowExecutions
Int -> ReadS ListOpenWorkflowExecutions
ReadS [ListOpenWorkflowExecutions]
(Int -> ReadS ListOpenWorkflowExecutions)
-> ReadS [ListOpenWorkflowExecutions]
-> ReadPrec ListOpenWorkflowExecutions
-> ReadPrec [ListOpenWorkflowExecutions]
-> Read ListOpenWorkflowExecutions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListOpenWorkflowExecutions]
$creadListPrec :: ReadPrec [ListOpenWorkflowExecutions]
readPrec :: ReadPrec ListOpenWorkflowExecutions
$creadPrec :: ReadPrec ListOpenWorkflowExecutions
readList :: ReadS [ListOpenWorkflowExecutions]
$creadList :: ReadS [ListOpenWorkflowExecutions]
readsPrec :: Int -> ReadS ListOpenWorkflowExecutions
$creadsPrec :: Int -> ReadS ListOpenWorkflowExecutions
Prelude.Read, Int -> ListOpenWorkflowExecutions -> ShowS
[ListOpenWorkflowExecutions] -> ShowS
ListOpenWorkflowExecutions -> String
(Int -> ListOpenWorkflowExecutions -> ShowS)
-> (ListOpenWorkflowExecutions -> String)
-> ([ListOpenWorkflowExecutions] -> ShowS)
-> Show ListOpenWorkflowExecutions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListOpenWorkflowExecutions] -> ShowS
$cshowList :: [ListOpenWorkflowExecutions] -> ShowS
show :: ListOpenWorkflowExecutions -> String
$cshow :: ListOpenWorkflowExecutions -> String
showsPrec :: Int -> ListOpenWorkflowExecutions -> ShowS
$cshowsPrec :: Int -> ListOpenWorkflowExecutions -> ShowS
Prelude.Show, (forall x.
 ListOpenWorkflowExecutions -> Rep ListOpenWorkflowExecutions x)
-> (forall x.
    Rep ListOpenWorkflowExecutions x -> ListOpenWorkflowExecutions)
-> Generic ListOpenWorkflowExecutions
forall x.
Rep ListOpenWorkflowExecutions x -> ListOpenWorkflowExecutions
forall x.
ListOpenWorkflowExecutions -> Rep ListOpenWorkflowExecutions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListOpenWorkflowExecutions x -> ListOpenWorkflowExecutions
$cfrom :: forall x.
ListOpenWorkflowExecutions -> Rep ListOpenWorkflowExecutions x
Prelude.Generic)

-- |
-- Create a value of 'ListOpenWorkflowExecutions' 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:
--
-- 'nextPageToken', 'listOpenWorkflowExecutions_nextPageToken' - If @NextPageToken@ is returned there are more results available. The
-- value of @NextPageToken@ is a unique pagination token for each page.
-- Make the call again using the returned token to retrieve the next page.
-- Keep all other arguments unchanged. Each pagination token expires after
-- 60 seconds. Using an expired pagination token will return a @400@ error:
-- \"@Specified token has exceeded its maximum lifetime@\".
--
-- The configured @maximumPageSize@ determines how many results can be
-- returned in a single call.
--
-- 'executionFilter', 'listOpenWorkflowExecutions_executionFilter' - If specified, only workflow executions matching the workflow ID
-- specified in the filter are returned.
--
-- @executionFilter@, @typeFilter@ and @tagFilter@ are mutually exclusive.
-- You can specify at most one of these in a request.
--
-- 'typeFilter', 'listOpenWorkflowExecutions_typeFilter' - If specified, only executions of the type specified in the filter are
-- returned.
--
-- @executionFilter@, @typeFilter@ and @tagFilter@ are mutually exclusive.
-- You can specify at most one of these in a request.
--
-- 'reverseOrder', 'listOpenWorkflowExecutions_reverseOrder' - When set to @true@, returns the results in reverse order. By default the
-- results are returned in descending order of the start time of the
-- executions.
--
-- 'tagFilter', 'listOpenWorkflowExecutions_tagFilter' - If specified, only executions that have the matching tag are listed.
--
-- @executionFilter@, @typeFilter@ and @tagFilter@ are mutually exclusive.
-- You can specify at most one of these in a request.
--
-- 'maximumPageSize', 'listOpenWorkflowExecutions_maximumPageSize' - The maximum number of results that are returned per call. Use
-- @nextPageToken@ to obtain further pages of results.
--
-- 'domain', 'listOpenWorkflowExecutions_domain' - The name of the domain that contains the workflow executions to list.
--
-- 'startTimeFilter', 'listOpenWorkflowExecutions_startTimeFilter' - Workflow executions are included in the returned results based on
-- whether their start times are within the range specified by this filter.
newListOpenWorkflowExecutions ::
  -- | 'domain'
  Prelude.Text ->
  -- | 'startTimeFilter'
  ExecutionTimeFilter ->
  ListOpenWorkflowExecutions
newListOpenWorkflowExecutions :: Text -> ExecutionTimeFilter -> ListOpenWorkflowExecutions
newListOpenWorkflowExecutions
  Text
pDomain_
  ExecutionTimeFilter
pStartTimeFilter_ =
    ListOpenWorkflowExecutions' :: Maybe Text
-> Maybe WorkflowExecutionFilter
-> Maybe WorkflowTypeFilter
-> Maybe Bool
-> Maybe TagFilter
-> Maybe Natural
-> Text
-> ExecutionTimeFilter
-> ListOpenWorkflowExecutions
ListOpenWorkflowExecutions'
      { $sel:nextPageToken:ListOpenWorkflowExecutions' :: Maybe Text
nextPageToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:executionFilter:ListOpenWorkflowExecutions' :: Maybe WorkflowExecutionFilter
executionFilter = Maybe WorkflowExecutionFilter
forall a. Maybe a
Prelude.Nothing,
        $sel:typeFilter:ListOpenWorkflowExecutions' :: Maybe WorkflowTypeFilter
typeFilter = Maybe WorkflowTypeFilter
forall a. Maybe a
Prelude.Nothing,
        $sel:reverseOrder:ListOpenWorkflowExecutions' :: Maybe Bool
reverseOrder = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:tagFilter:ListOpenWorkflowExecutions' :: Maybe TagFilter
tagFilter = Maybe TagFilter
forall a. Maybe a
Prelude.Nothing,
        $sel:maximumPageSize:ListOpenWorkflowExecutions' :: Maybe Natural
maximumPageSize = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:domain:ListOpenWorkflowExecutions' :: Text
domain = Text
pDomain_,
        $sel:startTimeFilter:ListOpenWorkflowExecutions' :: ExecutionTimeFilter
startTimeFilter = ExecutionTimeFilter
pStartTimeFilter_
      }

-- | If @NextPageToken@ is returned there are more results available. The
-- value of @NextPageToken@ is a unique pagination token for each page.
-- Make the call again using the returned token to retrieve the next page.
-- Keep all other arguments unchanged. Each pagination token expires after
-- 60 seconds. Using an expired pagination token will return a @400@ error:
-- \"@Specified token has exceeded its maximum lifetime@\".
--
-- The configured @maximumPageSize@ determines how many results can be
-- returned in a single call.
listOpenWorkflowExecutions_nextPageToken :: Lens.Lens' ListOpenWorkflowExecutions (Prelude.Maybe Prelude.Text)
listOpenWorkflowExecutions_nextPageToken :: (Maybe Text -> f (Maybe Text))
-> ListOpenWorkflowExecutions -> f ListOpenWorkflowExecutions
listOpenWorkflowExecutions_nextPageToken = (ListOpenWorkflowExecutions -> Maybe Text)
-> (ListOpenWorkflowExecutions
    -> Maybe Text -> ListOpenWorkflowExecutions)
-> Lens
     ListOpenWorkflowExecutions
     ListOpenWorkflowExecutions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOpenWorkflowExecutions' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:ListOpenWorkflowExecutions' :: ListOpenWorkflowExecutions -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: ListOpenWorkflowExecutions
s@ListOpenWorkflowExecutions' {} Maybe Text
a -> ListOpenWorkflowExecutions
s {$sel:nextPageToken:ListOpenWorkflowExecutions' :: Maybe Text
nextPageToken = Maybe Text
a} :: ListOpenWorkflowExecutions)

-- | If specified, only workflow executions matching the workflow ID
-- specified in the filter are returned.
--
-- @executionFilter@, @typeFilter@ and @tagFilter@ are mutually exclusive.
-- You can specify at most one of these in a request.
listOpenWorkflowExecutions_executionFilter :: Lens.Lens' ListOpenWorkflowExecutions (Prelude.Maybe WorkflowExecutionFilter)
listOpenWorkflowExecutions_executionFilter :: (Maybe WorkflowExecutionFilter
 -> f (Maybe WorkflowExecutionFilter))
-> ListOpenWorkflowExecutions -> f ListOpenWorkflowExecutions
listOpenWorkflowExecutions_executionFilter = (ListOpenWorkflowExecutions -> Maybe WorkflowExecutionFilter)
-> (ListOpenWorkflowExecutions
    -> Maybe WorkflowExecutionFilter -> ListOpenWorkflowExecutions)
-> Lens
     ListOpenWorkflowExecutions
     ListOpenWorkflowExecutions
     (Maybe WorkflowExecutionFilter)
     (Maybe WorkflowExecutionFilter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOpenWorkflowExecutions' {Maybe WorkflowExecutionFilter
executionFilter :: Maybe WorkflowExecutionFilter
$sel:executionFilter:ListOpenWorkflowExecutions' :: ListOpenWorkflowExecutions -> Maybe WorkflowExecutionFilter
executionFilter} -> Maybe WorkflowExecutionFilter
executionFilter) (\s :: ListOpenWorkflowExecutions
s@ListOpenWorkflowExecutions' {} Maybe WorkflowExecutionFilter
a -> ListOpenWorkflowExecutions
s {$sel:executionFilter:ListOpenWorkflowExecutions' :: Maybe WorkflowExecutionFilter
executionFilter = Maybe WorkflowExecutionFilter
a} :: ListOpenWorkflowExecutions)

-- | If specified, only executions of the type specified in the filter are
-- returned.
--
-- @executionFilter@, @typeFilter@ and @tagFilter@ are mutually exclusive.
-- You can specify at most one of these in a request.
listOpenWorkflowExecutions_typeFilter :: Lens.Lens' ListOpenWorkflowExecutions (Prelude.Maybe WorkflowTypeFilter)
listOpenWorkflowExecutions_typeFilter :: (Maybe WorkflowTypeFilter -> f (Maybe WorkflowTypeFilter))
-> ListOpenWorkflowExecutions -> f ListOpenWorkflowExecutions
listOpenWorkflowExecutions_typeFilter = (ListOpenWorkflowExecutions -> Maybe WorkflowTypeFilter)
-> (ListOpenWorkflowExecutions
    -> Maybe WorkflowTypeFilter -> ListOpenWorkflowExecutions)
-> Lens
     ListOpenWorkflowExecutions
     ListOpenWorkflowExecutions
     (Maybe WorkflowTypeFilter)
     (Maybe WorkflowTypeFilter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOpenWorkflowExecutions' {Maybe WorkflowTypeFilter
typeFilter :: Maybe WorkflowTypeFilter
$sel:typeFilter:ListOpenWorkflowExecutions' :: ListOpenWorkflowExecutions -> Maybe WorkflowTypeFilter
typeFilter} -> Maybe WorkflowTypeFilter
typeFilter) (\s :: ListOpenWorkflowExecutions
s@ListOpenWorkflowExecutions' {} Maybe WorkflowTypeFilter
a -> ListOpenWorkflowExecutions
s {$sel:typeFilter:ListOpenWorkflowExecutions' :: Maybe WorkflowTypeFilter
typeFilter = Maybe WorkflowTypeFilter
a} :: ListOpenWorkflowExecutions)

-- | When set to @true@, returns the results in reverse order. By default the
-- results are returned in descending order of the start time of the
-- executions.
listOpenWorkflowExecutions_reverseOrder :: Lens.Lens' ListOpenWorkflowExecutions (Prelude.Maybe Prelude.Bool)
listOpenWorkflowExecutions_reverseOrder :: (Maybe Bool -> f (Maybe Bool))
-> ListOpenWorkflowExecutions -> f ListOpenWorkflowExecutions
listOpenWorkflowExecutions_reverseOrder = (ListOpenWorkflowExecutions -> Maybe Bool)
-> (ListOpenWorkflowExecutions
    -> Maybe Bool -> ListOpenWorkflowExecutions)
-> Lens
     ListOpenWorkflowExecutions
     ListOpenWorkflowExecutions
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOpenWorkflowExecutions' {Maybe Bool
reverseOrder :: Maybe Bool
$sel:reverseOrder:ListOpenWorkflowExecutions' :: ListOpenWorkflowExecutions -> Maybe Bool
reverseOrder} -> Maybe Bool
reverseOrder) (\s :: ListOpenWorkflowExecutions
s@ListOpenWorkflowExecutions' {} Maybe Bool
a -> ListOpenWorkflowExecutions
s {$sel:reverseOrder:ListOpenWorkflowExecutions' :: Maybe Bool
reverseOrder = Maybe Bool
a} :: ListOpenWorkflowExecutions)

-- | If specified, only executions that have the matching tag are listed.
--
-- @executionFilter@, @typeFilter@ and @tagFilter@ are mutually exclusive.
-- You can specify at most one of these in a request.
listOpenWorkflowExecutions_tagFilter :: Lens.Lens' ListOpenWorkflowExecutions (Prelude.Maybe TagFilter)
listOpenWorkflowExecutions_tagFilter :: (Maybe TagFilter -> f (Maybe TagFilter))
-> ListOpenWorkflowExecutions -> f ListOpenWorkflowExecutions
listOpenWorkflowExecutions_tagFilter = (ListOpenWorkflowExecutions -> Maybe TagFilter)
-> (ListOpenWorkflowExecutions
    -> Maybe TagFilter -> ListOpenWorkflowExecutions)
-> Lens
     ListOpenWorkflowExecutions
     ListOpenWorkflowExecutions
     (Maybe TagFilter)
     (Maybe TagFilter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOpenWorkflowExecutions' {Maybe TagFilter
tagFilter :: Maybe TagFilter
$sel:tagFilter:ListOpenWorkflowExecutions' :: ListOpenWorkflowExecutions -> Maybe TagFilter
tagFilter} -> Maybe TagFilter
tagFilter) (\s :: ListOpenWorkflowExecutions
s@ListOpenWorkflowExecutions' {} Maybe TagFilter
a -> ListOpenWorkflowExecutions
s {$sel:tagFilter:ListOpenWorkflowExecutions' :: Maybe TagFilter
tagFilter = Maybe TagFilter
a} :: ListOpenWorkflowExecutions)

-- | The maximum number of results that are returned per call. Use
-- @nextPageToken@ to obtain further pages of results.
listOpenWorkflowExecutions_maximumPageSize :: Lens.Lens' ListOpenWorkflowExecutions (Prelude.Maybe Prelude.Natural)
listOpenWorkflowExecutions_maximumPageSize :: (Maybe Natural -> f (Maybe Natural))
-> ListOpenWorkflowExecutions -> f ListOpenWorkflowExecutions
listOpenWorkflowExecutions_maximumPageSize = (ListOpenWorkflowExecutions -> Maybe Natural)
-> (ListOpenWorkflowExecutions
    -> Maybe Natural -> ListOpenWorkflowExecutions)
-> Lens
     ListOpenWorkflowExecutions
     ListOpenWorkflowExecutions
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOpenWorkflowExecutions' {Maybe Natural
maximumPageSize :: Maybe Natural
$sel:maximumPageSize:ListOpenWorkflowExecutions' :: ListOpenWorkflowExecutions -> Maybe Natural
maximumPageSize} -> Maybe Natural
maximumPageSize) (\s :: ListOpenWorkflowExecutions
s@ListOpenWorkflowExecutions' {} Maybe Natural
a -> ListOpenWorkflowExecutions
s {$sel:maximumPageSize:ListOpenWorkflowExecutions' :: Maybe Natural
maximumPageSize = Maybe Natural
a} :: ListOpenWorkflowExecutions)

-- | The name of the domain that contains the workflow executions to list.
listOpenWorkflowExecutions_domain :: Lens.Lens' ListOpenWorkflowExecutions Prelude.Text
listOpenWorkflowExecutions_domain :: (Text -> f Text)
-> ListOpenWorkflowExecutions -> f ListOpenWorkflowExecutions
listOpenWorkflowExecutions_domain = (ListOpenWorkflowExecutions -> Text)
-> (ListOpenWorkflowExecutions
    -> Text -> ListOpenWorkflowExecutions)
-> Lens
     ListOpenWorkflowExecutions ListOpenWorkflowExecutions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOpenWorkflowExecutions' {Text
domain :: Text
$sel:domain:ListOpenWorkflowExecutions' :: ListOpenWorkflowExecutions -> Text
domain} -> Text
domain) (\s :: ListOpenWorkflowExecutions
s@ListOpenWorkflowExecutions' {} Text
a -> ListOpenWorkflowExecutions
s {$sel:domain:ListOpenWorkflowExecutions' :: Text
domain = Text
a} :: ListOpenWorkflowExecutions)

-- | Workflow executions are included in the returned results based on
-- whether their start times are within the range specified by this filter.
listOpenWorkflowExecutions_startTimeFilter :: Lens.Lens' ListOpenWorkflowExecutions ExecutionTimeFilter
listOpenWorkflowExecutions_startTimeFilter :: (ExecutionTimeFilter -> f ExecutionTimeFilter)
-> ListOpenWorkflowExecutions -> f ListOpenWorkflowExecutions
listOpenWorkflowExecutions_startTimeFilter = (ListOpenWorkflowExecutions -> ExecutionTimeFilter)
-> (ListOpenWorkflowExecutions
    -> ExecutionTimeFilter -> ListOpenWorkflowExecutions)
-> Lens
     ListOpenWorkflowExecutions
     ListOpenWorkflowExecutions
     ExecutionTimeFilter
     ExecutionTimeFilter
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOpenWorkflowExecutions' {ExecutionTimeFilter
startTimeFilter :: ExecutionTimeFilter
$sel:startTimeFilter:ListOpenWorkflowExecutions' :: ListOpenWorkflowExecutions -> ExecutionTimeFilter
startTimeFilter} -> ExecutionTimeFilter
startTimeFilter) (\s :: ListOpenWorkflowExecutions
s@ListOpenWorkflowExecutions' {} ExecutionTimeFilter
a -> ListOpenWorkflowExecutions
s {$sel:startTimeFilter:ListOpenWorkflowExecutions' :: ExecutionTimeFilter
startTimeFilter = ExecutionTimeFilter
a} :: ListOpenWorkflowExecutions)

instance Core.AWSPager ListOpenWorkflowExecutions where
  page :: ListOpenWorkflowExecutions
-> AWSResponse ListOpenWorkflowExecutions
-> Maybe ListOpenWorkflowExecutions
page ListOpenWorkflowExecutions
rq AWSResponse ListOpenWorkflowExecutions
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListOpenWorkflowExecutions
WorkflowExecutionInfos
rs
            WorkflowExecutionInfos
-> Getting (First Text) WorkflowExecutionInfos Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> WorkflowExecutionInfos
-> Const (First Text) WorkflowExecutionInfos
Lens' WorkflowExecutionInfos (Maybe Text)
workflowExecutionInfos_nextPageToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> WorkflowExecutionInfos
 -> Const (First Text) WorkflowExecutionInfos)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) WorkflowExecutionInfos 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 ListOpenWorkflowExecutions
forall a. Maybe a
Prelude.Nothing
    | [WorkflowExecutionInfo] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        (AWSResponse ListOpenWorkflowExecutions
WorkflowExecutionInfos
rs WorkflowExecutionInfos
-> Getting
     [WorkflowExecutionInfo]
     WorkflowExecutionInfos
     [WorkflowExecutionInfo]
-> [WorkflowExecutionInfo]
forall s a. s -> Getting a s a -> a
Lens.^. Getting
  [WorkflowExecutionInfo]
  WorkflowExecutionInfos
  [WorkflowExecutionInfo]
Lens' WorkflowExecutionInfos [WorkflowExecutionInfo]
workflowExecutionInfos_executionInfos) =
      Maybe ListOpenWorkflowExecutions
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListOpenWorkflowExecutions -> Maybe ListOpenWorkflowExecutions
forall a. a -> Maybe a
Prelude.Just (ListOpenWorkflowExecutions -> Maybe ListOpenWorkflowExecutions)
-> ListOpenWorkflowExecutions -> Maybe ListOpenWorkflowExecutions
forall a b. (a -> b) -> a -> b
Prelude.$
        ListOpenWorkflowExecutions
rq
          ListOpenWorkflowExecutions
-> (ListOpenWorkflowExecutions -> ListOpenWorkflowExecutions)
-> ListOpenWorkflowExecutions
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListOpenWorkflowExecutions
-> Identity ListOpenWorkflowExecutions
Lens
  ListOpenWorkflowExecutions
  ListOpenWorkflowExecutions
  (Maybe Text)
  (Maybe Text)
listOpenWorkflowExecutions_nextPageToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListOpenWorkflowExecutions
 -> Identity ListOpenWorkflowExecutions)
-> Maybe Text
-> ListOpenWorkflowExecutions
-> ListOpenWorkflowExecutions
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListOpenWorkflowExecutions
WorkflowExecutionInfos
rs
          WorkflowExecutionInfos
-> Getting (First Text) WorkflowExecutionInfos Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> WorkflowExecutionInfos
-> Const (First Text) WorkflowExecutionInfos
Lens' WorkflowExecutionInfos (Maybe Text)
workflowExecutionInfos_nextPageToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> WorkflowExecutionInfos
 -> Const (First Text) WorkflowExecutionInfos)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) WorkflowExecutionInfos 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 ListOpenWorkflowExecutions where
  type
    AWSResponse ListOpenWorkflowExecutions =
      WorkflowExecutionInfos
  request :: ListOpenWorkflowExecutions -> Request ListOpenWorkflowExecutions
request = Service
-> ListOpenWorkflowExecutions -> Request ListOpenWorkflowExecutions
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListOpenWorkflowExecutions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListOpenWorkflowExecutions)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListOpenWorkflowExecutions))
-> Logger
-> Service
-> Proxy ListOpenWorkflowExecutions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListOpenWorkflowExecutions)))
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 -> Object -> Either String WorkflowExecutionInfos
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)

instance Prelude.Hashable ListOpenWorkflowExecutions

instance Prelude.NFData ListOpenWorkflowExecutions

instance Core.ToHeaders ListOpenWorkflowExecutions where
  toHeaders :: ListOpenWorkflowExecutions -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListOpenWorkflowExecutions -> 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
"SimpleWorkflowService.ListOpenWorkflowExecutions" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON ListOpenWorkflowExecutions where
  toJSON :: ListOpenWorkflowExecutions -> Value
toJSON ListOpenWorkflowExecutions' {Maybe Bool
Maybe Natural
Maybe Text
Maybe TagFilter
Maybe WorkflowExecutionFilter
Maybe WorkflowTypeFilter
Text
ExecutionTimeFilter
startTimeFilter :: ExecutionTimeFilter
domain :: Text
maximumPageSize :: Maybe Natural
tagFilter :: Maybe TagFilter
reverseOrder :: Maybe Bool
typeFilter :: Maybe WorkflowTypeFilter
executionFilter :: Maybe WorkflowExecutionFilter
nextPageToken :: Maybe Text
$sel:startTimeFilter:ListOpenWorkflowExecutions' :: ListOpenWorkflowExecutions -> ExecutionTimeFilter
$sel:domain:ListOpenWorkflowExecutions' :: ListOpenWorkflowExecutions -> Text
$sel:maximumPageSize:ListOpenWorkflowExecutions' :: ListOpenWorkflowExecutions -> Maybe Natural
$sel:tagFilter:ListOpenWorkflowExecutions' :: ListOpenWorkflowExecutions -> Maybe TagFilter
$sel:reverseOrder:ListOpenWorkflowExecutions' :: ListOpenWorkflowExecutions -> Maybe Bool
$sel:typeFilter:ListOpenWorkflowExecutions' :: ListOpenWorkflowExecutions -> Maybe WorkflowTypeFilter
$sel:executionFilter:ListOpenWorkflowExecutions' :: ListOpenWorkflowExecutions -> Maybe WorkflowExecutionFilter
$sel:nextPageToken:ListOpenWorkflowExecutions' :: ListOpenWorkflowExecutions -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"nextPageToken" 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
nextPageToken,
            (Text
"executionFilter" Text -> WorkflowExecutionFilter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (WorkflowExecutionFilter -> Pair)
-> Maybe WorkflowExecutionFilter -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe WorkflowExecutionFilter
executionFilter,
            (Text
"typeFilter" Text -> WorkflowTypeFilter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (WorkflowTypeFilter -> Pair)
-> Maybe WorkflowTypeFilter -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe WorkflowTypeFilter
typeFilter,
            (Text
"reverseOrder" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
reverseOrder,
            (Text
"tagFilter" Text -> TagFilter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (TagFilter -> Pair) -> Maybe TagFilter -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TagFilter
tagFilter,
            (Text
"maximumPageSize" 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
maximumPageSize,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"domain" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
domain),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"startTimeFilter" Text -> ExecutionTimeFilter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ExecutionTimeFilter
startTimeFilter)
          ]
      )

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

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