{-# 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 #-}
module Amazonka.MediaTailor.Types.AvailMatchingCriteria where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaTailor.Types.Operator
import qualified Amazonka.Prelude as Prelude
data AvailMatchingCriteria = AvailMatchingCriteria'
{
AvailMatchingCriteria -> Operator
operator :: Operator,
AvailMatchingCriteria -> Text
dynamicVariable :: Prelude.Text
}
deriving (AvailMatchingCriteria -> AvailMatchingCriteria -> Bool
(AvailMatchingCriteria -> AvailMatchingCriteria -> Bool)
-> (AvailMatchingCriteria -> AvailMatchingCriteria -> Bool)
-> Eq AvailMatchingCriteria
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AvailMatchingCriteria -> AvailMatchingCriteria -> Bool
$c/= :: AvailMatchingCriteria -> AvailMatchingCriteria -> Bool
== :: AvailMatchingCriteria -> AvailMatchingCriteria -> Bool
$c== :: AvailMatchingCriteria -> AvailMatchingCriteria -> Bool
Prelude.Eq, ReadPrec [AvailMatchingCriteria]
ReadPrec AvailMatchingCriteria
Int -> ReadS AvailMatchingCriteria
ReadS [AvailMatchingCriteria]
(Int -> ReadS AvailMatchingCriteria)
-> ReadS [AvailMatchingCriteria]
-> ReadPrec AvailMatchingCriteria
-> ReadPrec [AvailMatchingCriteria]
-> Read AvailMatchingCriteria
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AvailMatchingCriteria]
$creadListPrec :: ReadPrec [AvailMatchingCriteria]
readPrec :: ReadPrec AvailMatchingCriteria
$creadPrec :: ReadPrec AvailMatchingCriteria
readList :: ReadS [AvailMatchingCriteria]
$creadList :: ReadS [AvailMatchingCriteria]
readsPrec :: Int -> ReadS AvailMatchingCriteria
$creadsPrec :: Int -> ReadS AvailMatchingCriteria
Prelude.Read, Int -> AvailMatchingCriteria -> ShowS
[AvailMatchingCriteria] -> ShowS
AvailMatchingCriteria -> String
(Int -> AvailMatchingCriteria -> ShowS)
-> (AvailMatchingCriteria -> String)
-> ([AvailMatchingCriteria] -> ShowS)
-> Show AvailMatchingCriteria
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AvailMatchingCriteria] -> ShowS
$cshowList :: [AvailMatchingCriteria] -> ShowS
show :: AvailMatchingCriteria -> String
$cshow :: AvailMatchingCriteria -> String
showsPrec :: Int -> AvailMatchingCriteria -> ShowS
$cshowsPrec :: Int -> AvailMatchingCriteria -> ShowS
Prelude.Show, (forall x. AvailMatchingCriteria -> Rep AvailMatchingCriteria x)
-> (forall x. Rep AvailMatchingCriteria x -> AvailMatchingCriteria)
-> Generic AvailMatchingCriteria
forall x. Rep AvailMatchingCriteria x -> AvailMatchingCriteria
forall x. AvailMatchingCriteria -> Rep AvailMatchingCriteria x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AvailMatchingCriteria x -> AvailMatchingCriteria
$cfrom :: forall x. AvailMatchingCriteria -> Rep AvailMatchingCriteria x
Prelude.Generic)
newAvailMatchingCriteria ::
Operator ->
Prelude.Text ->
AvailMatchingCriteria
newAvailMatchingCriteria :: Operator -> Text -> AvailMatchingCriteria
newAvailMatchingCriteria Operator
pOperator_ Text
pDynamicVariable_ =
AvailMatchingCriteria' :: Operator -> Text -> AvailMatchingCriteria
AvailMatchingCriteria'
{ $sel:operator:AvailMatchingCriteria' :: Operator
operator = Operator
pOperator_,
$sel:dynamicVariable:AvailMatchingCriteria' :: Text
dynamicVariable = Text
pDynamicVariable_
}
availMatchingCriteria_operator :: Lens.Lens' AvailMatchingCriteria Operator
availMatchingCriteria_operator :: (Operator -> f Operator)
-> AvailMatchingCriteria -> f AvailMatchingCriteria
availMatchingCriteria_operator = (AvailMatchingCriteria -> Operator)
-> (AvailMatchingCriteria -> Operator -> AvailMatchingCriteria)
-> Lens
AvailMatchingCriteria AvailMatchingCriteria Operator Operator
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AvailMatchingCriteria' {Operator
operator :: Operator
$sel:operator:AvailMatchingCriteria' :: AvailMatchingCriteria -> Operator
operator} -> Operator
operator) (\s :: AvailMatchingCriteria
s@AvailMatchingCriteria' {} Operator
a -> AvailMatchingCriteria
s {$sel:operator:AvailMatchingCriteria' :: Operator
operator = Operator
a} :: AvailMatchingCriteria)
availMatchingCriteria_dynamicVariable :: Lens.Lens' AvailMatchingCriteria Prelude.Text
availMatchingCriteria_dynamicVariable :: (Text -> f Text)
-> AvailMatchingCriteria -> f AvailMatchingCriteria
availMatchingCriteria_dynamicVariable = (AvailMatchingCriteria -> Text)
-> (AvailMatchingCriteria -> Text -> AvailMatchingCriteria)
-> Lens AvailMatchingCriteria AvailMatchingCriteria Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AvailMatchingCriteria' {Text
dynamicVariable :: Text
$sel:dynamicVariable:AvailMatchingCriteria' :: AvailMatchingCriteria -> Text
dynamicVariable} -> Text
dynamicVariable) (\s :: AvailMatchingCriteria
s@AvailMatchingCriteria' {} Text
a -> AvailMatchingCriteria
s {$sel:dynamicVariable:AvailMatchingCriteria' :: Text
dynamicVariable = Text
a} :: AvailMatchingCriteria)
instance Core.FromJSON AvailMatchingCriteria where
parseJSON :: Value -> Parser AvailMatchingCriteria
parseJSON =
String
-> (Object -> Parser AvailMatchingCriteria)
-> Value
-> Parser AvailMatchingCriteria
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AvailMatchingCriteria"
( \Object
x ->
Operator -> Text -> AvailMatchingCriteria
AvailMatchingCriteria'
(Operator -> Text -> AvailMatchingCriteria)
-> Parser Operator -> Parser (Text -> AvailMatchingCriteria)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Operator
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Operator")
Parser (Text -> AvailMatchingCriteria)
-> Parser Text -> Parser AvailMatchingCriteria
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"DynamicVariable")
)
instance Prelude.Hashable AvailMatchingCriteria
instance Prelude.NFData AvailMatchingCriteria
instance Core.ToJSON AvailMatchingCriteria where
toJSON :: AvailMatchingCriteria -> Value
toJSON AvailMatchingCriteria' {Text
Operator
dynamicVariable :: Text
operator :: Operator
$sel:dynamicVariable:AvailMatchingCriteria' :: AvailMatchingCriteria -> Text
$sel:operator:AvailMatchingCriteria' :: AvailMatchingCriteria -> Operator
..} =
[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
"Operator" Text -> Operator -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Operator
operator),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"DynamicVariable" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
dynamicVariable)
]
)