{-# 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.UpdateResourceDefinition
(
UpdateResourceDefinition (..),
newUpdateResourceDefinition,
updateResourceDefinition_name,
updateResourceDefinition_resourceDefinitionId,
UpdateResourceDefinitionResponse (..),
newUpdateResourceDefinitionResponse,
updateResourceDefinitionResponse_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 UpdateResourceDefinition = UpdateResourceDefinition'
{
UpdateResourceDefinition -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
UpdateResourceDefinition -> Text
resourceDefinitionId :: Prelude.Text
}
deriving (UpdateResourceDefinition -> UpdateResourceDefinition -> Bool
(UpdateResourceDefinition -> UpdateResourceDefinition -> Bool)
-> (UpdateResourceDefinition -> UpdateResourceDefinition -> Bool)
-> Eq UpdateResourceDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateResourceDefinition -> UpdateResourceDefinition -> Bool
$c/= :: UpdateResourceDefinition -> UpdateResourceDefinition -> Bool
== :: UpdateResourceDefinition -> UpdateResourceDefinition -> Bool
$c== :: UpdateResourceDefinition -> UpdateResourceDefinition -> Bool
Prelude.Eq, ReadPrec [UpdateResourceDefinition]
ReadPrec UpdateResourceDefinition
Int -> ReadS UpdateResourceDefinition
ReadS [UpdateResourceDefinition]
(Int -> ReadS UpdateResourceDefinition)
-> ReadS [UpdateResourceDefinition]
-> ReadPrec UpdateResourceDefinition
-> ReadPrec [UpdateResourceDefinition]
-> Read UpdateResourceDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateResourceDefinition]
$creadListPrec :: ReadPrec [UpdateResourceDefinition]
readPrec :: ReadPrec UpdateResourceDefinition
$creadPrec :: ReadPrec UpdateResourceDefinition
readList :: ReadS [UpdateResourceDefinition]
$creadList :: ReadS [UpdateResourceDefinition]
readsPrec :: Int -> ReadS UpdateResourceDefinition
$creadsPrec :: Int -> ReadS UpdateResourceDefinition
Prelude.Read, Int -> UpdateResourceDefinition -> ShowS
[UpdateResourceDefinition] -> ShowS
UpdateResourceDefinition -> String
(Int -> UpdateResourceDefinition -> ShowS)
-> (UpdateResourceDefinition -> String)
-> ([UpdateResourceDefinition] -> ShowS)
-> Show UpdateResourceDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateResourceDefinition] -> ShowS
$cshowList :: [UpdateResourceDefinition] -> ShowS
show :: UpdateResourceDefinition -> String
$cshow :: UpdateResourceDefinition -> String
showsPrec :: Int -> UpdateResourceDefinition -> ShowS
$cshowsPrec :: Int -> UpdateResourceDefinition -> ShowS
Prelude.Show, (forall x.
UpdateResourceDefinition -> Rep UpdateResourceDefinition x)
-> (forall x.
Rep UpdateResourceDefinition x -> UpdateResourceDefinition)
-> Generic UpdateResourceDefinition
forall x.
Rep UpdateResourceDefinition x -> UpdateResourceDefinition
forall x.
UpdateResourceDefinition -> Rep UpdateResourceDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateResourceDefinition x -> UpdateResourceDefinition
$cfrom :: forall x.
UpdateResourceDefinition -> Rep UpdateResourceDefinition x
Prelude.Generic)
newUpdateResourceDefinition ::
Prelude.Text ->
UpdateResourceDefinition
newUpdateResourceDefinition :: Text -> UpdateResourceDefinition
newUpdateResourceDefinition Text
pResourceDefinitionId_ =
UpdateResourceDefinition' :: Maybe Text -> Text -> UpdateResourceDefinition
UpdateResourceDefinition'
{ $sel:name:UpdateResourceDefinition' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:resourceDefinitionId:UpdateResourceDefinition' :: Text
resourceDefinitionId = Text
pResourceDefinitionId_
}
updateResourceDefinition_name :: Lens.Lens' UpdateResourceDefinition (Prelude.Maybe Prelude.Text)
updateResourceDefinition_name :: (Maybe Text -> f (Maybe Text))
-> UpdateResourceDefinition -> f UpdateResourceDefinition
updateResourceDefinition_name = (UpdateResourceDefinition -> Maybe Text)
-> (UpdateResourceDefinition
-> Maybe Text -> UpdateResourceDefinition)
-> Lens
UpdateResourceDefinition
UpdateResourceDefinition
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResourceDefinition' {Maybe Text
name :: Maybe Text
$sel:name:UpdateResourceDefinition' :: UpdateResourceDefinition -> Maybe Text
name} -> Maybe Text
name) (\s :: UpdateResourceDefinition
s@UpdateResourceDefinition' {} Maybe Text
a -> UpdateResourceDefinition
s {$sel:name:UpdateResourceDefinition' :: Maybe Text
name = Maybe Text
a} :: UpdateResourceDefinition)
updateResourceDefinition_resourceDefinitionId :: Lens.Lens' UpdateResourceDefinition Prelude.Text
updateResourceDefinition_resourceDefinitionId :: (Text -> f Text)
-> UpdateResourceDefinition -> f UpdateResourceDefinition
updateResourceDefinition_resourceDefinitionId = (UpdateResourceDefinition -> Text)
-> (UpdateResourceDefinition -> Text -> UpdateResourceDefinition)
-> Lens UpdateResourceDefinition UpdateResourceDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResourceDefinition' {Text
resourceDefinitionId :: Text
$sel:resourceDefinitionId:UpdateResourceDefinition' :: UpdateResourceDefinition -> Text
resourceDefinitionId} -> Text
resourceDefinitionId) (\s :: UpdateResourceDefinition
s@UpdateResourceDefinition' {} Text
a -> UpdateResourceDefinition
s {$sel:resourceDefinitionId:UpdateResourceDefinition' :: Text
resourceDefinitionId = Text
a} :: UpdateResourceDefinition)
instance Core.AWSRequest UpdateResourceDefinition where
type
AWSResponse UpdateResourceDefinition =
UpdateResourceDefinitionResponse
request :: UpdateResourceDefinition -> Request UpdateResourceDefinition
request = Service
-> UpdateResourceDefinition -> Request UpdateResourceDefinition
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateResourceDefinition
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateResourceDefinition)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse UpdateResourceDefinition))
-> Logger
-> Service
-> Proxy UpdateResourceDefinition
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateResourceDefinition)))
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 -> UpdateResourceDefinitionResponse
UpdateResourceDefinitionResponse'
(Int -> UpdateResourceDefinitionResponse)
-> Either String Int
-> Either String UpdateResourceDefinitionResponse
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 UpdateResourceDefinition
instance Prelude.NFData UpdateResourceDefinition
instance Core.ToHeaders UpdateResourceDefinition where
toHeaders :: UpdateResourceDefinition -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateResourceDefinition -> 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 UpdateResourceDefinition where
toJSON :: UpdateResourceDefinition -> Value
toJSON UpdateResourceDefinition' {Maybe Text
Text
resourceDefinitionId :: Text
name :: Maybe Text
$sel:resourceDefinitionId:UpdateResourceDefinition' :: UpdateResourceDefinition -> Text
$sel:name:UpdateResourceDefinition' :: UpdateResourceDefinition -> 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 UpdateResourceDefinition where
toPath :: UpdateResourceDefinition -> ByteString
toPath UpdateResourceDefinition' {Maybe Text
Text
resourceDefinitionId :: Text
name :: Maybe Text
$sel:resourceDefinitionId:UpdateResourceDefinition' :: UpdateResourceDefinition -> Text
$sel:name:UpdateResourceDefinition' :: UpdateResourceDefinition -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/greengrass/definition/resources/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
resourceDefinitionId
]
instance Core.ToQuery UpdateResourceDefinition where
toQuery :: UpdateResourceDefinition -> QueryString
toQuery = QueryString -> UpdateResourceDefinition -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateResourceDefinitionResponse = UpdateResourceDefinitionResponse'
{
UpdateResourceDefinitionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateResourceDefinitionResponse
-> UpdateResourceDefinitionResponse -> Bool
(UpdateResourceDefinitionResponse
-> UpdateResourceDefinitionResponse -> Bool)
-> (UpdateResourceDefinitionResponse
-> UpdateResourceDefinitionResponse -> Bool)
-> Eq UpdateResourceDefinitionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateResourceDefinitionResponse
-> UpdateResourceDefinitionResponse -> Bool
$c/= :: UpdateResourceDefinitionResponse
-> UpdateResourceDefinitionResponse -> Bool
== :: UpdateResourceDefinitionResponse
-> UpdateResourceDefinitionResponse -> Bool
$c== :: UpdateResourceDefinitionResponse
-> UpdateResourceDefinitionResponse -> Bool
Prelude.Eq, ReadPrec [UpdateResourceDefinitionResponse]
ReadPrec UpdateResourceDefinitionResponse
Int -> ReadS UpdateResourceDefinitionResponse
ReadS [UpdateResourceDefinitionResponse]
(Int -> ReadS UpdateResourceDefinitionResponse)
-> ReadS [UpdateResourceDefinitionResponse]
-> ReadPrec UpdateResourceDefinitionResponse
-> ReadPrec [UpdateResourceDefinitionResponse]
-> Read UpdateResourceDefinitionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateResourceDefinitionResponse]
$creadListPrec :: ReadPrec [UpdateResourceDefinitionResponse]
readPrec :: ReadPrec UpdateResourceDefinitionResponse
$creadPrec :: ReadPrec UpdateResourceDefinitionResponse
readList :: ReadS [UpdateResourceDefinitionResponse]
$creadList :: ReadS [UpdateResourceDefinitionResponse]
readsPrec :: Int -> ReadS UpdateResourceDefinitionResponse
$creadsPrec :: Int -> ReadS UpdateResourceDefinitionResponse
Prelude.Read, Int -> UpdateResourceDefinitionResponse -> ShowS
[UpdateResourceDefinitionResponse] -> ShowS
UpdateResourceDefinitionResponse -> String
(Int -> UpdateResourceDefinitionResponse -> ShowS)
-> (UpdateResourceDefinitionResponse -> String)
-> ([UpdateResourceDefinitionResponse] -> ShowS)
-> Show UpdateResourceDefinitionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateResourceDefinitionResponse] -> ShowS
$cshowList :: [UpdateResourceDefinitionResponse] -> ShowS
show :: UpdateResourceDefinitionResponse -> String
$cshow :: UpdateResourceDefinitionResponse -> String
showsPrec :: Int -> UpdateResourceDefinitionResponse -> ShowS
$cshowsPrec :: Int -> UpdateResourceDefinitionResponse -> ShowS
Prelude.Show, (forall x.
UpdateResourceDefinitionResponse
-> Rep UpdateResourceDefinitionResponse x)
-> (forall x.
Rep UpdateResourceDefinitionResponse x
-> UpdateResourceDefinitionResponse)
-> Generic UpdateResourceDefinitionResponse
forall x.
Rep UpdateResourceDefinitionResponse x
-> UpdateResourceDefinitionResponse
forall x.
UpdateResourceDefinitionResponse
-> Rep UpdateResourceDefinitionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateResourceDefinitionResponse x
-> UpdateResourceDefinitionResponse
$cfrom :: forall x.
UpdateResourceDefinitionResponse
-> Rep UpdateResourceDefinitionResponse x
Prelude.Generic)
newUpdateResourceDefinitionResponse ::
Prelude.Int ->
UpdateResourceDefinitionResponse
newUpdateResourceDefinitionResponse :: Int -> UpdateResourceDefinitionResponse
newUpdateResourceDefinitionResponse Int
pHttpStatus_ =
UpdateResourceDefinitionResponse' :: Int -> UpdateResourceDefinitionResponse
UpdateResourceDefinitionResponse'
{ $sel:httpStatus:UpdateResourceDefinitionResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
updateResourceDefinitionResponse_httpStatus :: Lens.Lens' UpdateResourceDefinitionResponse Prelude.Int
updateResourceDefinitionResponse_httpStatus :: (Int -> f Int)
-> UpdateResourceDefinitionResponse
-> f UpdateResourceDefinitionResponse
updateResourceDefinitionResponse_httpStatus = (UpdateResourceDefinitionResponse -> Int)
-> (UpdateResourceDefinitionResponse
-> Int -> UpdateResourceDefinitionResponse)
-> Lens
UpdateResourceDefinitionResponse
UpdateResourceDefinitionResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResourceDefinitionResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateResourceDefinitionResponse' :: UpdateResourceDefinitionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateResourceDefinitionResponse
s@UpdateResourceDefinitionResponse' {} Int
a -> UpdateResourceDefinitionResponse
s {$sel:httpStatus:UpdateResourceDefinitionResponse' :: Int
httpStatus = Int
a} :: UpdateResourceDefinitionResponse)
instance
Prelude.NFData
UpdateResourceDefinitionResponse