{-# 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.Greengrass.UpdateFunctionDefinition
(
UpdateFunctionDefinition (..),
newUpdateFunctionDefinition,
updateFunctionDefinition_name,
updateFunctionDefinition_functionDefinitionId,
UpdateFunctionDefinitionResponse (..),
newUpdateFunctionDefinitionResponse,
updateFunctionDefinitionResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Greengrass.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 UpdateFunctionDefinition = UpdateFunctionDefinition'
{
UpdateFunctionDefinition -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
UpdateFunctionDefinition -> Text
functionDefinitionId :: Prelude.Text
}
deriving (UpdateFunctionDefinition -> UpdateFunctionDefinition -> Bool
(UpdateFunctionDefinition -> UpdateFunctionDefinition -> Bool)
-> (UpdateFunctionDefinition -> UpdateFunctionDefinition -> Bool)
-> Eq UpdateFunctionDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFunctionDefinition -> UpdateFunctionDefinition -> Bool
$c/= :: UpdateFunctionDefinition -> UpdateFunctionDefinition -> Bool
== :: UpdateFunctionDefinition -> UpdateFunctionDefinition -> Bool
$c== :: UpdateFunctionDefinition -> UpdateFunctionDefinition -> Bool
Prelude.Eq, ReadPrec [UpdateFunctionDefinition]
ReadPrec UpdateFunctionDefinition
Int -> ReadS UpdateFunctionDefinition
ReadS [UpdateFunctionDefinition]
(Int -> ReadS UpdateFunctionDefinition)
-> ReadS [UpdateFunctionDefinition]
-> ReadPrec UpdateFunctionDefinition
-> ReadPrec [UpdateFunctionDefinition]
-> Read UpdateFunctionDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateFunctionDefinition]
$creadListPrec :: ReadPrec [UpdateFunctionDefinition]
readPrec :: ReadPrec UpdateFunctionDefinition
$creadPrec :: ReadPrec UpdateFunctionDefinition
readList :: ReadS [UpdateFunctionDefinition]
$creadList :: ReadS [UpdateFunctionDefinition]
readsPrec :: Int -> ReadS UpdateFunctionDefinition
$creadsPrec :: Int -> ReadS UpdateFunctionDefinition
Prelude.Read, Int -> UpdateFunctionDefinition -> ShowS
[UpdateFunctionDefinition] -> ShowS
UpdateFunctionDefinition -> String
(Int -> UpdateFunctionDefinition -> ShowS)
-> (UpdateFunctionDefinition -> String)
-> ([UpdateFunctionDefinition] -> ShowS)
-> Show UpdateFunctionDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFunctionDefinition] -> ShowS
$cshowList :: [UpdateFunctionDefinition] -> ShowS
show :: UpdateFunctionDefinition -> String
$cshow :: UpdateFunctionDefinition -> String
showsPrec :: Int -> UpdateFunctionDefinition -> ShowS
$cshowsPrec :: Int -> UpdateFunctionDefinition -> ShowS
Prelude.Show, (forall x.
UpdateFunctionDefinition -> Rep UpdateFunctionDefinition x)
-> (forall x.
Rep UpdateFunctionDefinition x -> UpdateFunctionDefinition)
-> Generic UpdateFunctionDefinition
forall x.
Rep UpdateFunctionDefinition x -> UpdateFunctionDefinition
forall x.
UpdateFunctionDefinition -> Rep UpdateFunctionDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateFunctionDefinition x -> UpdateFunctionDefinition
$cfrom :: forall x.
UpdateFunctionDefinition -> Rep UpdateFunctionDefinition x
Prelude.Generic)
newUpdateFunctionDefinition ::
Prelude.Text ->
UpdateFunctionDefinition
newUpdateFunctionDefinition :: Text -> UpdateFunctionDefinition
newUpdateFunctionDefinition Text
pFunctionDefinitionId_ =
UpdateFunctionDefinition' :: Maybe Text -> Text -> UpdateFunctionDefinition
UpdateFunctionDefinition'
{ $sel:name:UpdateFunctionDefinition' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:functionDefinitionId:UpdateFunctionDefinition' :: Text
functionDefinitionId = Text
pFunctionDefinitionId_
}
updateFunctionDefinition_name :: Lens.Lens' UpdateFunctionDefinition (Prelude.Maybe Prelude.Text)
updateFunctionDefinition_name :: (Maybe Text -> f (Maybe Text))
-> UpdateFunctionDefinition -> f UpdateFunctionDefinition
updateFunctionDefinition_name = (UpdateFunctionDefinition -> Maybe Text)
-> (UpdateFunctionDefinition
-> Maybe Text -> UpdateFunctionDefinition)
-> Lens
UpdateFunctionDefinition
UpdateFunctionDefinition
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFunctionDefinition' {Maybe Text
name :: Maybe Text
$sel:name:UpdateFunctionDefinition' :: UpdateFunctionDefinition -> Maybe Text
name} -> Maybe Text
name) (\s :: UpdateFunctionDefinition
s@UpdateFunctionDefinition' {} Maybe Text
a -> UpdateFunctionDefinition
s {$sel:name:UpdateFunctionDefinition' :: Maybe Text
name = Maybe Text
a} :: UpdateFunctionDefinition)
updateFunctionDefinition_functionDefinitionId :: Lens.Lens' UpdateFunctionDefinition Prelude.Text
updateFunctionDefinition_functionDefinitionId :: (Text -> f Text)
-> UpdateFunctionDefinition -> f UpdateFunctionDefinition
updateFunctionDefinition_functionDefinitionId = (UpdateFunctionDefinition -> Text)
-> (UpdateFunctionDefinition -> Text -> UpdateFunctionDefinition)
-> Lens UpdateFunctionDefinition UpdateFunctionDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFunctionDefinition' {Text
functionDefinitionId :: Text
$sel:functionDefinitionId:UpdateFunctionDefinition' :: UpdateFunctionDefinition -> Text
functionDefinitionId} -> Text
functionDefinitionId) (\s :: UpdateFunctionDefinition
s@UpdateFunctionDefinition' {} Text
a -> UpdateFunctionDefinition
s {$sel:functionDefinitionId:UpdateFunctionDefinition' :: Text
functionDefinitionId = Text
a} :: UpdateFunctionDefinition)
instance Core.AWSRequest UpdateFunctionDefinition where
type
AWSResponse UpdateFunctionDefinition =
UpdateFunctionDefinitionResponse
request :: UpdateFunctionDefinition -> Request UpdateFunctionDefinition
request = Service
-> UpdateFunctionDefinition -> Request UpdateFunctionDefinition
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateFunctionDefinition
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateFunctionDefinition)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse UpdateFunctionDefinition))
-> Logger
-> Service
-> Proxy UpdateFunctionDefinition
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateFunctionDefinition)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> UpdateFunctionDefinitionResponse
UpdateFunctionDefinitionResponse'
(Int -> UpdateFunctionDefinitionResponse)
-> Either String Int
-> Either String UpdateFunctionDefinitionResponse
forall (f :: * -> *) a b. Functor 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 UpdateFunctionDefinition
instance Prelude.NFData UpdateFunctionDefinition
instance Core.ToHeaders UpdateFunctionDefinition where
toHeaders :: UpdateFunctionDefinition -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateFunctionDefinition -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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 UpdateFunctionDefinition where
toJSON :: UpdateFunctionDefinition -> Value
toJSON UpdateFunctionDefinition' {Maybe Text
Text
functionDefinitionId :: Text
name :: Maybe Text
$sel:functionDefinitionId:UpdateFunctionDefinition' :: UpdateFunctionDefinition -> Text
$sel:name:UpdateFunctionDefinition' :: UpdateFunctionDefinition -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name]
)
instance Core.ToPath UpdateFunctionDefinition where
toPath :: UpdateFunctionDefinition -> ByteString
toPath UpdateFunctionDefinition' {Maybe Text
Text
functionDefinitionId :: Text
name :: Maybe Text
$sel:functionDefinitionId:UpdateFunctionDefinition' :: UpdateFunctionDefinition -> Text
$sel:name:UpdateFunctionDefinition' :: UpdateFunctionDefinition -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/greengrass/definition/functions/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
functionDefinitionId
]
instance Core.ToQuery UpdateFunctionDefinition where
toQuery :: UpdateFunctionDefinition -> QueryString
toQuery = QueryString -> UpdateFunctionDefinition -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateFunctionDefinitionResponse = UpdateFunctionDefinitionResponse'
{
UpdateFunctionDefinitionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateFunctionDefinitionResponse
-> UpdateFunctionDefinitionResponse -> Bool
(UpdateFunctionDefinitionResponse
-> UpdateFunctionDefinitionResponse -> Bool)
-> (UpdateFunctionDefinitionResponse
-> UpdateFunctionDefinitionResponse -> Bool)
-> Eq UpdateFunctionDefinitionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFunctionDefinitionResponse
-> UpdateFunctionDefinitionResponse -> Bool
$c/= :: UpdateFunctionDefinitionResponse
-> UpdateFunctionDefinitionResponse -> Bool
== :: UpdateFunctionDefinitionResponse
-> UpdateFunctionDefinitionResponse -> Bool
$c== :: UpdateFunctionDefinitionResponse
-> UpdateFunctionDefinitionResponse -> Bool
Prelude.Eq, ReadPrec [UpdateFunctionDefinitionResponse]
ReadPrec UpdateFunctionDefinitionResponse
Int -> ReadS UpdateFunctionDefinitionResponse
ReadS [UpdateFunctionDefinitionResponse]
(Int -> ReadS UpdateFunctionDefinitionResponse)
-> ReadS [UpdateFunctionDefinitionResponse]
-> ReadPrec UpdateFunctionDefinitionResponse
-> ReadPrec [UpdateFunctionDefinitionResponse]
-> Read UpdateFunctionDefinitionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateFunctionDefinitionResponse]
$creadListPrec :: ReadPrec [UpdateFunctionDefinitionResponse]
readPrec :: ReadPrec UpdateFunctionDefinitionResponse
$creadPrec :: ReadPrec UpdateFunctionDefinitionResponse
readList :: ReadS [UpdateFunctionDefinitionResponse]
$creadList :: ReadS [UpdateFunctionDefinitionResponse]
readsPrec :: Int -> ReadS UpdateFunctionDefinitionResponse
$creadsPrec :: Int -> ReadS UpdateFunctionDefinitionResponse
Prelude.Read, Int -> UpdateFunctionDefinitionResponse -> ShowS
[UpdateFunctionDefinitionResponse] -> ShowS
UpdateFunctionDefinitionResponse -> String
(Int -> UpdateFunctionDefinitionResponse -> ShowS)
-> (UpdateFunctionDefinitionResponse -> String)
-> ([UpdateFunctionDefinitionResponse] -> ShowS)
-> Show UpdateFunctionDefinitionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFunctionDefinitionResponse] -> ShowS
$cshowList :: [UpdateFunctionDefinitionResponse] -> ShowS
show :: UpdateFunctionDefinitionResponse -> String
$cshow :: UpdateFunctionDefinitionResponse -> String
showsPrec :: Int -> UpdateFunctionDefinitionResponse -> ShowS
$cshowsPrec :: Int -> UpdateFunctionDefinitionResponse -> ShowS
Prelude.Show, (forall x.
UpdateFunctionDefinitionResponse
-> Rep UpdateFunctionDefinitionResponse x)
-> (forall x.
Rep UpdateFunctionDefinitionResponse x
-> UpdateFunctionDefinitionResponse)
-> Generic UpdateFunctionDefinitionResponse
forall x.
Rep UpdateFunctionDefinitionResponse x
-> UpdateFunctionDefinitionResponse
forall x.
UpdateFunctionDefinitionResponse
-> Rep UpdateFunctionDefinitionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateFunctionDefinitionResponse x
-> UpdateFunctionDefinitionResponse
$cfrom :: forall x.
UpdateFunctionDefinitionResponse
-> Rep UpdateFunctionDefinitionResponse x
Prelude.Generic)
newUpdateFunctionDefinitionResponse ::
Prelude.Int ->
UpdateFunctionDefinitionResponse
newUpdateFunctionDefinitionResponse :: Int -> UpdateFunctionDefinitionResponse
newUpdateFunctionDefinitionResponse Int
pHttpStatus_ =
UpdateFunctionDefinitionResponse' :: Int -> UpdateFunctionDefinitionResponse
UpdateFunctionDefinitionResponse'
{ $sel:httpStatus:UpdateFunctionDefinitionResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
updateFunctionDefinitionResponse_httpStatus :: Lens.Lens' UpdateFunctionDefinitionResponse Prelude.Int
updateFunctionDefinitionResponse_httpStatus :: (Int -> f Int)
-> UpdateFunctionDefinitionResponse
-> f UpdateFunctionDefinitionResponse
updateFunctionDefinitionResponse_httpStatus = (UpdateFunctionDefinitionResponse -> Int)
-> (UpdateFunctionDefinitionResponse
-> Int -> UpdateFunctionDefinitionResponse)
-> Lens
UpdateFunctionDefinitionResponse
UpdateFunctionDefinitionResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFunctionDefinitionResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateFunctionDefinitionResponse' :: UpdateFunctionDefinitionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateFunctionDefinitionResponse
s@UpdateFunctionDefinitionResponse' {} Int
a -> UpdateFunctionDefinitionResponse
s {$sel:httpStatus:UpdateFunctionDefinitionResponse' :: Int
httpStatus = Int
a} :: UpdateFunctionDefinitionResponse)
instance
Prelude.NFData
UpdateFunctionDefinitionResponse