{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.SWF.Types.WorkflowExecutionInfos
-- 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)
module Amazonka.SWF.Types.WorkflowExecutionInfos where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SWF.Types.WorkflowExecutionInfo

-- | Contains a paginated list of information about workflow executions.
--
-- /See:/ 'newWorkflowExecutionInfos' smart constructor.
data WorkflowExecutionInfos = WorkflowExecutionInfos'
  { -- | If a @NextPageToken@ was returned by a previous call, there are more
    -- results available. To retrieve the next page of results, make the call
    -- again using the returned token in @nextPageToken@. Keep all other
    -- arguments unchanged.
    --
    -- The configured @maximumPageSize@ determines how many results can be
    -- returned in a single call.
    WorkflowExecutionInfos -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
    -- | The list of workflow information structures.
    WorkflowExecutionInfos -> [WorkflowExecutionInfo]
executionInfos :: [WorkflowExecutionInfo]
  }
  deriving (WorkflowExecutionInfos -> WorkflowExecutionInfos -> Bool
(WorkflowExecutionInfos -> WorkflowExecutionInfos -> Bool)
-> (WorkflowExecutionInfos -> WorkflowExecutionInfos -> Bool)
-> Eq WorkflowExecutionInfos
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkflowExecutionInfos -> WorkflowExecutionInfos -> Bool
$c/= :: WorkflowExecutionInfos -> WorkflowExecutionInfos -> Bool
== :: WorkflowExecutionInfos -> WorkflowExecutionInfos -> Bool
$c== :: WorkflowExecutionInfos -> WorkflowExecutionInfos -> Bool
Prelude.Eq, ReadPrec [WorkflowExecutionInfos]
ReadPrec WorkflowExecutionInfos
Int -> ReadS WorkflowExecutionInfos
ReadS [WorkflowExecutionInfos]
(Int -> ReadS WorkflowExecutionInfos)
-> ReadS [WorkflowExecutionInfos]
-> ReadPrec WorkflowExecutionInfos
-> ReadPrec [WorkflowExecutionInfos]
-> Read WorkflowExecutionInfos
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkflowExecutionInfos]
$creadListPrec :: ReadPrec [WorkflowExecutionInfos]
readPrec :: ReadPrec WorkflowExecutionInfos
$creadPrec :: ReadPrec WorkflowExecutionInfos
readList :: ReadS [WorkflowExecutionInfos]
$creadList :: ReadS [WorkflowExecutionInfos]
readsPrec :: Int -> ReadS WorkflowExecutionInfos
$creadsPrec :: Int -> ReadS WorkflowExecutionInfos
Prelude.Read, Int -> WorkflowExecutionInfos -> ShowS
[WorkflowExecutionInfos] -> ShowS
WorkflowExecutionInfos -> String
(Int -> WorkflowExecutionInfos -> ShowS)
-> (WorkflowExecutionInfos -> String)
-> ([WorkflowExecutionInfos] -> ShowS)
-> Show WorkflowExecutionInfos
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkflowExecutionInfos] -> ShowS
$cshowList :: [WorkflowExecutionInfos] -> ShowS
show :: WorkflowExecutionInfos -> String
$cshow :: WorkflowExecutionInfos -> String
showsPrec :: Int -> WorkflowExecutionInfos -> ShowS
$cshowsPrec :: Int -> WorkflowExecutionInfos -> ShowS
Prelude.Show, (forall x. WorkflowExecutionInfos -> Rep WorkflowExecutionInfos x)
-> (forall x.
    Rep WorkflowExecutionInfos x -> WorkflowExecutionInfos)
-> Generic WorkflowExecutionInfos
forall x. Rep WorkflowExecutionInfos x -> WorkflowExecutionInfos
forall x. WorkflowExecutionInfos -> Rep WorkflowExecutionInfos x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WorkflowExecutionInfos x -> WorkflowExecutionInfos
$cfrom :: forall x. WorkflowExecutionInfos -> Rep WorkflowExecutionInfos x
Prelude.Generic)

-- |
-- Create a value of 'WorkflowExecutionInfos' 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', 'workflowExecutionInfos_nextPageToken' - If a @NextPageToken@ was returned by a previous call, there are more
-- results available. To retrieve the next page of results, make the call
-- again using the returned token in @nextPageToken@. Keep all other
-- arguments unchanged.
--
-- The configured @maximumPageSize@ determines how many results can be
-- returned in a single call.
--
-- 'executionInfos', 'workflowExecutionInfos_executionInfos' - The list of workflow information structures.
newWorkflowExecutionInfos ::
  WorkflowExecutionInfos
newWorkflowExecutionInfos :: WorkflowExecutionInfos
newWorkflowExecutionInfos =
  WorkflowExecutionInfos' :: Maybe Text -> [WorkflowExecutionInfo] -> WorkflowExecutionInfos
