{-# 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 qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Greengrass.Types
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
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]
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
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.
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'
{ $sel:name:UpdateFunctionDefinition' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
$sel:functionDefinitionId:UpdateFunctionDefinition' :: Text
functionDefinitionId = Text
pFunctionDefinitionId_
}
updateFunctionDefinition_name :: Lens.Lens' UpdateFunctionDefinition (Prelude.Maybe Prelude.Text)
updateFunctionDefinition_name :: Lens' UpdateFunctionDefinition (Maybe Text)
updateFunctionDefinition_name = 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 :: Lens' UpdateFunctionDefinition Text
updateFunctionDefinition_functionDefinitionId = 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 :: (Service -> Service)
-> UpdateFunctionDefinition -> Request UpdateFunctionDefinition
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateFunctionDefinition
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateFunctionDefinition)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> UpdateFunctionDefinitionResponse
UpdateFunctionDefinitionResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable UpdateFunctionDefinition where
hashWithSalt :: Int -> UpdateFunctionDefinition -> Int
hashWithSalt Int
_salt UpdateFunctionDefinition' {Maybe Text
Text
functionDefinitionId :: Text
name :: Maybe Text
$sel:functionDefinitionId:UpdateFunctionDefinition' :: UpdateFunctionDefinition -> Text
$sel:name:UpdateFunctionDefinition' :: UpdateFunctionDefinition -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
functionDefinitionId
instance Prelude.NFData UpdateFunctionDefinition where
rnf :: UpdateFunctionDefinition -> ()
rnf UpdateFunctionDefinition' {Maybe Text
Text
functionDefinitionId :: Text
name :: Maybe Text
$sel:functionDefinitionId:UpdateFunctionDefinition' :: UpdateFunctionDefinition -> Text
$sel:name:UpdateFunctionDefinition' :: UpdateFunctionDefinition -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
functionDefinitionId
instance Data.ToHeaders UpdateFunctionDefinition where
toHeaders :: UpdateFunctionDefinition -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Key
"Name" 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
name]
)
instance Data.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
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/greengrass/definition/functions/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
functionDefinitionId
]
instance Data.ToQuery UpdateFunctionDefinition where
toQuery :: UpdateFunctionDefinition -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data UpdateFunctionDefinitionResponse = UpdateFunctionDefinitionResponse'
{
UpdateFunctionDefinitionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateFunctionDefinitionResponse
-> UpdateFunctionDefinitionResponse -> Bool
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]
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
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.
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'
{ $sel:httpStatus:UpdateFunctionDefinitionResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
updateFunctionDefinitionResponse_httpStatus :: Lens.Lens' UpdateFunctionDefinitionResponse Prelude.Int
updateFunctionDefinitionResponse_httpStatus :: Lens' UpdateFunctionDefinitionResponse Int
updateFunctionDefinitionResponse_httpStatus = 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
where
rnf :: UpdateFunctionDefinitionResponse -> ()
rnf UpdateFunctionDefinitionResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateFunctionDefinitionResponse' :: UpdateFunctionDefinitionResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus