{-# 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.MediaStore.Types.MetricPolicyRule where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data MetricPolicyRule = MetricPolicyRule'
{
MetricPolicyRule -> Text
objectGroup :: Prelude.Text,
MetricPolicyRule -> Text
objectGroupName :: Prelude.Text
}
deriving (MetricPolicyRule -> MetricPolicyRule -> Bool
(MetricPolicyRule -> MetricPolicyRule -> Bool)
-> (MetricPolicyRule -> MetricPolicyRule -> Bool)
-> Eq MetricPolicyRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MetricPolicyRule -> MetricPolicyRule -> Bool
$c/= :: MetricPolicyRule -> MetricPolicyRule -> Bool
== :: MetricPolicyRule -> MetricPolicyRule -> Bool
$c== :: MetricPolicyRule -> MetricPolicyRule -> Bool
Prelude.Eq, ReadPrec [MetricPolicyRule]
ReadPrec MetricPolicyRule
Int -> ReadS MetricPolicyRule
ReadS [MetricPolicyRule]
(Int -> ReadS MetricPolicyRule)
-> ReadS [MetricPolicyRule]
-> ReadPrec MetricPolicyRule
-> ReadPrec [MetricPolicyRule]
-> Read MetricPolicyRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MetricPolicyRule]
$creadListPrec :: ReadPrec [MetricPolicyRule]
readPrec :: ReadPrec MetricPolicyRule
$creadPrec :: ReadPrec MetricPolicyRule
readList :: ReadS [MetricPolicyRule]
$creadList :: ReadS [MetricPolicyRule]
readsPrec :: Int -> ReadS MetricPolicyRule
$creadsPrec :: Int -> ReadS MetricPolicyRule
Prelude.Read, Int -> MetricPolicyRule -> ShowS
[MetricPolicyRule] -> ShowS
MetricPolicyRule -> String
(Int -> MetricPolicyRule -> ShowS)
-> (MetricPolicyRule -> String)
-> ([MetricPolicyRule] -> ShowS)
-> Show MetricPolicyRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MetricPolicyRule] -> ShowS
$cshowList :: [MetricPolicyRule] -> ShowS
show :: MetricPolicyRule -> String
$cshow :: MetricPolicyRule -> String
showsPrec :: Int -> MetricPolicyRule -> ShowS
$cshowsPrec :: Int -> MetricPolicyRule -> ShowS
Prelude.Show, (forall x. MetricPolicyRule -> Rep MetricPolicyRule x)
-> (forall x. Rep MetricPolicyRule x -> MetricPolicyRule)
-> Generic MetricPolicyRule
forall x. Rep MetricPolicyRule x -> MetricPolicyRule
forall x. MetricPolicyRule -> Rep MetricPolicyRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MetricPolicyRule x -> MetricPolicyRule
$cfrom :: forall x. MetricPolicyRule -> Rep MetricPolicyRule x
Prelude.Generic)
newMetricPolicyRule ::
Prelude.Text ->
Prelude.Text ->
MetricPolicyRule
newMetricPolicyRule :: Text -> Text -> MetricPolicyRule
newMetricPolicyRule Text
pObjectGroup_ Text
pObjectGroupName_ =
MetricPolicyRule' :: Text -> Text -> MetricPolicyRule
MetricPolicyRule'
{ $sel:objectGroup:MetricPolicyRule' :: Text
objectGroup = Text
pObjectGroup_,
$sel:objectGroupName:MetricPolicyRule' :: Text
objectGroupName = Text
pObjectGroupName_
}
metricPolicyRule_objectGroup :: Lens.Lens' MetricPolicyRule Prelude.Text
metricPolicyRule_objectGroup :: (Text -> f Text) -> MetricPolicyRule -> f MetricPolicyRule
metricPolicyRule_objectGroup = (MetricPolicyRule -> Text)
-> (MetricPolicyRule -> Text -> MetricPolicyRule)
-> Lens MetricPolicyRule MetricPolicyRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricPolicyRule' {Text
objectGroup :: Text
$sel:objectGroup:MetricPolicyRule' :: MetricPolicyRule -> Text
objectGroup} -> Text
objectGroup) (\s :: MetricPolicyRule
s@MetricPolicyRule' {} Text
a -> MetricPolicyRule
s {$sel:objectGroup:MetricPolicyRule' :: Text
objectGroup = Text
a} :: MetricPolicyRule)
metricPolicyRule_objectGroupName :: Lens.Lens' MetricPolicyRule Prelude.Text
metricPolicyRule_objectGroupName :: (Text -> f Text) -> MetricPolicyRule -> f MetricPolicyRule
metricPolicyRule_objectGroupName = (MetricPolicyRule -> Text)
-> (MetricPolicyRule -> Text -> MetricPolicyRule)
-> Lens MetricPolicyRule MetricPolicyRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricPolicyRule' {Text
objectGroupName :: Text
$sel:objectGroupName:MetricPolicyRule' :: MetricPolicyRule -> Text
objectGroupName} -> Text
objectGroupName) (\s :: MetricPolicyRule
s@MetricPolicyRule' {} Text
a -> MetricPolicyRule
s {$sel:objectGroupName:MetricPolicyRule' :: Text
objectGroupName = Text
a} :: MetricPolicyRule)
instance Core.FromJSON MetricPolicyRule where
parseJSON :: Value -> Parser MetricPolicyRule
parseJSON =
String
-> (Object -> Parser MetricPolicyRule)
-> Value
-> Parser MetricPolicyRule
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"MetricPolicyRule"
( \Object
x ->
Text -> Text -> MetricPolicyRule
MetricPolicyRule'
(Text -> Text -> MetricPolicyRule)
-> Parser Text -> Parser (Text -> MetricPolicyRule)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ObjectGroup")
Parser (Text -> MetricPolicyRule)
-> Parser Text -> Parser MetricPolicyRule
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
"ObjectGroupName")
)
instance Prelude.Hashable MetricPolicyRule
instance Prelude.NFData MetricPolicyRule
instance Core.ToJSON MetricPolicyRule where
toJSON :: MetricPolicyRule -> Value
toJSON MetricPolicyRule' {Text
objectGroupName :: Text
objectGroup :: Text
$sel:objectGroupName:MetricPolicyRule' :: MetricPolicyRule -> Text
$sel:objectGroup:MetricPolicyRule' :: MetricPolicyRule -> 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
"ObjectGroup" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
objectGroup),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ObjectGroupName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
objectGroupName)
]
)