{-# 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.WorkflowExecutionFilter
-- 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.WorkflowExecutionFilter where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Used to filter the workflow executions in visibility APIs by their
-- @workflowId@.
--
-- /See:/ 'newWorkflowExecutionFilter' smart constructor.
data WorkflowExecutionFilter = WorkflowExecutionFilter'
  { -- | The workflowId to pass of match the criteria of this filter.
    WorkflowExecutionFilter -> Text
workflowId :: Prelude.Text
  }
  deriving (WorkflowExecutionFilter -> WorkflowExecutionFilter -> Bool
(WorkflowExecutionFilter -> WorkflowExecutionFilter -> Bool)
-> (WorkflowExecutionFilter -> WorkflowExecutionFilter -> Bool)
-> Eq WorkflowExecutionFilter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkflowExecutionFilter -> WorkflowExecutionFilter -> Bool
$c/= :: WorkflowExecutionFilter -> WorkflowExecutionFilter -> Bool
== :: WorkflowExecutionFilter -> WorkflowExecutionFilter -> Bool
$c== :: WorkflowExecutionFilter -> WorkflowExecutionFilter -> Bool
Prelude.Eq, ReadPrec [WorkflowExecutionFilter]
ReadPrec WorkflowExecutionFilter
Int -> ReadS WorkflowExecutionFilter
ReadS [WorkflowExecutionFilter]
(Int -> ReadS WorkflowExecutionFilter)
-> ReadS [WorkflowExecutionFilter]
-> ReadPrec WorkflowExecutionFilter
-> ReadPrec [WorkflowExecutionFilter]
-> Read WorkflowExecutionFilter
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkflowExecutionFilter]
$creadListPrec :: ReadPrec [WorkflowExecutionFilter]
readPrec :: ReadPrec WorkflowExecutionFilter
$creadPrec :: ReadPrec WorkflowExecutionFilter
readList :: ReadS [WorkflowExecutionFilter]
$creadList :: ReadS [WorkflowExecutionFilter]
readsPrec :: Int -> ReadS WorkflowExecutionFilter
$creadsPrec :: Int -> ReadS WorkflowExecutionFilter
Prelude.Read, Int -> WorkflowExecutionFilter -> ShowS
[WorkflowExecutionFilter] -> ShowS
WorkflowExecutionFilter -> String
(Int -> WorkflowExecutionFilter -> ShowS)
-> (WorkflowExecutionFilter -> String)
-> ([WorkflowExecutionFilter] -> ShowS)
-> Show WorkflowExecutionFilter
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkflowExecutionFilter] -> ShowS
$cshowList :: [WorkflowExecutionFilter] -> ShowS
show :: WorkflowExecutionFilter -> String
$cshow :: WorkflowExecutionFilter -> String
showsPrec :: Int -> WorkflowExecutionFilter -> ShowS
$cshowsPrec :: Int -> WorkflowExecutionFilter -> ShowS
Prelude.Show, (forall x.
 WorkflowExecutionFilter -> Rep WorkflowExecutionFilter x)
-> (forall x.
    Rep WorkflowExecutionFilter x -> WorkflowExecutionFilter)
-> Generic WorkflowExecutionFilter
forall x. Rep WorkflowExecutionFilter x -> WorkflowExecutionFilter
forall x. WorkflowExecutionFilter -> Rep WorkflowExecutionFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WorkflowExecutionFilter x -> WorkflowExecutionFilter
$cfrom :: forall x. WorkflowExecutionFilter -> Rep WorkflowExecutionFilter x
Prelude.Generic)

-- |
-- Create a value of 'WorkflowExecutionFilter' 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:
--
-- 'workflowId', 'workflowExecutionFilter_workflowId' - The workflowId to pass of match the criteria of this filter.
newWorkflowExecutionFilter ::
  -- | 'workflowId'
  Prelude.Text ->
  WorkflowExecutionFilter
newWorkflowExecutionFilter :: Text -> WorkflowExecutionFilter
newWorkflowExecutionFilter Text
pWorkflowId_ =
  WorkflowExecutionFilter' :: Text -> WorkflowExecutionFilter
WorkflowExecutionFilter' {$sel:workflowId:WorkflowExecutionFilter' :: Text
workflowId = Text
pWorkflowId_}

-- | The workflowId to pass of match the criteria of this filter.
workflowExecutionFilter_workflowId :: Lens.Lens' WorkflowExecutionFilter Prelude.Text
workflowExecutionFilter_workflowId :: (Text -> f Text)
-> WorkflowExecutionFilter -> f WorkflowExecutionFilter
workflowExecutionFilter_workflowId = (WorkflowExecutionFilter -> Text)
-> (WorkflowExecutionFilter -> Text -> WorkflowExecutionFilter)
-> Lens WorkflowExecutionFilter WorkflowExecutionFilter Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowExecutionFilter' {Text
workflowId :: Text
$sel:workflowId:WorkflowExecutionFilter' :: WorkflowExecutionFilter -> Text
workflowId} -> Text
workflowId) (\s :: WorkflowExecutionFilter
s@WorkflowExecutionFilter' {} Text
a -> WorkflowExecutionFilter
s {$sel:workflowId:WorkflowExecutionFilter' :: Text
workflowId = Text
a} :: WorkflowExecutionFilter)

instance Prelude.Hashable WorkflowExecutionFilter

instance Prelude.NFData WorkflowExecutionFilter

instance Core.ToJSON WorkflowExecutionFilter where
  toJSON :: WorkflowExecutionFilter -> Value
toJSON WorkflowExecutionFilter' {Text
workflowId :: Text
$sel:workflowId:WorkflowExecutionFilter' :: WorkflowExecutionFilter -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"workflowId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
workflowId)]
      )