{-# 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.IoT.Types.MqttContext 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 MqttContext = MqttContext'
{
MqttContext -> Maybe Text
clientId :: Prelude.Maybe Prelude.Text,
MqttContext -> Maybe Base64
password :: Prelude.Maybe Data.Base64,
MqttContext -> Maybe Text
username :: Prelude.Maybe Prelude.Text
}
deriving (MqttContext -> MqttContext -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MqttContext -> MqttContext -> Bool
$c/= :: MqttContext -> MqttContext -> Bool
== :: MqttContext -> MqttContext -> Bool
$c== :: MqttContext -> MqttContext -> Bool
Prelude.Eq, ReadPrec [MqttContext]
ReadPrec MqttContext
Int -> ReadS MqttContext
ReadS [MqttContext]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MqttContext]
$creadListPrec :: ReadPrec [MqttContext]
readPrec :: ReadPrec MqttContext
$creadPrec :: ReadPrec MqttContext
readList :: ReadS [MqttContext]
$creadList :: ReadS [MqttContext]
readsPrec :: Int -> ReadS MqttContext
$creadsPrec :: Int -> ReadS MqttContext
Prelude.Read, Int -> MqttContext -> ShowS
[MqttContext] -> ShowS
MqttContext -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MqttContext] -> ShowS
$cshowList :: [MqttContext] -> ShowS
show :: MqttContext -> String
$cshow :: MqttContext -> String
showsPrec :: Int -> MqttContext -> ShowS
$cshowsPrec :: Int -> MqttContext -> ShowS
Prelude.Show, forall x. Rep MqttContext x -> MqttContext
forall x. MqttContext -> Rep MqttContext x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MqttContext x -> MqttContext
$cfrom :: forall x. MqttContext -> Rep MqttContext x
Prelude.Generic)
newMqttContext ::
MqttContext
newMqttContext :: MqttContext
newMqttContext =
MqttContext'
{ $sel:clientId:MqttContext' :: Maybe Text
clientId = forall a. Maybe a
Prelude.Nothing,
$sel:password:MqttContext' :: Maybe Base64
password = forall a. Maybe a
Prelude.Nothing,
$sel:username:MqttContext' :: Maybe Text
username = forall a. Maybe a
Prelude.Nothing
}
mqttContext_clientId :: Lens.Lens' MqttContext (Prelude.Maybe Prelude.Text)
mqttContext_clientId :: Lens' MqttContext (Maybe Text)
mqttContext_clientId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MqttContext' {Maybe Text
clientId :: Maybe Text
$sel:clientId:MqttContext' :: MqttContext -> Maybe Text
clientId} -> Maybe Text
clientId) (\s :: MqttContext
s@MqttContext' {} Maybe Text
a -> MqttContext
s {$sel:clientId:MqttContext' :: Maybe Text
clientId = Maybe Text
a} :: MqttContext)
mqttContext_password :: Lens.Lens' MqttContext (Prelude.Maybe Prelude.ByteString)
mqttContext_password :: Lens' MqttContext (Maybe ByteString)
mqttContext_password = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MqttContext' {Maybe Base64
password :: Maybe Base64
$sel:password:MqttContext' :: MqttContext -> Maybe Base64
password} -> Maybe Base64
password) (\s :: MqttContext
s@MqttContext' {} Maybe Base64
a -> MqttContext
s {$sel:password:MqttContext' :: Maybe Base64
password = Maybe Base64
a} :: MqttContext) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping Iso' Base64 ByteString
Data._Base64
mqttContext_username :: Lens.Lens' MqttContext (Prelude.Maybe Prelude.Text)
mqttContext_username :: Lens' MqttContext (Maybe Text)
mqttContext_username = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MqttContext' {Maybe Text
username :: Maybe Text
$sel:username:MqttContext' :: MqttContext -> Maybe Text
username} -> Maybe Text
username) (\s :: MqttContext
s@MqttContext' {} Maybe Text
a -> MqttContext
s {$sel:username:MqttContext' :: Maybe Text
username = Maybe Text
a} :: MqttContext)
instance Prelude.Hashable MqttContext where
hashWithSalt :: Int -> MqttContext -> Int
hashWithSalt Int
_salt MqttContext' {Maybe Text
Maybe Base64
username :: Maybe Text
password :: Maybe Base64
clientId :: Maybe Text
$sel:username:MqttContext' :: MqttContext -> Maybe Text
$sel:password:MqttContext' :: MqttContext -> Maybe Base64
$sel:clientId:MqttContext' :: MqttContext -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Base64
password
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
username
instance Prelude.NFData MqttContext where
rnf :: MqttContext -> ()
rnf MqttContext' {Maybe Text
Maybe Base64
username :: Maybe Text
password :: Maybe Base64
clientId :: Maybe Text
$sel:username:MqttContext' :: MqttContext -> Maybe Text
$sel:password:MqttContext' :: MqttContext -> Maybe Base64
$sel:clientId:MqttContext' :: MqttContext -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Base64
password
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
username
instance Data.ToJSON MqttContext where
toJSON :: MqttContext -> Value
toJSON MqttContext' {Maybe Text
Maybe Base64
username :: Maybe Text
password :: Maybe Base64
clientId :: Maybe Text
$sel:username:MqttContext' :: MqttContext -> Maybe Text
$sel:password:MqttContext' :: MqttContext -> Maybe Base64
$sel:clientId:MqttContext' :: MqttContext -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"clientId" 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
clientId,
(Key
"password" 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 Base64
password,
(Key
"username" 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
username
]
)