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