WorkflowExecutionInfos'
    { $sel:nextPageToken:WorkflowExecutionInfos' :: Maybe Text
nextPageToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:executionInfos:WorkflowExecutionInfos' :: [WorkflowExecutionInfo]
executionInfos = [WorkflowExecutionInfo]
forall a. Monoid a => a
Prelude.mempty
    }

-- | If a @NextPageToken@ was returned by a previous call, there are more
-- results available. To retrieve the next page of results, make the call
-- again using the returned token in @nextPageToken@. Keep all other
-- arguments unchanged.
--
-- The configured @maximumPageSize@ determines how many results can be
-- returned in a single call.
workflowExecutionInfos_nextPageToken :: Lens.Lens' WorkflowExecutionInfos (Prelude.Maybe Prelude.Text)
workflowExecutionInfos_nextPageToken :: (Maybe Text -> f (Maybe Text))
-> WorkflowExecutionInfos -> f WorkflowExecutionInfos
workflowExecutionInfos_nextPageToken = (WorkflowExecutionInfos -> Maybe Text)
-> (WorkflowExecutionInfos -> Maybe Text -> WorkflowExecutionInfos)
-> Lens
     WorkflowExecutionInfos
     WorkflowExecutionInfos
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowExecutionInfos' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:WorkflowExecutionInfos' :: WorkflowExecutionInfos -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: WorkflowExecutionInfos
s@WorkflowExecutionInfos' {} Maybe Text
a -> WorkflowExecutionInfos
s {$sel:nextPageToken:WorkflowExecutionInfos' :: Maybe Text
nextPageToken = Maybe Text
a} :: WorkflowExecutionInfos)

-- | The list of workflow information structures.
workflowExecutionInfos_executionInfos :: Lens.Lens' WorkflowExecutionInfos [WorkflowExecutionInfo]
workflowExecutionInfos_executionInfos :: ([WorkflowExecutionInfo] -> f [WorkflowExecutionInfo])
-> WorkflowExecutionInfos -> f WorkflowExecutionInfos
workflowExecutionInfos_executionInfos = (WorkflowExecutionInfos -> [WorkflowExecutionInfo])
-> (WorkflowExecutionInfos
    -> [WorkflowExecutionInfo] -> WorkflowExecutionInfos)
-> Lens
     WorkflowExecutionInfos
     WorkflowExecutionInfos
     [WorkflowExecutionInfo]
     [WorkflowExecutionInfo]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowExecutionInfos' {[WorkflowExecutionInfo]
executionInfos :: [WorkflowExecutionInfo]
$sel:executionInfos:WorkflowExecutionInfos' :: WorkflowExecutionInfos -> [WorkflowExecutionInfo]
executionInfos} -> [WorkflowExecutionInfo]
executionInfos) (\s :: WorkflowExecutionInfos
s@WorkflowExecutionInfos' {} [WorkflowExecutionInfo]
a -> WorkflowExecutionInfos
s {$sel:executionInfos:WorkflowExecutionInfos' :: [WorkflowExecutionInfo]
executionInfos = [WorkflowExecutionInfo]
a} :: WorkflowExecutionInfos) (([WorkflowExecutionInfo] -> f [WorkflowExecutionInfo])
 -> WorkflowExecutionInfos -> f WorkflowExecutionInfos)
-> (([WorkflowExecutionInfo] -> f [WorkflowExecutionInfo])
    -> [WorkflowExecutionInfo] -> f [WorkflowExecutionInfo])
-> ([WorkflowExecutionInfo] -> f [WorkflowExecutionInfo])
-> WorkflowExecutionInfos
-> f WorkflowExecutionInfos
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([WorkflowExecutionInfo] -> f [WorkflowExecutionInfo])
-> [WorkflowExecutionInfo] -> f [WorkflowExecutionInfo]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON WorkflowExecutionInfos where
  parseJSON :: Value -> Parser WorkflowExecutionInfos
parseJSON =
    String
-> (Object -> Parser WorkflowExecutionInfos)
-> Value
-> Parser WorkflowExecutionInfos
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"WorkflowExecutionInfos"
      ( \Object
x ->
          Maybe Text -> [WorkflowExecutionInfo] -> WorkflowExecutionInfos
WorkflowExecutionInfos'
            (Maybe Text -> [WorkflowExecutionInfo] -> WorkflowExecutionInfos)
-> Parser (Maybe Text)
-> Parser ([WorkflowExecutionInfo] -> WorkflowExecutionInfos)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"nextPageToken")
            Parser ([WorkflowExecutionInfo] -> WorkflowExecutionInfos)
-> Parser [WorkflowExecutionInfo] -> Parser WorkflowExecutionInfos
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe [WorkflowExecutionInfo])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"executionInfos"
                            Parser (Maybe [WorkflowExecutionInfo])
-> [WorkflowExecutionInfo] -> Parser [WorkflowExecutionInfo]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [WorkflowExecutionInfo]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable WorkflowExecutionInfos

instance Prelude.NFData WorkflowExecutionInfos