{-# 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.TagFilter
-- 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.TagFilter 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 based on a
-- tag.
--
-- /See:/ 'newTagFilter' smart constructor.
data TagFilter = TagFilter'
  { -- | Specifies the tag that must be associated with the execution for it to
    -- meet the filter criteria.
    --
    -- Tags may only contain unicode letters, digits, whitespace, or these
    -- symbols: @_ . : \/ = + - \@@.
    TagFilter -> Text
tag :: Prelude.Text
  }
  deriving (TagFilter -> TagFilter -> Bool
(TagFilter -> TagFilter -> Bool)
-> (TagFilter -> TagFilter -> Bool) -> Eq TagFilter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TagFilter -> TagFilter -> Bool
$c/= :: TagFilter -> TagFilter -> Bool
== :: TagFilter -> TagFilter -> Bool
$c== :: TagFilter -> TagFilter -> Bool
Prelude.Eq, ReadPrec [TagFilter]
ReadPrec TagFilter
Int -> ReadS TagFilter
ReadS [TagFilter]
(Int -> ReadS TagFilter)
-> ReadS [TagFilter]
-> ReadPrec TagFilter
-> ReadPrec [TagFilter]
-> Read TagFilter
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TagFilter]
$creadListPrec :: ReadPrec [TagFilter]
readPrec :: ReadPrec TagFilter
$creadPrec :: ReadPrec TagFilter
readList :: ReadS [TagFilter]
$creadList :: ReadS [TagFilter]
readsPrec :: Int -> ReadS TagFilter
$creadsPrec :: Int -> ReadS TagFilter
Prelude.Read, Int -> TagFilter -> ShowS
[TagFilter] -> ShowS
TagFilter -> String
(Int -> TagFilter -> ShowS)
-> (TagFilter -> String)
-> ([TagFilter] -> ShowS)
-> Show TagFilter
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TagFilter] -> ShowS
$cshowList :: [TagFilter] -> ShowS
show :: TagFilter -> String
$cshow :: TagFilter -> String
showsPrec :: Int -> TagFilter -> ShowS
$cshowsPrec :: Int -> TagFilter -> ShowS
Prelude.Show, (forall x. TagFilter -> Rep TagFilter x)
-> (forall x. Rep TagFilter x -> TagFilter) -> Generic TagFilter
forall x. Rep TagFilter x -> TagFilter
forall x. TagFilter -> Rep TagFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TagFilter x -> TagFilter
$cfrom :: forall x. TagFilter -> Rep TagFilter x
Prelude.Generic)

-- |
-- Create a value of 'TagFilter' 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:
--
-- 'tag', 'tagFilter_tag' - Specifies the tag that must be associated with the execution for it to
-- meet the filter criteria.
--
-- Tags may only contain unicode letters, digits, whitespace, or these
-- symbols: @_ . : \/ = + - \@@.
newTagFilter ::
  -- | 'tag'
  Prelude.Text ->
  TagFilter
newTagFilter :: Text -> TagFilter
newTagFilter Text
pTag_ = TagFilter' :: Text -> TagFilter
TagFilter' {$sel:tag:TagFilter' :: Text
tag = Text
pTag_}

-- | Specifies the tag that must be associated with the execution for it to
-- meet the filter criteria.
--
-- Tags may only contain unicode letters, digits, whitespace, or these
-- symbols: @_ . : \/ = + - \@@.
tagFilter_tag :: Lens.Lens' TagFilter Prelude.Text
tagFilter_tag :: (Text -> f Text) -> TagFilter -> f TagFilter
tagFilter_tag = (TagFilter -> Text)
-> (TagFilter -> Text -> TagFilter)
-> Lens TagFilter TagFilter Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TagFilter' {Text
tag :: Text
$sel:tag:TagFilter' :: TagFilter -> Text
tag} -> Text
tag) (\s :: TagFilter
s@TagFilter' {} Text
a -> TagFilter
s {$sel:tag:TagFilter' :: Text
tag = Text
a} :: TagFilter)

instance Prelude.Hashable TagFilter

instance Prelude.NFData TagFilter

instance Core.ToJSON TagFilter where
  toJSON :: TagFilter -> Value
toJSON TagFilter' {Text
tag :: Text
$sel:tag:TagFilter' :: TagFilter -> 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
"tag" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
tag)]
      )