{-# 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 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 UpdateResourceDefinition = UpdateResourceDefinition'
{
UpdateResourceDefinition -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
UpdateResourceDefinition -> Text
resourceDefinitionId :: Prelude.Text
}
deriving (UpdateResourceDefinition -> UpdateResourceDefinition -> Bool
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]
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
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.
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'
{ $sel:name:UpdateResourceDefinition' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
$sel:resourceDefinitionId:UpdateResourceDefinition' :: Text
resourceDefinitionId = Text
pResourceDefinitionId_
}
updateResourceDefinition_name :: Lens.Lens' UpdateResourceDefinition (Prelude.Maybe Prelude.Text)
updateResourceDefinition_name :: Lens' UpdateResourceDefinition (Maybe Text)
updateResourceDefinition_name = 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 :: Lens' UpdateResourceDefinition Text
updateResourceDefinition_resourceDefinitionId = 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 :: (Service -> Service)
-> UpdateResourceDefinition -> Request UpdateResourceDefinition
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 UpdateResourceDefinition
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateResourceDefinition)))
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 -> UpdateResourceDefinitionResponse
UpdateResourceDefinitionResponse'
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 UpdateResourceDefinition where
hashWithSalt :: Int -> UpdateResourceDefinition -> Int
hashWithSalt Int
_salt UpdateResourceDefinition' {Maybe Text
Text
resourceDefinitionId :: Text
name :: Maybe Text
$sel:resourceDefinitionId:UpdateResourceDefinition' :: UpdateResourceDefinition -> Text
$sel:name:UpdateResourceDefinition' :: UpdateResourceDefinition -> 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
resourceDefinitionId
instance Prelude.NFData UpdateResourceDefinition where
rnf :: UpdateResourceDefinition -> ()
rnf UpdateResourceDefinition' {Maybe Text
Text
resourceDefinitionId :: Text
name :: Maybe Text
$sel:resourceDefinitionId:UpdateResourceDefinition' :: UpdateResourceDefinition -> Text
$sel:name:UpdateResourceDefinition' :: UpdateResourceDefinition -> 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
resourceDefinitionId
instance Data.ToHeaders UpdateResourceDefinition where
toHeaders :: UpdateResourceDefinition -> 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 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
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 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
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/greengrass/definition/resources/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
resourceDefinitionId
]
instance Data.ToQuery UpdateResourceDefinition where
toQuery :: UpdateResourceDefinition -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data UpdateResourceDefinitionResponse = UpdateResourceDefinitionResponse'
{
UpdateResourceDefinitionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateResourceDefinitionResponse
-> UpdateResourceDefinitionResponse -> Bool
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]
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
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.
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'
{ $sel:httpStatus:UpdateResourceDefinitionResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
updateResourceDefinitionResponse_httpStatus :: Lens.Lens' UpdateResourceDefinitionResponse Prelude.Int
updateResourceDefinitionResponse_httpStatus :: Lens' UpdateResourceDefinitionResponse Int
updateResourceDefinitionResponse_httpStatus = 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
where
rnf :: UpdateResourceDefinitionResponse -> ()
rnf UpdateResourceDefinitionResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateResourceDefinitionResponse' :: UpdateResourceDefinitionResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus