{-# 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.UpdateSystemTemplate
(
UpdateSystemTemplate (..),
newUpdateSystemTemplate,
updateSystemTemplate_compatibleNamespaceVersion,
updateSystemTemplate_id,
updateSystemTemplate_definition,
UpdateSystemTemplateResponse (..),
newUpdateSystemTemplateResponse,
updateSystemTemplateResponse_summary,
updateSystemTemplateResponse_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 UpdateSystemTemplate = UpdateSystemTemplate'
{
UpdateSystemTemplate -> Maybe Integer
compatibleNamespaceVersion :: Prelude.Maybe Prelude.Integer,
UpdateSystemTemplate -> Text
id :: Prelude.Text,
UpdateSystemTemplate -> DefinitionDocument
definition :: DefinitionDocument
}
deriving (UpdateSystemTemplate -> UpdateSystemTemplate -> Bool
(UpdateSystemTemplate -> UpdateSystemTemplate -> Bool)
-> (UpdateSystemTemplate -> UpdateSystemTemplate -> Bool)
-> Eq UpdateSystemTemplate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateSystemTemplate -> UpdateSystemTemplate -> Bool
$c/= :: UpdateSystemTemplate -> UpdateSystemTemplate -> Bool
== :: UpdateSystemTemplate -> UpdateSystemTemplate -> Bool
$c== :: UpdateSystemTemplate -> UpdateSystemTemplate -> Bool
Prelude.Eq, ReadPrec [UpdateSystemTemplate]
ReadPrec UpdateSystemTemplate
Int -> ReadS UpdateSystemTemplate
ReadS [UpdateSystemTemplate]
(Int -> ReadS UpdateSystemTemplate)
-> ReadS [UpdateSystemTemplate]
-> ReadPrec UpdateSystemTemplate
-> ReadPrec [UpdateSystemTemplate]
-> Read UpdateSystemTemplate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateSystemTemplate]
$creadListPrec :: ReadPrec [UpdateSystemTemplate]
readPrec :: ReadPrec UpdateSystemTemplate
$creadPrec :: ReadPrec UpdateSystemTemplate
readList :: ReadS [UpdateSystemTemplate]
$creadList :: ReadS [UpdateSystemTemplate]
readsPrec :: Int -> ReadS UpdateSystemTemplate
$creadsPrec :: Int -> ReadS UpdateSystemTemplate
Prelude.Read, Int -> UpdateSystemTemplate -> ShowS
[UpdateSystemTemplate] -> ShowS
UpdateSystemTemplate -> String
(Int -> UpdateSystemTemplate -> ShowS)
-> (UpdateSystemTemplate -> String)
-> ([UpdateSystemTemplate] -> ShowS)
-> Show UpdateSystemTemplate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateSystemTemplate] -> ShowS
$cshowList :: [UpdateSystemTemplate] -> ShowS
show :: UpdateSystemTemplate -> String
$cshow :: UpdateSystemTemplate -> String
showsPrec :: Int -> UpdateSystemTemplate -> ShowS
$cshowsPrec :: Int -> UpdateSystemTemplate -> ShowS
Prelude.Show, (forall x. UpdateSystemTemplate -> Rep UpdateSystemTemplate x)
-> (forall x. Rep UpdateSystemTemplate x -> UpdateSystemTemplate)
-> Generic UpdateSystemTemplate
forall x. Rep UpdateSystemTemplate x -> UpdateSystemTemplate
forall x. UpdateSystemTemplate -> Rep UpdateSystemTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateSystemTemplate x -> UpdateSystemTemplate
$cfrom :: forall x. UpdateSystemTemplate -> Rep UpdateSystemTemplate x
Prelude.Generic)
newUpdateSystemTemplate ::
Prelude.Text ->
DefinitionDocument ->
UpdateSystemTemplate
newUpdateSystemTemplate :: Text -> DefinitionDocument -> UpdateSystemTemplate
newUpdateSystemTemplate Text
pId_ DefinitionDocument
pDefinition_ =
UpdateSystemTemplate' :: Maybe Integer -> Text -> DefinitionDocument -> UpdateSystemTemplate
UpdateSystemTemplate'
{ $sel:compatibleNamespaceVersion:UpdateSystemTemplate' :: Maybe Integer
compatibleNamespaceVersion =
Maybe Integer
forall a. Maybe a
Prelude.Nothing,
$sel:id:UpdateSystemTemplate' :: Text
id = Text
pId_,
$sel:definition:UpdateSystemTemplate' :: DefinitionDocument
definition = DefinitionDocument
pDefinition_
}
updateSystemTemplate_compatibleNamespaceVersion :: Lens.Lens' UpdateSystemTemplate (Prelude.Maybe Prelude.Integer)
updateSystemTemplate_compatibleNamespaceVersion :: (Maybe Integer -> f (Maybe Integer))
-> UpdateSystemTemplate -> f UpdateSystemTemplate
updateSystemTemplate_compatibleNamespaceVersion = (UpdateSystemTemplate -> Maybe Integer)
-> (UpdateSystemTemplate -> Maybe Integer -> UpdateSystemTemplate)
-> Lens
UpdateSystemTemplate
UpdateSystemTemplate
(Maybe Integer)
(Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSystemTemplate' {Maybe Integer
compatibleNamespaceVersion :: Maybe Integer
$sel:compatibleNamespaceVersion:UpdateSystemTemplate' :: UpdateSystemTemplate -> Maybe Integer
compatibleNamespaceVersion} -> Maybe Integer
compatibleNamespaceVersion) (\s :: UpdateSystemTemplate
s@UpdateSystemTemplate' {} Maybe Integer
a -> UpdateSystemTemplate
s {$sel:compatibleNamespaceVersion:UpdateSystemTemplate' :: Maybe Integer
compatibleNamespaceVersion = Maybe Integer
a} :: UpdateSystemTemplate)
updateSystemTemplate_id :: Lens.Lens' UpdateSystemTemplate Prelude.Text
updateSystemTemplate_id :: (Text -> f Text) -> UpdateSystemTemplate -> f UpdateSystemTemplate
updateSystemTemplate_id = (UpdateSystemTemplate -> Text)
-> (UpdateSystemTemplate -> Text -> UpdateSystemTemplate)
-> Lens UpdateSystemTemplate UpdateSystemTemplate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSystemTemplate' {Text
id :: Text
$sel:id:UpdateSystemTemplate' :: UpdateSystemTemplate -> Text
id} -> Text
id) (\s :: UpdateSystemTemplate
s@UpdateSystemTemplate' {} Text
a -> UpdateSystemTemplate
s {$sel:id:UpdateSystemTemplate' :: Text
id = Text
a} :: UpdateSystemTemplate)
updateSystemTemplate_definition :: Lens.Lens' UpdateSystemTemplate DefinitionDocument
updateSystemTemplate_definition :: (DefinitionDocument -> f DefinitionDocument)
-> UpdateSystemTemplate -> f UpdateSystemTemplate
updateSystemTemplate_definition = (UpdateSystemTemplate -> DefinitionDocument)
-> (UpdateSystemTemplate
-> DefinitionDocument -> UpdateSystemTemplate)
-> Lens
UpdateSystemTemplate
UpdateSystemTemplate
DefinitionDocument
DefinitionDocument
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSystemTemplate' {DefinitionDocument
definition :: DefinitionDocument
$sel:definition:UpdateSystemTemplate' :: UpdateSystemTemplate -> DefinitionDocument
definition} -> DefinitionDocument
definition) (\s :: UpdateSystemTemplate
s@UpdateSystemTemplate' {} DefinitionDocument
a -> UpdateSystemTemplate
s {$sel:definition:UpdateSystemTemplate' :: DefinitionDocument
definition = DefinitionDocument
a} :: UpdateSystemTemplate)
instance Core.AWSRequest UpdateSystemTemplate where
type
AWSResponse UpdateSystemTemplate =
UpdateSystemTemplateResponse
request :: UpdateSystemTemplate -> Request UpdateSystemTemplate
request = Service -> UpdateSystemTemplate -> Request UpdateSystemTemplate
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateSystemTemplate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateSystemTemplate)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateSystemTemplate))
-> Logger
-> Service
-> Proxy UpdateSystemTemplate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateSystemTemplate)))
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 SystemTemplateSummary -> Int -> UpdateSystemTemplateResponse
UpdateSystemTemplateResponse'
(Maybe SystemTemplateSummary
-> Int -> UpdateSystemTemplateResponse)
-> Either String (Maybe SystemTemplateSummary)
-> Either String (Int -> UpdateSystemTemplateResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe SystemTemplateSummary)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"summary")
Either String (Int -> UpdateSystemTemplateResponse)
-> Either String Int -> Either String UpdateSystemTemplateResponse
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 UpdateSystemTemplate
instance Prelude.NFData UpdateSystemTemplate
instance Core.ToHeaders UpdateSystemTemplate where
toHeaders :: UpdateSystemTemplate -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateSystemTemplate -> 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.UpdateSystemTemplate" ::
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 UpdateSystemTemplate where
toJSON :: UpdateSystemTemplate -> Value
toJSON UpdateSystemTemplate' {Maybe Integer
Text
DefinitionDocument
definition :: DefinitionDocument
id :: Text
compatibleNamespaceVersion :: Maybe Integer
$sel:definition:UpdateSystemTemplate' :: UpdateSystemTemplate -> DefinitionDocument
$sel:id:UpdateSystemTemplate' :: UpdateSystemTemplate -> Text
$sel:compatibleNamespaceVersion:UpdateSystemTemplate' :: UpdateSystemTemplate -> 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 UpdateSystemTemplate where
toPath :: UpdateSystemTemplate -> ByteString
toPath = ByteString -> UpdateSystemTemplate -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateSystemTemplate where
toQuery :: UpdateSystemTemplate -> QueryString
toQuery = QueryString -> UpdateSystemTemplate -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateSystemTemplateResponse = UpdateSystemTemplateResponse'
{
UpdateSystemTemplateResponse -> Maybe SystemTemplateSummary
summary :: Prelude.Maybe SystemTemplateSummary,
UpdateSystemTemplateResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateSystemTemplateResponse
-> UpdateSystemTemplateResponse -> Bool
(UpdateSystemTemplateResponse
-> UpdateSystemTemplateResponse -> Bool)
-> (UpdateSystemTemplateResponse
-> UpdateSystemTemplateResponse -> Bool)
-> Eq UpdateSystemTemplateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateSystemTemplateResponse
-> UpdateSystemTemplateResponse -> Bool
$c/= :: UpdateSystemTemplateResponse
-> UpdateSystemTemplateResponse -> Bool
== :: UpdateSystemTemplateResponse
-> UpdateSystemTemplateResponse -> Bool
$c== :: UpdateSystemTemplateResponse
-> UpdateSystemTemplateResponse -> Bool
Prelude.Eq, ReadPrec [UpdateSystemTemplateResponse]
ReadPrec UpdateSystemTemplateResponse
Int -> ReadS UpdateSystemTemplateResponse
ReadS [UpdateSystemTemplateResponse]
(Int -> ReadS UpdateSystemTemplateResponse)
-> ReadS [UpdateSystemTemplateResponse]
-> ReadPrec UpdateSystemTemplateResponse
-> ReadPrec [UpdateSystemTemplateResponse]
-> Read UpdateSystemTemplateResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateSystemTemplateResponse]
$creadListPrec :: ReadPrec [UpdateSystemTemplateResponse]
readPrec :: ReadPrec UpdateSystemTemplateResponse
$creadPrec :: ReadPrec UpdateSystemTemplateResponse
readList :: ReadS [UpdateSystemTemplateResponse]
$creadList :: ReadS [UpdateSystemTemplateResponse]
readsPrec :: Int -> ReadS UpdateSystemTemplateResponse
$creadsPrec :: Int -> ReadS UpdateSystemTemplateResponse
Prelude.Read, Int -> UpdateSystemTemplateResponse -> ShowS
[UpdateSystemTemplateResponse] -> ShowS
UpdateSystemTemplateResponse -> String
(Int -> UpdateSystemTemplateResponse -> ShowS)
-> (UpdateSystemTemplateResponse -> String)
-> ([UpdateSystemTemplateResponse] -> ShowS)
-> Show UpdateSystemTemplateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateSystemTemplateResponse] -> ShowS
$cshowList :: [UpdateSystemTemplateResponse] -> ShowS
show :: UpdateSystemTemplateResponse -> String
$cshow :: UpdateSystemTemplateResponse -> String
showsPrec :: Int -> UpdateSystemTemplateResponse -> ShowS
$cshowsPrec :: Int -> UpdateSystemTemplateResponse -> ShowS
Prelude.Show, (forall x.
UpdateSystemTemplateResponse -> Rep UpdateSystemTemplateResponse x)
-> (forall x.
Rep UpdateSystemTemplateResponse x -> UpdateSystemTemplateResponse)
-> Generic UpdateSystemTemplateResponse
forall x.
Rep UpdateSystemTemplateResponse x -> UpdateSystemTemplateResponse
forall x.
UpdateSystemTemplateResponse -> Rep UpdateSystemTemplateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateSystemTemplateResponse x -> UpdateSystemTemplateResponse
$cfrom :: forall x.
UpdateSystemTemplateResponse -> Rep UpdateSystemTemplateResponse x
Prelude.Generic)
newUpdateSystemTemplateResponse ::
Prelude.Int ->
UpdateSystemTemplateResponse
newUpdateSystemTemplateResponse :: Int -> UpdateSystemTemplateResponse
newUpdateSystemTemplateResponse Int
pHttpStatus_ =
UpdateSystemTemplateResponse' :: Maybe SystemTemplateSummary -> Int -> UpdateSystemTemplateResponse
UpdateSystemTemplateResponse'
{ $sel:summary:UpdateSystemTemplateResponse' :: Maybe SystemTemplateSummary
summary =
Maybe SystemTemplateSummary
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateSystemTemplateResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateSystemTemplateResponse_summary :: Lens.Lens' UpdateSystemTemplateResponse (Prelude.Maybe SystemTemplateSummary)
updateSystemTemplateResponse_summary :: (Maybe SystemTemplateSummary -> f (Maybe SystemTemplateSummary))
-> UpdateSystemTemplateResponse -> f UpdateSystemTemplateResponse
updateSystemTemplateResponse_summary = (UpdateSystemTemplateResponse -> Maybe SystemTemplateSummary)
-> (UpdateSystemTemplateResponse
-> Maybe SystemTemplateSummary -> UpdateSystemTemplateResponse)
-> Lens
UpdateSystemTemplateResponse
UpdateSystemTemplateResponse
(Maybe SystemTemplateSummary)
(Maybe SystemTemplateSummary)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSystemTemplateResponse' {Maybe SystemTemplateSummary
summary :: Maybe SystemTemplateSummary
$sel:summary:UpdateSystemTemplateResponse' :: UpdateSystemTemplateResponse -> Maybe SystemTemplateSummary
summary} -> Maybe SystemTemplateSummary
summary) (\s :: UpdateSystemTemplateResponse
s@UpdateSystemTemplateResponse' {} Maybe SystemTemplateSummary
a -> UpdateSystemTemplateResponse
s {$sel:summary:UpdateSystemTemplateResponse' :: Maybe SystemTemplateSummary
summary = Maybe SystemTemplateSummary
a} :: UpdateSystemTemplateResponse)
updateSystemTemplateResponse_httpStatus :: Lens.Lens' UpdateSystemTemplateResponse Prelude.Int
updateSystemTemplateResponse_httpStatus :: (Int -> f Int)
-> UpdateSystemTemplateResponse -> f UpdateSystemTemplateResponse
updateSystemTemplateResponse_httpStatus = (UpdateSystemTemplateResponse -> Int)
-> (UpdateSystemTemplateResponse
-> Int -> UpdateSystemTemplateResponse)
-> Lens
UpdateSystemTemplateResponse UpdateSystemTemplateResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSystemTemplateResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateSystemTemplateResponse' :: UpdateSystemTemplateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateSystemTemplateResponse
s@UpdateSystemTemplateResponse' {} Int
a -> UpdateSystemTemplateResponse
s {$sel:httpStatus:UpdateSystemTemplateResponse' :: Int
httpStatus = Int
a} :: UpdateSystemTemplateResponse)
instance Prelude.NFData UpdateSystemTemplateResponse