{-# 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.SSMIncidents.Types.AttributeValueList
-- 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.SSMIncidents.Types.AttributeValueList where

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

-- | Use the AttributeValueList to filter by string or integer values.
--
-- /See:/ 'newAttributeValueList' smart constructor.
data AttributeValueList = AttributeValueList'
  { -- | The list of string values that the filter matches.
    AttributeValueList -> Maybe [Text]
stringValues :: Prelude.Maybe [Prelude.Text],
    -- | The list of integer values that the filter matches.
    AttributeValueList -> Maybe [Int]
integerValues :: Prelude.Maybe [Prelude.Int]
  }
  deriving (AttributeValueList -> AttributeValueList -> Bool
(AttributeValueList -> AttributeValueList -> Bool)
-> (AttributeValueList -> AttributeValueList -> Bool)
-> Eq AttributeValueList
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttributeValueList -> AttributeValueList -> Bool
$c/= :: AttributeValueList -> AttributeValueList -> Bool
== :: AttributeValueList -> AttributeValueList -> Bool
$c== :: AttributeValueList -> AttributeValueList -> Bool
Prelude.Eq, ReadPrec [AttributeValueList]
ReadPrec AttributeValueList
Int -> ReadS AttributeValueList
ReadS [AttributeValueList]
(Int -> ReadS AttributeValueList)
-> ReadS [AttributeValueList]
-> ReadPrec AttributeValueList
-> ReadPrec [AttributeValueList]
-> Read AttributeValueList
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttributeValueList]
$creadListPrec :: ReadPrec [AttributeValueList]
readPrec :: ReadPrec AttributeValueList
$creadPrec :: ReadPrec AttributeValueList
readList :: ReadS [AttributeValueList]
$creadList :: ReadS [AttributeValueList]
readsPrec :: Int -> ReadS AttributeValueList
$creadsPrec :: Int -> ReadS AttributeValueList
Prelude.Read, Int -> AttributeValueList -> ShowS
[AttributeValueList] -> ShowS
AttributeValueList -> String
(Int -> AttributeValueList -> ShowS)
-> (AttributeValueList -> String)
-> ([AttributeValueList] -> ShowS)
-> Show AttributeValueList
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttributeValueList] -> ShowS
$cshowList :: [AttributeValueList] -> ShowS
show :: AttributeValueList -> String
$cshow :: AttributeValueList -> String
showsPrec :: Int -> AttributeValueList -> ShowS
$cshowsPrec :: Int -> AttributeValueList -> ShowS
Prelude.Show, (forall x. AttributeValueList -> Rep AttributeValueList x)
-> (forall x. Rep AttributeValueList x -> AttributeValueList)
-> Generic AttributeValueList
forall x. Rep AttributeValueList x -> AttributeValueList
forall x. AttributeValueList -> Rep AttributeValueList x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AttributeValueList x -> AttributeValueList
$cfrom :: forall x. AttributeValueList -> Rep AttributeValueList x
Prelude.Generic)

-- |
-- Create a value of 'AttributeValueList' 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:
--
-- 'stringValues', 'attributeValueList_stringValues' - The list of string values that the filter matches.
--
-- 'integerValues', 'attributeValueList_integerValues' - The list of integer values that the filter matches.
newAttributeValueList ::
  AttributeValueList
newAttributeValueList :: AttributeValueList
newAttributeValueList =
  AttributeValueList' :: Maybe [Text] -> Maybe [Int] -> AttributeValueList
AttributeValueList'
    { $sel:stringValues:AttributeValueList' :: Maybe [Text]
stringValues = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:integerValues:AttributeValueList' :: Maybe [Int]
integerValues = Maybe [Int]
forall a. Maybe a
Prelude.Nothing
    }

-- | The list of string values that the filter matches.
attributeValueList_stringValues :: Lens.Lens' AttributeValueList (Prelude.Maybe [Prelude.Text])
attributeValueList_stringValues :: (Maybe [Text] -> f (Maybe [Text]))
-> AttributeValueList -> f AttributeValueList
attributeValueList_stringValues = (AttributeValueList -> Maybe [Text])
-> (AttributeValueList -> Maybe [Text] -> AttributeValueList)
-> Lens
     AttributeValueList AttributeValueList (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttributeValueList' {Maybe [Text]
stringValues :: Maybe [Text]
$sel:stringValues:AttributeValueList' :: AttributeValueList -> Maybe [Text]
stringValues} -> Maybe [Text]
stringValues) (\s :: AttributeValueList
s@AttributeValueList' {} Maybe [Text]
a -> AttributeValueList
s {$sel:stringValues:AttributeValueList' :: Maybe [Text]
stringValues = Maybe [Text]
a} :: AttributeValueList) ((Maybe [Text] -> f (Maybe [Text]))
 -> AttributeValueList -> f AttributeValueList)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> AttributeValueList
-> f AttributeValueList
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The list of integer values that the filter matches.
attributeValueList_integerValues :: Lens.Lens' AttributeValueList (Prelude.Maybe [Prelude.Int])
attributeValueList_integerValues :: (Maybe [Int] -> f (Maybe [Int]))
-> AttributeValueList -> f AttributeValueList
attributeValueList_integerValues = (AttributeValueList -> Maybe [Int])
-> (AttributeValueList -> Maybe [Int] -> AttributeValueList)
-> Lens
     AttributeValueList AttributeValueList (Maybe [Int]) (Maybe [Int])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttributeValueList' {Maybe [Int]
integerValues :: Maybe [Int]
$sel:integerValues:AttributeValueList' :: AttributeValueList -> Maybe [Int]
integerValues} -> Maybe [Int]
integerValues) (\s :: AttributeValueList
s@AttributeValueList' {} Maybe [Int]
a -> AttributeValueList
s {$sel:integerValues:AttributeValueList' :: Maybe [Int]
integerValues = Maybe [Int]
a} :: AttributeValueList) ((Maybe [Int] -> f (Maybe [Int]))
 -> AttributeValueList -> f AttributeValueList)
-> ((Maybe [Int] -> f (Maybe [Int]))
    -> Maybe [Int] -> f (Maybe [Int]))
-> (Maybe [Int] -> f (Maybe [Int]))
-> AttributeValueList
-> f AttributeValueList
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Int] [Int] [Int] [Int]
-> Iso (Maybe [Int]) (Maybe [Int]) (Maybe [Int]) (Maybe [Int])
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 [Int] [Int] [Int] [Int]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.Hashable AttributeValueList

instance Prelude.NFData AttributeValueList

instance Core.ToJSON AttributeValueList where
  toJSON :: AttributeValueList -> Value
toJSON AttributeValueList' {Maybe [Int]
Maybe [Text]
integerValues :: Maybe [Int]
stringValues :: Maybe [Text]
$sel:integerValues:AttributeValueList' :: AttributeValueList -> Maybe [Int]
$sel:stringValues:AttributeValueList' :: AttributeValueList -> Maybe [Text]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"stringValues" 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]
stringValues,
            (Text
"integerValues" Text -> [Int] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Int] -> Pair) -> Maybe [Int] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Int]
integerValues
          ]
      )