{-# 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.NetworkFirewall.Types.PublishMetricAction where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.NetworkFirewall.Types.Dimension
import qualified Amazonka.Prelude as Prelude
data PublishMetricAction = PublishMetricAction'
{ PublishMetricAction -> NonEmpty Dimension
dimensions :: Prelude.NonEmpty Dimension
}
deriving (PublishMetricAction -> PublishMetricAction -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PublishMetricAction -> PublishMetricAction -> Bool
$c/= :: PublishMetricAction -> PublishMetricAction -> Bool
== :: PublishMetricAction -> PublishMetricAction -> Bool
$c== :: PublishMetricAction -> PublishMetricAction -> Bool
Prelude.Eq, ReadPrec [PublishMetricAction]
ReadPrec PublishMetricAction
Int -> ReadS PublishMetricAction
ReadS [PublishMetricAction]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PublishMetricAction]
$creadListPrec :: ReadPrec [PublishMetricAction]
readPrec :: ReadPrec PublishMetricAction
$creadPrec :: ReadPrec PublishMetricAction
readList :: ReadS [PublishMetricAction]
$creadList :: ReadS [PublishMetricAction]
readsPrec :: Int -> ReadS PublishMetricAction
$creadsPrec :: Int -> ReadS PublishMetricAction
Prelude.Read, Int -> PublishMetricAction -> ShowS
[PublishMetricAction] -> ShowS
PublishMetricAction -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PublishMetricAction] -> ShowS
$cshowList :: [PublishMetricAction] -> ShowS
show :: PublishMetricAction -> String
$cshow :: PublishMetricAction -> String
showsPrec :: Int -> PublishMetricAction -> ShowS
$cshowsPrec :: Int -> PublishMetricAction -> ShowS
Prelude.Show, forall x. Rep PublishMetricAction x -> PublishMetricAction
forall x. PublishMetricAction -> Rep PublishMetricAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PublishMetricAction x -> PublishMetricAction
$cfrom :: forall x. PublishMetricAction -> Rep PublishMetricAction x
Prelude.Generic)
newPublishMetricAction ::
Prelude.NonEmpty Dimension ->
PublishMetricAction
newPublishMetricAction :: NonEmpty Dimension -> PublishMetricAction
newPublishMetricAction NonEmpty Dimension
pDimensions_ =
PublishMetricAction'
{ $sel:dimensions:PublishMetricAction' :: NonEmpty Dimension
dimensions =
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Dimension
pDimensions_
}
publishMetricAction_dimensions :: Lens.Lens' PublishMetricAction (Prelude.NonEmpty Dimension)
publishMetricAction_dimensions :: Lens' PublishMetricAction (NonEmpty Dimension)
publishMetricAction_dimensions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublishMetricAction' {NonEmpty Dimension
dimensions :: NonEmpty Dimension
$sel:dimensions:PublishMetricAction' :: PublishMetricAction -> NonEmpty Dimension
dimensions} -> NonEmpty Dimension
dimensions) (\s :: PublishMetricAction
s@PublishMetricAction' {} NonEmpty Dimension
a -> PublishMetricAction
s {$sel:dimensions:PublishMetricAction' :: NonEmpty Dimension
dimensions = NonEmpty Dimension
a} :: PublishMetricAction) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON PublishMetricAction where
parseJSON :: Value -> Parser PublishMetricAction
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"PublishMetricAction"
( \Object
x ->
NonEmpty Dimension -> PublishMetricAction
PublishMetricAction'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Dimensions")
)
instance Prelude.Hashable PublishMetricAction where
hashWithSalt :: Int -> PublishMetricAction -> Int
hashWithSalt Int
_salt PublishMetricAction' {NonEmpty Dimension
dimensions :: NonEmpty Dimension
$sel:dimensions:PublishMetricAction' :: PublishMetricAction -> NonEmpty Dimension
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Dimension
dimensions
instance Prelude.NFData PublishMetricAction where
rnf :: PublishMetricAction -> ()
rnf PublishMetricAction' {NonEmpty Dimension
dimensions :: NonEmpty Dimension
$sel:dimensions:PublishMetricAction' :: PublishMetricAction -> NonEmpty Dimension
..} = forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Dimension
dimensions
instance Data.ToJSON PublishMetricAction where
toJSON :: PublishMetricAction -> Value
toJSON PublishMetricAction' {NonEmpty Dimension
dimensions :: NonEmpty Dimension
$sel:dimensions:PublishMetricAction' :: PublishMetricAction -> NonEmpty Dimension
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"Dimensions" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Dimension
dimensions)]
)