{-# 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.SecurityLake.Types.SourceType 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
import Amazonka.SecurityLake.Types.AwsLogSourceType
data SourceType = SourceType'
{
SourceType -> Maybe AwsLogSourceType
awsSourceType :: Prelude.Maybe AwsLogSourceType,
SourceType -> Maybe Text
customSourceType :: Prelude.Maybe Prelude.Text
}
deriving (SourceType -> SourceType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SourceType -> SourceType -> Bool
$c/= :: SourceType -> SourceType -> Bool
== :: SourceType -> SourceType -> Bool
$c== :: SourceType -> SourceType -> Bool
Prelude.Eq, ReadPrec [SourceType]
ReadPrec SourceType
Int -> ReadS SourceType
ReadS [SourceType]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SourceType]
$creadListPrec :: ReadPrec [SourceType]
readPrec :: ReadPrec SourceType
$creadPrec :: ReadPrec SourceType
readList :: ReadS [SourceType]
$creadList :: ReadS [SourceType]
readsPrec :: Int -> ReadS SourceType
$creadsPrec :: Int -> ReadS SourceType
Prelude.Read, Int -> SourceType -> ShowS
[SourceType] -> ShowS
SourceType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SourceType] -> ShowS
$cshowList :: [SourceType] -> ShowS
show :: SourceType -> String
$cshow :: SourceType -> String
showsPrec :: Int -> SourceType -> ShowS
$cshowsPrec :: Int -> SourceType -> ShowS
Prelude.Show, forall x. Rep SourceType x -> SourceType
forall x. SourceType -> Rep SourceType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SourceType x -> SourceType
$cfrom :: forall x. SourceType -> Rep SourceType x
Prelude.Generic)
newSourceType ::
SourceType
newSourceType :: SourceType
newSourceType =
SourceType'
{ $sel:awsSourceType:SourceType' :: Maybe AwsLogSourceType
awsSourceType = forall a. Maybe a
Prelude.Nothing,
$sel:customSourceType:SourceType' :: Maybe Text
customSourceType = forall a. Maybe a
Prelude.Nothing
}
sourceType_awsSourceType :: Lens.Lens' SourceType (Prelude.Maybe AwsLogSourceType)
sourceType_awsSourceType :: Lens' SourceType (Maybe AwsLogSourceType)
sourceType_awsSourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceType' {Maybe AwsLogSourceType
awsSourceType :: Maybe AwsLogSourceType
$sel:awsSourceType:SourceType' :: SourceType -> Maybe AwsLogSourceType
awsSourceType} -> Maybe AwsLogSourceType
awsSourceType) (\s :: SourceType
s@SourceType' {} Maybe AwsLogSourceType
a -> SourceType
s {$sel:awsSourceType:SourceType' :: Maybe AwsLogSourceType
awsSourceType = Maybe AwsLogSourceType
a} :: SourceType)
sourceType_customSourceType :: Lens.Lens' SourceType (Prelude.Maybe Prelude.Text)
sourceType_customSourceType :: Lens' SourceType (Maybe Text)
sourceType_customSourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceType' {Maybe Text
customSourceType :: Maybe Text
$sel:customSourceType:SourceType' :: SourceType -> Maybe Text
customSourceType} -> Maybe Text
customSourceType) (\s :: SourceType
s@SourceType' {} Maybe Text
a -> SourceType
s {$sel:customSourceType:SourceType' :: Maybe Text
customSourceType = Maybe Text
a} :: SourceType)
instance Data.FromJSON SourceType where
parseJSON :: Value -> Parser SourceType
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"SourceType"
( \Object
x ->
Maybe AwsLogSourceType -> Maybe Text -> SourceType
SourceType'
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
"awsSourceType")
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
"customSourceType")
)
instance Prelude.Hashable SourceType where
hashWithSalt :: Int -> SourceType -> Int
hashWithSalt Int
_salt SourceType' {Maybe Text
Maybe AwsLogSourceType
customSourceType :: Maybe Text
awsSourceType :: Maybe AwsLogSourceType
$sel:customSourceType:SourceType' :: SourceType -> Maybe Text
$sel:awsSourceType:SourceType' :: SourceType -> Maybe AwsLogSourceType
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AwsLogSourceType
awsSourceType
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
customSourceType
instance Prelude.NFData SourceType where
rnf :: SourceType -> ()
rnf SourceType' {Maybe Text
Maybe AwsLogSourceType
customSourceType :: Maybe Text
awsSourceType :: Maybe AwsLogSourceType
$sel:customSourceType:SourceType' :: SourceType -> Maybe Text
$sel:awsSourceType:SourceType' :: SourceType -> Maybe AwsLogSourceType
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe AwsLogSourceType
awsSourceType
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
customSourceType
instance Data.ToJSON SourceType where
toJSON :: SourceType -> Value
toJSON SourceType' {Maybe Text
Maybe AwsLogSourceType
customSourceType :: Maybe Text
awsSourceType :: Maybe AwsLogSourceType
$sel:customSourceType:SourceType' :: SourceType -> Maybe Text
$sel:awsSourceType:SourceType' :: SourceType -> Maybe AwsLogSourceType
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"awsSourceType" 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 AwsLogSourceType
awsSourceType,
(Key
"customSourceType" 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
customSourceType
]
)