{-# 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.IoTFleetWise.Types.CanInterface 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 CanInterface = CanInterface'
{
CanInterface -> Maybe Text
protocolName :: Prelude.Maybe Prelude.Text,
CanInterface -> Maybe Text
protocolVersion :: Prelude.Maybe Prelude.Text,
CanInterface -> Text
name :: Prelude.Text
}
deriving (CanInterface -> CanInterface -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CanInterface -> CanInterface -> Bool
$c/= :: CanInterface -> CanInterface -> Bool
== :: CanInterface -> CanInterface -> Bool
$c== :: CanInterface -> CanInterface -> Bool
Prelude.Eq, ReadPrec [CanInterface]
ReadPrec CanInterface
Int -> ReadS CanInterface
ReadS [CanInterface]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CanInterface]
$creadListPrec :: ReadPrec [CanInterface]
readPrec :: ReadPrec CanInterface
$creadPrec :: ReadPrec CanInterface
readList :: ReadS [CanInterface]
$creadList :: ReadS [CanInterface]
readsPrec :: Int -> ReadS CanInterface
$creadsPrec :: Int -> ReadS CanInterface
Prelude.Read, Int -> CanInterface -> ShowS
[CanInterface] -> ShowS
CanInterface -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CanInterface] -> ShowS
$cshowList :: [CanInterface] -> ShowS
show :: CanInterface -> String
$cshow :: CanInterface -> String
showsPrec :: Int -> CanInterface -> ShowS
$cshowsPrec :: Int -> CanInterface -> ShowS
Prelude.Show, forall x. Rep CanInterface x -> CanInterface
forall x. CanInterface -> Rep CanInterface x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CanInterface x -> CanInterface
$cfrom :: forall x. CanInterface -> Rep CanInterface x
Prelude.Generic)
newCanInterface ::
Prelude.Text ->
CanInterface
newCanInterface :: Text -> CanInterface
newCanInterface Text
pName_ =
CanInterface'
{ $sel:protocolName:CanInterface' :: Maybe Text
protocolName = forall a. Maybe a
Prelude.Nothing,
$sel:protocolVersion:CanInterface' :: Maybe Text
protocolVersion = forall a. Maybe a
Prelude.Nothing,
$sel:name:CanInterface' :: Text
name = Text
pName_
}
canInterface_protocolName :: Lens.Lens' CanInterface (Prelude.Maybe Prelude.Text)
canInterface_protocolName :: Lens' CanInterface (Maybe Text)
canInterface_protocolName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CanInterface' {Maybe Text
protocolName :: Maybe Text
$sel:protocolName:CanInterface' :: CanInterface -> Maybe Text
protocolName} -> Maybe Text
protocolName) (\s :: CanInterface
s@CanInterface' {} Maybe Text
a -> CanInterface
s {$sel:protocolName:CanInterface' :: Maybe Text
protocolName = Maybe Text
a} :: CanInterface)
canInterface_protocolVersion :: Lens.Lens' CanInterface (Prelude.Maybe Prelude.Text)
canInterface_protocolVersion :: Lens' CanInterface (Maybe Text)
canInterface_protocolVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CanInterface' {Maybe Text
protocolVersion :: Maybe Text
$sel:protocolVersion:CanInterface' :: CanInterface -> Maybe Text
protocolVersion} -> Maybe Text
protocolVersion) (\s :: CanInterface
s@CanInterface' {} Maybe Text
a -> CanInterface
s {$sel:protocolVersion:CanInterface' :: Maybe Text
protocolVersion = Maybe Text
a} :: CanInterface)
canInterface_name :: Lens.Lens' CanInterface Prelude.Text
canInterface_name :: Lens' CanInterface Text
canInterface_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CanInterface' {Text
name :: Text
$sel:name:CanInterface' :: CanInterface -> Text
name} -> Text
name) (\s :: CanInterface
s@CanInterface' {} Text
a -> CanInterface
s {$sel:name:CanInterface' :: Text
name = Text
a} :: CanInterface)
instance Data.FromJSON CanInterface where
parseJSON :: Value -> Parser CanInterface
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"CanInterface"
( \Object
x ->
Maybe Text -> Maybe Text -> Text -> CanInterface
CanInterface'
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
"protocolName")
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
"protocolVersion")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"name")
)
instance Prelude.Hashable CanInterface where
hashWithSalt :: Int -> CanInterface -> Int
hashWithSalt Int
_salt CanInterface' {Maybe Text
Text
name :: Text
protocolVersion :: Maybe Text
protocolName :: Maybe Text
$sel:name:CanInterface' :: CanInterface -> Text
$sel:protocolVersion:CanInterface' :: CanInterface -> Maybe Text
$sel:protocolName:CanInterface' :: CanInterface -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
protocolName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
protocolVersion
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
instance Prelude.NFData CanInterface where
rnf :: CanInterface -> ()
rnf CanInterface' {Maybe Text
Text
name :: Text
protocolVersion :: Maybe Text
protocolName :: Maybe Text
$sel:name:CanInterface' :: CanInterface -> Text
$sel:protocolVersion:CanInterface' :: CanInterface -> Maybe Text
$sel:protocolName:CanInterface' :: CanInterface -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
protocolName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
protocolVersion
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
instance Data.ToJSON CanInterface where
toJSON :: CanInterface -> Value
toJSON CanInterface' {Maybe Text
Text
name :: Text
protocolVersion :: Maybe Text
protocolName :: Maybe Text
$sel:name:CanInterface' :: CanInterface -> Text
$sel:protocolVersion:CanInterface' :: CanInterface -> Maybe Text
$sel:protocolName:CanInterface' :: CanInterface -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"protocolName" 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
protocolName,
(Key
"protocolVersion" 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
protocolVersion,
forall a. a -> Maybe a
Prelude.Just (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)
]
)