{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.IoTThingsGraph.UpdateFlowTemplate
(
UpdateFlowTemplate (..),
newUpdateFlowTemplate,
updateFlowTemplate_compatibleNamespaceVersion,
updateFlowTemplate_id,
updateFlowTemplate_definition,
UpdateFlowTemplateResponse (..),
newUpdateFlowTemplateResponse,
updateFlowTemplateResponse_summary,
updateFlowTemplateResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IoTThingsGraph.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data UpdateFlowTemplate = UpdateFlowTemplate'
{
UpdateFlowTemplate -> Maybe Integer
compatibleNamespaceVersion :: Prelude.Maybe Prelude.Integer,
UpdateFlowTemplate -> Text
id :: Prelude.Text,
UpdateFlowTemplate -> DefinitionDocument
definition :: DefinitionDocument
}
deriving (UpdateFlowTemplate -> UpdateFlowTemplate -> Bool
(UpdateFlowTemplate -> UpdateFlowTemplate -> Bool)
-> (UpdateFlowTemplate -> UpdateFlowTemplate -> Bool)
-> Eq UpdateFlowTemplate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFlowTemplate -> UpdateFlowTemplate -> Bool
$c/= :: UpdateFlowTemplate -> UpdateFlowTemplate -> Bool
== :: UpdateFlowTemplate -> UpdateFlowTemplate -> Bool
$c== :: UpdateFlowTemplate -> UpdateFlowTemplate -> Bool
Prelude.Eq, ReadPrec [UpdateFlowTemplate]
ReadPrec UpdateFlowTemplate
Int -> ReadS UpdateFlowTemplate
ReadS [UpdateFlowTemplate]
(Int -> ReadS UpdateFlowTemplate)
-> ReadS [UpdateFlowTemplate]
-> ReadPrec UpdateFlowTemplate
-> ReadPrec [UpdateFlowTemplate]
-> Read UpdateFlowTemplate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateFlowTemplate]
$creadListPrec :: ReadPrec [UpdateFlowTemplate]
readPrec :: ReadPrec UpdateFlowTemplate
$creadPrec :: ReadPrec UpdateFlowTemplate
readList :: ReadS [UpdateFlowTemplate]
$creadList :: ReadS [UpdateFlowTemplate]
readsPrec :: Int -> ReadS UpdateFlowTemplate
$creadsPrec :: Int -> ReadS UpdateFlowTemplate
Prelude.Read, Int -> UpdateFlowTemplate -> ShowS
[UpdateFlowTemplate] -> ShowS
UpdateFlowTemplate -> String
(Int -> UpdateFlowTemplate -> ShowS)
-> (UpdateFlowTemplate -> String)
-> ([UpdateFlowTemplate] -> ShowS)
-> Show UpdateFlowTemplate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFlowTemplate] -> ShowS
$cshowList :: [UpdateFlowTemplate] -> ShowS
show :: UpdateFlowTemplate -> String
$cshow :: UpdateFlowTemplate -> String
showsPrec :: Int -> UpdateFlowTemplate -> ShowS
$cshowsPrec :: Int -> UpdateFlowTemplate -> ShowS
Prelude.Show, (forall x. UpdateFlowTemplate -> Rep UpdateFlowTemplate x)
-> (forall x. Rep UpdateFlowTemplate x -> UpdateFlowTemplate)
-> Generic UpdateFlowTemplate
forall x. Rep UpdateFlowTemplate x -> UpdateFlowTemplate
forall x. UpdateFlowTemplate -> Rep UpdateFlowTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateFlowTemplate x -> UpdateFlowTemplate
$cfrom :: forall x. UpdateFlowTemplate -> Rep UpdateFlowTemplate x
Prelude.Generic)
newUpdateFlowTemplate ::
Prelude.Text ->
DefinitionDocument ->
UpdateFlowTemplate
newUpdateFlowTemplate :: Text -> DefinitionDocument -> UpdateFlowTemplate
newUpdateFlowTemplate Text
pId_ DefinitionDocument
pDefinition_ =
UpdateFlowTemplate' :: Maybe Integer -> Text -> DefinitionDocument -> UpdateFlowTemplate
UpdateFlowTemplate'
{ $sel:compatibleNamespaceVersion:UpdateFlowTemplate' :: Maybe Integer
compatibleNamespaceVersion =
Maybe Integer
forall a. Maybe a
Prelude.Nothing,
$sel:id:UpdateFlowTemplate' :: Text
id = Text
pId_,
$sel:definition:UpdateFlowTemplate' :: DefinitionDocument
definition = DefinitionDocument
pDefinition_
}
updateFlowTemplate_compatibleNamespaceVersion :: Lens.Lens' UpdateFlowTemplate (Prelude.Maybe Prelude.Integer)
updateFlowTemplate_compatibleNamespaceVersion :: (Maybe Integer -> f (Maybe Integer))
-> UpdateFlowTemplate -> f UpdateFlowTemplate
updateFlowTemplate_compatibleNamespaceVersion = (UpdateFlowTemplate -> Maybe Integer)
-> (UpdateFlowTemplate -> Maybe Integer -> UpdateFlowTemplate)
-> Lens
UpdateFlowTemplate
UpdateFlowTemplate
(Maybe Integer)
(Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFlowTemplate' {Maybe Integer
compatibleNamespaceVersion :: Maybe Integer
$sel:compatibleNamespaceVersion:UpdateFlowTemplate' :: UpdateFlowTemplate -> Maybe Integer
compatibleNamespaceVersion} -> Maybe Integer
compatibleNamespaceVersion) (\s :: UpdateFlowTemplate
s@UpdateFlowTemplate' {} Maybe Integer
a -> UpdateFlowTemplate
s {$sel:compatibleNamespaceVersion:UpdateFlowTemplate' :: Maybe Integer
compatibleNamespaceVersion = Maybe Integer
a} :: UpdateFlowTemplate)
updateFlowTemplate_id :: Lens.Lens' UpdateFlowTemplate Prelude.Text
updateFlowTemplate_id :: (Text -> f Text) -> UpdateFlowTemplate -> f UpdateFlowTemplate
updateFlowTemplate_id = (UpdateFlowTemplate -> Text)
-> (UpdateFlowTemplate -> Text -> UpdateFlowTemplate)
-> Lens UpdateFlowTemplate UpdateFlowTemplate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFlowTemplate' {Text
id :: Text
$sel:id:UpdateFlowTemplate' :: UpdateFlowTemplate -> Text
id} -> Text
id) (\s :: UpdateFlowTemplate
s@UpdateFlowTemplate' {} Text
a -> UpdateFlowTemplate
s {$sel:id:UpdateFlowTemplate' :: Text
id = Text
a} :: UpdateFlowTemplate)
updateFlowTemplate_definition :: Lens.Lens' UpdateFlowTemplate DefinitionDocument
updateFlowTemplate_definition :: (DefinitionDocument -> f DefinitionDocument)
-> UpdateFlowTemplate -> f UpdateFlowTemplate
updateFlowTemplate_definition = (UpdateFlowTemplate -> DefinitionDocument)
-> (UpdateFlowTemplate -> DefinitionDocument -> UpdateFlowTemplate)
-> Lens
UpdateFlowTemplate
UpdateFlowTemplate
DefinitionDocument
DefinitionDocument
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFlowTemplate' {DefinitionDocument
definition :: DefinitionDocument
$sel:definition:UpdateFlowTemplate' :: UpdateFlowTemplate -> DefinitionDocument
definition} -> DefinitionDocument
definition) (\s :: UpdateFlowTemplate
s@UpdateFlowTemplate' {} DefinitionDocument
a -> UpdateFlowTemplate
s {$sel:definition:UpdateFlowTemplate' :: DefinitionDocument
definition = DefinitionDocument
a} :: UpdateFlowTemplate)
instance Core.AWSRequest UpdateFlowTemplate where
type
AWSResponse UpdateFlowTemplate =
UpdateFlowTemplateResponse
request :: UpdateFlowTemplate -> Request UpdateFlowTemplate
request = Service -> UpdateFlowTemplate -> Request UpdateFlowTemplate
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateFlowTemplate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateFlowTemplate)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateFlowTemplate))
-> Logger
-> Service
-> Proxy UpdateFlowTemplate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateFlowTemplate)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe FlowTemplateSummary -> Int -> UpdateFlowTemplateResponse
UpdateFlowTemplateResponse'
(Maybe FlowTemplateSummary -> Int -> UpdateFlowTemplateResponse)
-> Either String (Maybe FlowTemplateSummary)
-> Either String (Int -> UpdateFlowTemplateResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe FlowTemplateSummary)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"summary")
Either String (Int -> UpdateFlowTemplateResponse)
-> Either String Int -> Either String UpdateFlowTemplateResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable UpdateFlowTemplate
instance Prelude.NFData UpdateFlowTemplate
instance Core.ToHeaders UpdateFlowTemplate where
toHeaders :: UpdateFlowTemplate -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateFlowTemplate -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"IotThingsGraphFrontEndService.UpdateFlowTemplate" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON UpdateFlowTemplate where
toJSON :: UpdateFlowTemplate -> Value
toJSON UpdateFlowTemplate' {Maybe Integer
Text
DefinitionDocument
definition :: DefinitionDocument
id :: Text
compatibleNamespaceVersion :: Maybe Integer
$sel:definition:UpdateFlowTemplate' :: UpdateFlowTemplate -> DefinitionDocument
$sel:id:UpdateFlowTemplate' :: UpdateFlowTemplate -> Text
$sel:compatibleNamespaceVersion:UpdateFlowTemplate' :: UpdateFlowTemplate -> Maybe Integer
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"compatibleNamespaceVersion" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Integer -> Pair) -> Maybe Integer -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
compatibleNamespaceVersion,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
id),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"definition" Text -> DefinitionDocument -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DefinitionDocument
definition)
]
)
instance Core.ToPath UpdateFlowTemplate where
toPath :: UpdateFlowTemplate -> ByteString
toPath = ByteString -> UpdateFlowTemplate -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateFlowTemplate where
toQuery :: UpdateFlowTemplate -> QueryString
toQuery = QueryString -> UpdateFlowTemplate -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateFlowTemplateResponse = UpdateFlowTemplateResponse'
{
UpdateFlowTemplateResponse -> Maybe FlowTemplateSummary
summary :: Prelude.Maybe FlowTemplateSummary,
UpdateFlowTemplateResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateFlowTemplateResponse -> UpdateFlowTemplateResponse -> Bool
(UpdateFlowTemplateResponse -> UpdateFlowTemplateResponse -> Bool)
-> (UpdateFlowTemplateResponse
-> UpdateFlowTemplateResponse -> Bool)
-> Eq UpdateFlowTemplateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFlowTemplateResponse -> UpdateFlowTemplateResponse -> Bool
$c/= :: UpdateFlowTemplateResponse -> UpdateFlowTemplateResponse -> Bool
== :: UpdateFlowTemplateResponse -> UpdateFlowTemplateResponse -> Bool
$c== :: UpdateFlowTemplateResponse -> UpdateFlowTemplateResponse -> Bool
Prelude.Eq, ReadPrec [UpdateFlowTemplateResponse]
ReadPrec UpdateFlowTemplateResponse
Int -> ReadS UpdateFlowTemplateResponse
ReadS [UpdateFlowTemplateResponse]
(Int -> ReadS UpdateFlowTemplateResponse)
-> ReadS [UpdateFlowTemplateResponse]
-> ReadPrec UpdateFlowTemplateResponse
-> ReadPrec [UpdateFlowTemplateResponse]
-> Read UpdateFlowTemplateResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateFlowTemplateResponse]
$creadListPrec :: ReadPrec [UpdateFlowTemplateResponse]
readPrec :: ReadPrec UpdateFlowTemplateResponse
$creadPrec :: ReadPrec UpdateFlowTemplateResponse
readList :: ReadS [UpdateFlowTemplateResponse]
$creadList :: ReadS [UpdateFlowTemplateResponse]
readsPrec :: Int -> ReadS UpdateFlowTemplateResponse
$creadsPrec :: Int -> ReadS UpdateFlowTemplateResponse
Prelude.Read, Int -> UpdateFlowTemplateResponse -> ShowS
[UpdateFlowTemplateResponse] -> ShowS
UpdateFlowTemplateResponse -> String
(Int -> UpdateFlowTemplateResponse -> ShowS)
-> (UpdateFlowTemplateResponse -> String)
-> ([UpdateFlowTemplateResponse] -> ShowS)
-> Show UpdateFlowTemplateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFlowTemplateResponse] -> ShowS
$cshowList :: [UpdateFlowTemplateResponse] -> ShowS
show :: UpdateFlowTemplateResponse -> String
$cshow :: UpdateFlowTemplateResponse -> String
showsPrec :: Int -> UpdateFlowTemplateResponse -> ShowS
$cshowsPrec :: Int -> UpdateFlowTemplateResponse -> ShowS
Prelude.Show, (forall x.
UpdateFlowTemplateResponse -> Rep UpdateFlowTemplateResponse x)
-> (forall x.
Rep UpdateFlowTemplateResponse x -> UpdateFlowTemplateResponse)
-> Generic UpdateFlowTemplateResponse
forall x.
Rep UpdateFlowTemplateResponse x -> UpdateFlowTemplateResponse
forall x.
UpdateFlowTemplateResponse -> Rep UpdateFlowTemplateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateFlowTemplateResponse x -> UpdateFlowTemplateResponse
$cfrom :: forall x.
UpdateFlowTemplateResponse -> Rep UpdateFlowTemplateResponse x
Prelude.Generic)
newUpdateFlowTemplateResponse ::
Prelude.Int ->
UpdateFlowTemplateResponse
newUpdateFlowTemplateResponse :: Int -> UpdateFlowTemplateResponse
newUpdateFlowTemplateResponse Int
pHttpStatus_ =
UpdateFlowTemplateResponse' :: Maybe FlowTemplateSummary -> Int -> UpdateFlowTemplateResponse
UpdateFlowTemplateResponse'
{ $sel:summary:UpdateFlowTemplateResponse' :: Maybe FlowTemplateSummary
summary =
Maybe FlowTemplateSummary
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateFlowTemplateResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateFlowTemplateResponse_summary :: Lens.Lens' UpdateFlowTemplateResponse (Prelude.Maybe FlowTemplateSummary)
updateFlowTemplateResponse_summary :: (Maybe FlowTemplateSummary -> f (Maybe FlowTemplateSummary))
-> UpdateFlowTemplateResponse -> f UpdateFlowTemplateResponse
updateFlowTemplateResponse_summary = (UpdateFlowTemplateResponse -> Maybe FlowTemplateSummary)
-> (UpdateFlowTemplateResponse
-> Maybe FlowTemplateSummary -> UpdateFlowTemplateResponse)
-> Lens
UpdateFlowTemplateResponse
UpdateFlowTemplateResponse
(Maybe FlowTemplateSummary)
(Maybe FlowTemplateSummary)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFlowTemplateResponse' {Maybe FlowTemplateSummary
summary :: Maybe FlowTemplateSummary
$sel:summary:UpdateFlowTemplateResponse' :: UpdateFlowTemplateResponse -> Maybe FlowTemplateSummary
summary} -> Maybe FlowTemplateSummary
summary) (\s :: UpdateFlowTemplateResponse
s@UpdateFlowTemplateResponse' {} Maybe FlowTemplateSummary
a -> UpdateFlowTemplateResponse
s {$sel:summary:UpdateFlowTemplateResponse' :: Maybe FlowTemplateSummary
summary = Maybe FlowTemplateSummary
a} :: UpdateFlowTemplateResponse)
updateFlowTemplateResponse_httpStatus :: Lens.Lens' UpdateFlowTemplateResponse Prelude.Int
updateFlowTemplateResponse_httpStatus :: (Int -> f Int)
-> UpdateFlowTemplateResponse -> f UpdateFlowTemplateResponse
updateFlowTemplateResponse_httpStatus = (UpdateFlowTemplateResponse -> Int)
-> (UpdateFlowTemplateResponse
-> Int -> UpdateFlowTemplateResponse)
-> Lens
UpdateFlowTemplateResponse UpdateFlowTemplateResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFlowTemplateResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateFlowTemplateResponse' :: UpdateFlowTemplateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateFlowTemplateResponse
s@UpdateFlowTemplateResponse' {} Int
a -> UpdateFlowTemplateResponse
s {$sel:httpStatus:UpdateFlowTemplateResponse' :: Int
httpStatus = Int
a} :: UpdateFlowTemplateResponse)
instance Prelude.NFData UpdateFlowTemplateResponse