{-# 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.SalesforceAction where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data SalesforceAction = SalesforceAction'
{
SalesforceAction -> Text
token :: Prelude.Text,
SalesforceAction -> Text
url :: Prelude.Text
}
deriving (SalesforceAction -> SalesforceAction -> Bool
(SalesforceAction -> SalesforceAction -> Bool)
-> (SalesforceAction -> SalesforceAction -> Bool)
-> Eq SalesforceAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SalesforceAction -> SalesforceAction -> Bool
$c/= :: SalesforceAction -> SalesforceAction -> Bool
== :: SalesforceAction -> SalesforceAction -> Bool
$c== :: SalesforceAction -> SalesforceAction -> Bool
Prelude.Eq, ReadPrec [SalesforceAction]
ReadPrec SalesforceAction
Int -> ReadS SalesforceAction
ReadS [SalesforceAction]
(Int -> ReadS SalesforceAction)
-> ReadS [SalesforceAction]
-> ReadPrec SalesforceAction
-> ReadPrec [SalesforceAction]
-> Read SalesforceAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SalesforceAction]
$creadListPrec :: ReadPrec [SalesforceAction]
readPrec :: ReadPrec SalesforceAction
$creadPrec :: ReadPrec SalesforceAction
readList :: ReadS [SalesforceAction]
$creadList :: ReadS [SalesforceAction]
readsPrec :: Int -> ReadS SalesforceAction
$creadsPrec :: Int -> ReadS SalesforceAction
Prelude.Read, Int -> SalesforceAction -> ShowS
[SalesforceAction] -> ShowS
SalesforceAction -> String
(Int -> SalesforceAction -> ShowS)
-> (SalesforceAction -> String)
-> ([SalesforceAction] -> ShowS)
-> Show SalesforceAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SalesforceAction] -> ShowS
$cshowList :: [SalesforceAction] -> ShowS
show :: SalesforceAction -> String
$cshow :: SalesforceAction -> String
showsPrec :: Int -> SalesforceAction -> ShowS
$cshowsPrec :: Int -> SalesforceAction -> ShowS
Prelude.Show, (forall x. SalesforceAction -> Rep SalesforceAction x)
-> (forall x. Rep SalesforceAction x -> SalesforceAction)
-> Generic SalesforceAction
forall x. Rep SalesforceAction x -> SalesforceAction
forall x. SalesforceAction -> Rep SalesforceAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SalesforceAction x -> SalesforceAction
$cfrom :: forall x. SalesforceAction -> Rep SalesforceAction x
Prelude.Generic)
newSalesforceAction ::
Prelude.Text ->
Prelude.Text ->
SalesforceAction
newSalesforceAction :: Text -> Text -> SalesforceAction
newSalesforceAction Text
pToken_ Text
pUrl_ =
SalesforceAction' :: Text -> Text -> SalesforceAction
SalesforceAction' {$sel:token:SalesforceAction' :: Text
token = Text
pToken_, $sel:url:SalesforceAction' :: Text
url = Text
pUrl_}
salesforceAction_token :: Lens.Lens' SalesforceAction Prelude.Text
salesforceAction_token :: (Text -> f Text) -> SalesforceAction -> f SalesforceAction
salesforceAction_token = (SalesforceAction -> Text)
-> (SalesforceAction -> Text -> SalesforceAction)
-> Lens SalesforceAction SalesforceAction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SalesforceAction' {Text
token :: Text
$sel:token:SalesforceAction' :: SalesforceAction -> Text
token} -> Text
token) (\s :: SalesforceAction
s@SalesforceAction' {} Text
a -> SalesforceAction
s {$sel:token:SalesforceAction' :: Text
token = Text
a} :: SalesforceAction)
salesforceAction_url :: Lens.Lens' SalesforceAction Prelude.Text
salesforceAction_url :: (Text -> f Text) -> SalesforceAction -> f SalesforceAction
salesforceAction_url = (SalesforceAction -> Text)
-> (SalesforceAction -> Text -> SalesforceAction)
-> Lens SalesforceAction SalesforceAction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SalesforceAction' {Text
url :: Text
$sel:url:SalesforceAction' :: SalesforceAction -> Text
url} -> Text
url) (\s :: SalesforceAction
s@SalesforceAction' {} Text
a -> SalesforceAction
s {$sel:url:SalesforceAction' :: Text
url = Text
a} :: SalesforceAction)
instance Core.FromJSON SalesforceAction where
parseJSON :: Value -> Parser SalesforceAction
parseJSON =
String
-> (Object -> Parser SalesforceAction)
-> Value
-> Parser SalesforceAction
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"SalesforceAction"
( \Object
x ->
Text -> Text -> SalesforceAction
SalesforceAction'
(Text -> Text -> SalesforceAction)
-> Parser Text -> Parser (Text -> SalesforceAction)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"token") Parser (Text -> SalesforceAction)
-> Parser Text -> Parser SalesforceAction
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"url")
)
instance Prelude.Hashable SalesforceAction
instance Prelude.NFData SalesforceAction
instance Core.ToJSON SalesforceAction where
toJSON :: SalesforceAction -> Value
toJSON SalesforceAction' {Text
url :: Text
token :: Text
$sel:url:SalesforceAction' :: SalesforceAction -> Text
$sel:token:SalesforceAction' :: SalesforceAction -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"token" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
token),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"url" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
url)
]
)