{-# 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.SourceMetadata where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data SourceMetadata = SourceMetadata'
{
SourceMetadata -> Maybe Text
sourceArn :: Prelude.Maybe Prelude.Text,
SourceMetadata -> Maybe Text
sourceUpdateToken :: Prelude.Maybe Prelude.Text
}
deriving (SourceMetadata -> SourceMetadata -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SourceMetadata -> SourceMetadata -> Bool
$c/= :: SourceMetadata -> SourceMetadata -> Bool
== :: SourceMetadata -> SourceMetadata -> Bool
$c== :: SourceMetadata -> SourceMetadata -> Bool
Prelude.Eq, ReadPrec [SourceMetadata]
ReadPrec SourceMetadata
Int -> ReadS SourceMetadata
ReadS [SourceMetadata]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SourceMetadata]
$creadListPrec :: ReadPrec [SourceMetadata]
readPrec :: ReadPrec SourceMetadata
$creadPrec :: ReadPrec SourceMetadata
readList :: ReadS [SourceMetadata]
$creadList :: ReadS [SourceMetadata]
readsPrec :: Int -> ReadS SourceMetadata
$creadsPrec :: Int -> ReadS SourceMetadata
Prelude.Read, Int -> SourceMetadata -> ShowS
[SourceMetadata] -> ShowS
SourceMetadata -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SourceMetadata] -> ShowS
$cshowList :: [SourceMetadata] -> ShowS
show :: SourceMetadata -> String
$cshow :: SourceMetadata -> String
showsPrec :: Int -> SourceMetadata -> ShowS
$cshowsPrec :: Int -> SourceMetadata -> ShowS
Prelude.Show, forall x. Rep SourceMetadata x -> SourceMetadata
forall x. SourceMetadata -> Rep SourceMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SourceMetadata x -> SourceMetadata
$cfrom :: forall x. SourceMetadata -> Rep SourceMetadata x
Prelude.Generic)
newSourceMetadata ::
SourceMetadata
newSourceMetadata :: SourceMetadata
newSourceMetadata =
SourceMetadata'
{ $sel:sourceArn:SourceMetadata' :: Maybe Text
sourceArn = forall a. Maybe a
Prelude.Nothing,
$sel:sourceUpdateToken:SourceMetadata' :: Maybe Text
sourceUpdateToken = forall a. Maybe a
Prelude.Nothing
}
sourceMetadata_sourceArn :: Lens.Lens' SourceMetadata (Prelude.Maybe Prelude.Text)
sourceMetadata_sourceArn :: Lens' SourceMetadata (Maybe Text)
sourceMetadata_sourceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceMetadata' {Maybe Text
sourceArn :: Maybe Text
$sel:sourceArn:SourceMetadata' :: SourceMetadata -> Maybe Text
sourceArn} -> Maybe Text
sourceArn) (\s :: SourceMetadata
s@SourceMetadata' {} Maybe Text
a -> SourceMetadata
s {$sel:sourceArn:SourceMetadata' :: Maybe Text
sourceArn = Maybe Text
a} :: SourceMetadata)
sourceMetadata_sourceUpdateToken :: Lens.Lens' SourceMetadata (Prelude.Maybe Prelude.Text)
sourceMetadata_sourceUpdateToken :: Lens' SourceMetadata (Maybe Text)
sourceMetadata_sourceUpdateToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceMetadata' {Maybe Text
sourceUpdateToken :: Maybe Text
$sel:sourceUpdateToken:SourceMetadata' :: SourceMetadata -> Maybe Text
sourceUpdateToken} -> Maybe Text
sourceUpdateToken) (\s :: SourceMetadata
s@SourceMetadata' {} Maybe Text
a -> SourceMetadata
s {$sel:sourceUpdateToken:SourceMetadata' :: Maybe Text
sourceUpdateToken = Maybe Text
a} :: SourceMetadata)
instance Data.FromJSON SourceMetadata where
parseJSON :: Value -> Parser SourceMetadata
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"SourceMetadata"
( \Object
x ->
Maybe Text -> Maybe Text -> SourceMetadata
SourceMetadata'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SourceArn")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SourceUpdateToken")
)
instance Prelude.Hashable SourceMetadata where
hashWithSalt :: Int -> SourceMetadata -> Int
hashWithSalt Int
_salt SourceMetadata' {Maybe Text
sourceUpdateToken :: Maybe Text
sourceArn :: Maybe Text
$sel:sourceUpdateToken:SourceMetadata' :: SourceMetadata -> Maybe Text
$sel:sourceArn:SourceMetadata' :: SourceMetadata -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sourceArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sourceUpdateToken
instance Prelude.NFData SourceMetadata where
rnf :: SourceMetadata -> ()
rnf SourceMetadata' {Maybe Text
sourceUpdateToken :: Maybe Text
sourceArn :: Maybe Text
$sel:sourceUpdateToken:SourceMetadata' :: SourceMetadata -> Maybe Text
$sel:sourceArn:SourceMetadata' :: SourceMetadata -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sourceArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sourceUpdateToken
instance Data.ToJSON SourceMetadata where
toJSON :: SourceMetadata -> Value
toJSON SourceMetadata' {Maybe Text
sourceUpdateToken :: Maybe Text
sourceArn :: Maybe Text
$sel:sourceUpdateToken:SourceMetadata' :: SourceMetadata -> Maybe Text
$sel:sourceArn:SourceMetadata' :: SourceMetadata -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"SourceArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
sourceArn,
(Key
"SourceUpdateToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
sourceUpdateToken
]
)