{-# 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.IoT1ClickProjects.UpdateProject
(
UpdateProject (..),
newUpdateProject,
updateProject_placementTemplate,
updateProject_description,
updateProject_projectName,
UpdateProjectResponse (..),
newUpdateProjectResponse,
updateProjectResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IoT1ClickProjects.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 UpdateProject = UpdateProject'
{
UpdateProject -> Maybe PlacementTemplate
placementTemplate :: Prelude.Maybe PlacementTemplate,
UpdateProject -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
UpdateProject -> Text
projectName :: Prelude.Text
}
deriving (UpdateProject -> UpdateProject -> Bool
(UpdateProject -> UpdateProject -> Bool)
-> (UpdateProject -> UpdateProject -> Bool) -> Eq UpdateProject
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateProject -> UpdateProject -> Bool
$c/= :: UpdateProject -> UpdateProject -> Bool
== :: UpdateProject -> UpdateProject -> Bool
$c== :: UpdateProject -> UpdateProject -> Bool
Prelude.Eq, ReadPrec [UpdateProject]
ReadPrec UpdateProject
Int -> ReadS UpdateProject
ReadS [UpdateProject]
(Int -> ReadS UpdateProject)
-> ReadS [UpdateProject]
-> ReadPrec UpdateProject
-> ReadPrec [UpdateProject]
-> Read UpdateProject
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateProject]
$creadListPrec :: ReadPrec [UpdateProject]
readPrec :: ReadPrec UpdateProject
$creadPrec :: ReadPrec UpdateProject
readList :: ReadS [UpdateProject]
$creadList :: ReadS [UpdateProject]
readsPrec :: Int -> ReadS UpdateProject
$creadsPrec :: Int -> ReadS UpdateProject
Prelude.Read, Int -> UpdateProject -> ShowS
[UpdateProject] -> ShowS
UpdateProject -> String
(Int -> UpdateProject -> ShowS)
-> (UpdateProject -> String)
-> ([UpdateProject] -> ShowS)
-> Show UpdateProject
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateProject] -> ShowS
$cshowList :: [UpdateProject] -> ShowS
show :: UpdateProject -> String
$cshow :: UpdateProject -> String
showsPrec :: Int -> UpdateProject -> ShowS
$cshowsPrec :: Int -> UpdateProject -> ShowS
Prelude.Show, (forall x. UpdateProject -> Rep UpdateProject x)
-> (forall x. Rep UpdateProject x -> UpdateProject)
-> Generic UpdateProject
forall x. Rep UpdateProject x -> UpdateProject
forall x. UpdateProject -> Rep UpdateProject x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateProject x -> UpdateProject
$cfrom :: forall x. UpdateProject -> Rep UpdateProject x
Prelude.Generic)
newUpdateProject ::
Prelude.Text ->
UpdateProject
newUpdateProject :: Text -> UpdateProject
newUpdateProject Text
pProjectName_ =
UpdateProject' :: Maybe PlacementTemplate -> Maybe Text -> Text -> UpdateProject
UpdateProject'
{ $sel:placementTemplate:UpdateProject' :: Maybe PlacementTemplate
placementTemplate = Maybe PlacementTemplate
forall a. Maybe a
Prelude.Nothing,
$sel:description:UpdateProject' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:projectName:UpdateProject' :: Text
projectName = Text
pProjectName_
}
updateProject_placementTemplate :: Lens.Lens' UpdateProject (Prelude.Maybe PlacementTemplate)
updateProject_placementTemplate :: (Maybe PlacementTemplate -> f (Maybe PlacementTemplate))
-> UpdateProject -> f UpdateProject
updateProject_placementTemplate = (UpdateProject -> Maybe PlacementTemplate)
-> (UpdateProject -> Maybe PlacementTemplate -> UpdateProject)
-> Lens
UpdateProject
UpdateProject
(Maybe PlacementTemplate)
(Maybe PlacementTemplate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateProject' {Maybe PlacementTemplate
placementTemplate :: Maybe PlacementTemplate
$sel:placementTemplate:UpdateProject' :: UpdateProject -> Maybe PlacementTemplate
placementTemplate} -> Maybe PlacementTemplate
placementTemplate) (\s :: UpdateProject
s@UpdateProject' {} Maybe PlacementTemplate
a -> UpdateProject
s {$sel:placementTemplate:UpdateProject' :: Maybe PlacementTemplate
placementTemplate = Maybe PlacementTemplate
a} :: UpdateProject)
updateProject_description :: Lens.Lens' UpdateProject (Prelude.Maybe Prelude.Text)
updateProject_description :: (Maybe Text -> f (Maybe Text)) -> UpdateProject -> f UpdateProject
updateProject_description = (UpdateProject -> Maybe Text)
-> (UpdateProject -> Maybe Text -> UpdateProject)
-> Lens UpdateProject UpdateProject (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateProject' {Maybe Text
description :: Maybe Text
$sel:description:UpdateProject' :: UpdateProject -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateProject
s@UpdateProject' {} Maybe Text
a -> UpdateProject
s {$sel:description:UpdateProject' :: Maybe Text
description = Maybe Text
a} :: UpdateProject)
updateProject_projectName :: Lens.Lens' UpdateProject Prelude.Text
updateProject_projectName :: (Text -> f Text) -> UpdateProject -> f UpdateProject
updateProject_projectName = (UpdateProject -> Text)
-> (UpdateProject -> Text -> UpdateProject)
-> Lens UpdateProject UpdateProject Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateProject' {Text
projectName :: Text
$sel:projectName:UpdateProject' :: UpdateProject -> Text
projectName} -> Text
projectName) (\s :: UpdateProject
s@UpdateProject' {} Text
a -> UpdateProject
s {$sel:projectName:UpdateProject' :: Text
projectName = Text
a} :: UpdateProject)
instance Core.AWSRequest UpdateProject where
type
AWSResponse UpdateProject =
UpdateProjectResponse
request :: UpdateProject -> Request UpdateProject
request = Service -> UpdateProject -> Request UpdateProject
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateProject
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateProject)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse UpdateProject))
-> Logger
-> Service
-> Proxy UpdateProject
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateProject)))
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 -> UpdateProjectResponse
UpdateProjectResponse'
(Int -> UpdateProjectResponse)
-> Either String Int -> Either String UpdateProjectResponse
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 UpdateProject
instance Prelude.NFData UpdateProject
instance Core.ToHeaders UpdateProject where
toHeaders :: UpdateProject -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateProject -> 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 UpdateProject where
toJSON :: UpdateProject -> Value
toJSON UpdateProject' {Maybe Text
Maybe PlacementTemplate
Text
projectName :: Text
description :: Maybe Text
placementTemplate :: Maybe PlacementTemplate
$sel:projectName:UpdateProject' :: UpdateProject -> Text
$sel:description:UpdateProject' :: UpdateProject -> Maybe Text
$sel:placementTemplate:UpdateProject' :: UpdateProject -> Maybe PlacementTemplate
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"placementTemplate" Text -> PlacementTemplate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(PlacementTemplate -> Pair)
-> Maybe PlacementTemplate -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PlacementTemplate
placementTemplate,
(Text
"description" 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
description
]
)
instance Core.ToPath UpdateProject where
toPath :: UpdateProject -> ByteString
toPath UpdateProject' {Maybe Text
Maybe PlacementTemplate
Text
projectName :: Text
description :: Maybe Text
placementTemplate :: Maybe PlacementTemplate
$sel:projectName:UpdateProject' :: UpdateProject -> Text
$sel:description:UpdateProject' :: UpdateProject -> Maybe Text
$sel:placementTemplate:UpdateProject' :: UpdateProject -> Maybe PlacementTemplate
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/projects/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
projectName]
instance Core.ToQuery UpdateProject where
toQuery :: UpdateProject -> QueryString
toQuery = QueryString -> UpdateProject -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateProjectResponse = UpdateProjectResponse'
{
UpdateProjectResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateProjectResponse -> UpdateProjectResponse -> Bool
(UpdateProjectResponse -> UpdateProjectResponse -> Bool)
-> (UpdateProjectResponse -> UpdateProjectResponse -> Bool)
-> Eq UpdateProjectResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateProjectResponse -> UpdateProjectResponse -> Bool
$c/= :: UpdateProjectResponse -> UpdateProjectResponse -> Bool
== :: UpdateProjectResponse -> UpdateProjectResponse -> Bool
$c== :: UpdateProjectResponse -> UpdateProjectResponse -> Bool
Prelude.Eq, ReadPrec [UpdateProjectResponse]
ReadPrec UpdateProjectResponse
Int -> ReadS UpdateProjectResponse
ReadS [UpdateProjectResponse]
(Int -> ReadS UpdateProjectResponse)
-> ReadS [UpdateProjectResponse]
-> ReadPrec UpdateProjectResponse
-> ReadPrec [UpdateProjectResponse]
-> Read UpdateProjectResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateProjectResponse]
$creadListPrec :: ReadPrec [UpdateProjectResponse]
readPrec :: ReadPrec UpdateProjectResponse
$creadPrec :: ReadPrec UpdateProjectResponse
readList :: ReadS [UpdateProjectResponse]
$creadList :: ReadS [UpdateProjectResponse]
readsPrec :: Int -> ReadS UpdateProjectResponse
$creadsPrec :: Int -> ReadS UpdateProjectResponse
Prelude.Read, Int -> UpdateProjectResponse -> ShowS
[UpdateProjectResponse] -> ShowS
UpdateProjectResponse -> String
(Int -> UpdateProjectResponse -> ShowS)
-> (UpdateProjectResponse -> String)
-> ([UpdateProjectResponse] -> ShowS)
-> Show UpdateProjectResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateProjectResponse] -> ShowS
$cshowList :: [UpdateProjectResponse] -> ShowS
show :: UpdateProjectResponse -> String
$cshow :: UpdateProjectResponse -> String
showsPrec :: Int -> UpdateProjectResponse -> ShowS
$cshowsPrec :: Int -> UpdateProjectResponse -> ShowS
Prelude.Show, (forall x. UpdateProjectResponse -> Rep UpdateProjectResponse x)
-> (forall x. Rep UpdateProjectResponse x -> UpdateProjectResponse)
-> Generic UpdateProjectResponse
forall x. Rep UpdateProjectResponse x -> UpdateProjectResponse
forall x. UpdateProjectResponse -> Rep UpdateProjectResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateProjectResponse x -> UpdateProjectResponse
$cfrom :: forall x. UpdateProjectResponse -> Rep UpdateProjectResponse x
Prelude.Generic)
newUpdateProjectResponse ::
Prelude.Int ->
UpdateProjectResponse
newUpdateProjectResponse :: Int -> UpdateProjectResponse
newUpdateProjectResponse Int
pHttpStatus_ =
UpdateProjectResponse' :: Int -> UpdateProjectResponse
UpdateProjectResponse' {$sel:httpStatus:UpdateProjectResponse' :: Int
httpStatus = Int
pHttpStatus_}
updateProjectResponse_httpStatus :: Lens.Lens' UpdateProjectResponse Prelude.Int
updateProjectResponse_httpStatus :: (Int -> f Int) -> UpdateProjectResponse -> f UpdateProjectResponse
updateProjectResponse_httpStatus = (UpdateProjectResponse -> Int)
-> (UpdateProjectResponse -> Int -> UpdateProjectResponse)
-> Lens UpdateProjectResponse UpdateProjectResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateProjectResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateProjectResponse' :: UpdateProjectResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateProjectResponse
s@UpdateProjectResponse' {} Int
a -> UpdateProjectResponse
s {$sel:httpStatus:UpdateProjectResponse' :: Int
httpStatus = Int
a} :: UpdateProjectResponse)
instance Prelude.NFData UpdateProjectResponse