{-# 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.UpdatePlacement
(
UpdatePlacement (..),
newUpdatePlacement,
updatePlacement_attributes,
updatePlacement_placementName,
updatePlacement_projectName,
UpdatePlacementResponse (..),
newUpdatePlacementResponse,
updatePlacementResponse_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 UpdatePlacement = UpdatePlacement'
{
UpdatePlacement -> Maybe (HashMap Text Text)
attributes :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
UpdatePlacement -> Text
placementName :: Prelude.Text,
UpdatePlacement -> Text
projectName :: Prelude.Text
}
deriving (UpdatePlacement -> UpdatePlacement -> Bool
(UpdatePlacement -> UpdatePlacement -> Bool)
-> (UpdatePlacement -> UpdatePlacement -> Bool)
-> Eq UpdatePlacement
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdatePlacement -> UpdatePlacement -> Bool
$c/= :: UpdatePlacement -> UpdatePlacement -> Bool
== :: UpdatePlacement -> UpdatePlacement -> Bool
$c== :: UpdatePlacement -> UpdatePlacement -> Bool
Prelude.Eq, ReadPrec [UpdatePlacement]
ReadPrec UpdatePlacement
Int -> ReadS UpdatePlacement
ReadS [UpdatePlacement]
(Int -> ReadS UpdatePlacement)
-> ReadS [UpdatePlacement]
-> ReadPrec UpdatePlacement
-> ReadPrec [UpdatePlacement]
-> Read UpdatePlacement
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdatePlacement]
$creadListPrec :: ReadPrec [UpdatePlacement]
readPrec :: ReadPrec UpdatePlacement
$creadPrec :: ReadPrec UpdatePlacement
readList :: ReadS [UpdatePlacement]
$creadList :: ReadS [UpdatePlacement]
readsPrec :: Int -> ReadS UpdatePlacement
$creadsPrec :: Int -> ReadS UpdatePlacement
Prelude.Read, Int -> UpdatePlacement -> ShowS
[UpdatePlacement] -> ShowS
UpdatePlacement -> String
(Int -> UpdatePlacement -> ShowS)
-> (UpdatePlacement -> String)
-> ([UpdatePlacement] -> ShowS)
-> Show UpdatePlacement
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdatePlacement] -> ShowS
$cshowList :: [UpdatePlacement] -> ShowS
show :: UpdatePlacement -> String
$cshow :: UpdatePlacement -> String
showsPrec :: Int -> UpdatePlacement -> ShowS
$cshowsPrec :: Int -> UpdatePlacement -> ShowS
Prelude.Show, (forall x. UpdatePlacement -> Rep UpdatePlacement x)
-> (forall x. Rep UpdatePlacement x -> UpdatePlacement)
-> Generic UpdatePlacement
forall x. Rep UpdatePlacement x -> UpdatePlacement
forall x. UpdatePlacement -> Rep UpdatePlacement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdatePlacement x -> UpdatePlacement
$cfrom :: forall x. UpdatePlacement -> Rep UpdatePlacement x
Prelude.Generic)
newUpdatePlacement ::
Prelude.Text ->
Prelude.Text ->
UpdatePlacement
newUpdatePlacement :: Text -> Text -> UpdatePlacement
newUpdatePlacement Text
pPlacementName_ Text
pProjectName_ =
UpdatePlacement' :: Maybe (HashMap Text Text) -> Text -> Text -> UpdatePlacement
UpdatePlacement'
{ $sel:attributes:UpdatePlacement' :: Maybe (HashMap Text Text)
attributes = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:placementName:UpdatePlacement' :: Text
placementName = Text
pPlacementName_,
$sel:projectName:UpdatePlacement' :: Text
projectName = Text
pProjectName_
}
updatePlacement_attributes :: Lens.Lens' UpdatePlacement (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
updatePlacement_attributes :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> UpdatePlacement -> f UpdatePlacement
updatePlacement_attributes = (UpdatePlacement -> Maybe (HashMap Text Text))
-> (UpdatePlacement
-> Maybe (HashMap Text Text) -> UpdatePlacement)
-> Lens
UpdatePlacement
UpdatePlacement
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePlacement' {Maybe (HashMap Text Text)
attributes :: Maybe (HashMap Text Text)
$sel:attributes:UpdatePlacement' :: UpdatePlacement -> Maybe (HashMap Text Text)
attributes} -> Maybe (HashMap Text Text)
attributes) (\s :: UpdatePlacement
s@UpdatePlacement' {} Maybe (HashMap Text Text)
a -> UpdatePlacement
s {$sel:attributes:UpdatePlacement' :: Maybe (HashMap Text Text)
attributes = Maybe (HashMap Text Text)
a} :: UpdatePlacement) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> UpdatePlacement -> f UpdatePlacement)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> UpdatePlacement
-> f UpdatePlacement
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
updatePlacement_placementName :: Lens.Lens' UpdatePlacement Prelude.Text
updatePlacement_placementName :: (Text -> f Text) -> UpdatePlacement -> f UpdatePlacement
updatePlacement_placementName = (UpdatePlacement -> Text)
-> (UpdatePlacement -> Text -> UpdatePlacement)
-> Lens UpdatePlacement UpdatePlacement Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePlacement' {Text
placementName :: Text
$sel:placementName:UpdatePlacement' :: UpdatePlacement -> Text
placementName} -> Text
placementName) (\s :: UpdatePlacement
s@UpdatePlacement' {} Text
a -> UpdatePlacement
s {$sel:placementName:UpdatePlacement' :: Text
placementName = Text
a} :: UpdatePlacement)
updatePlacement_projectName :: Lens.Lens' UpdatePlacement Prelude.Text
updatePlacement_projectName :: (Text -> f Text) -> UpdatePlacement -> f UpdatePlacement
updatePlacement_projectName = (UpdatePlacement -> Text)
-> (UpdatePlacement -> Text -> UpdatePlacement)
-> Lens UpdatePlacement UpdatePlacement Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePlacement' {Text
projectName :: Text
$sel:projectName:UpdatePlacement' :: UpdatePlacement -> Text
projectName} -> Text
projectName) (\s :: UpdatePlacement
s@UpdatePlacement' {} Text
a -> UpdatePlacement
s {$sel:projectName:UpdatePlacement' :: Text
projectName = Text
a} :: UpdatePlacement)
instance Core.AWSRequest UpdatePlacement where
type
AWSResponse UpdatePlacement =
UpdatePlacementResponse
request :: UpdatePlacement -> Request UpdatePlacement
request = Service -> UpdatePlacement -> Request UpdatePlacement
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdatePlacement
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdatePlacement)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse UpdatePlacement))
-> Logger
-> Service
-> Proxy UpdatePlacement
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdatePlacement)))
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 -> UpdatePlacementResponse
UpdatePlacementResponse'
(Int -> UpdatePlacementResponse)
-> Either String Int -> Either String UpdatePlacementResponse
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 UpdatePlacement
instance Prelude.NFData UpdatePlacement
instance Core.ToHeaders UpdatePlacement where
toHeaders :: UpdatePlacement -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdatePlacement -> 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 UpdatePlacement where
toJSON :: UpdatePlacement -> Value
toJSON UpdatePlacement' {Maybe (HashMap Text Text)
Text
projectName :: Text
placementName :: Text
attributes :: Maybe (HashMap Text Text)
$sel:projectName:UpdatePlacement' :: UpdatePlacement -> Text
$sel:placementName:UpdatePlacement' :: UpdatePlacement -> Text
$sel:attributes:UpdatePlacement' :: UpdatePlacement -> Maybe (HashMap Text Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Text
"attributes" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
attributes]
)
instance Core.ToPath UpdatePlacement where
toPath :: UpdatePlacement -> ByteString
toPath UpdatePlacement' {Maybe (HashMap Text Text)
Text
projectName :: Text
placementName :: Text
attributes :: Maybe (HashMap Text Text)
$sel:projectName:UpdatePlacement' :: UpdatePlacement -> Text
$sel:placementName:UpdatePlacement' :: UpdatePlacement -> Text
$sel:attributes:UpdatePlacement' :: UpdatePlacement -> Maybe (HashMap Text Text)
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/projects/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
projectName,
ByteString
"/placements/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
placementName
]
instance Core.ToQuery UpdatePlacement where
toQuery :: UpdatePlacement -> QueryString
toQuery = QueryString -> UpdatePlacement -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdatePlacementResponse = UpdatePlacementResponse'
{
UpdatePlacementResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdatePlacementResponse -> UpdatePlacementResponse -> Bool
(UpdatePlacementResponse -> UpdatePlacementResponse -> Bool)
-> (UpdatePlacementResponse -> UpdatePlacementResponse -> Bool)
-> Eq UpdatePlacementResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdatePlacementResponse -> UpdatePlacementResponse -> Bool
$c/= :: UpdatePlacementResponse -> UpdatePlacementResponse -> Bool
== :: UpdatePlacementResponse -> UpdatePlacementResponse -> Bool
$c== :: UpdatePlacementResponse -> UpdatePlacementResponse -> Bool
Prelude.Eq, ReadPrec [UpdatePlacementResponse]
ReadPrec UpdatePlacementResponse
Int -> ReadS UpdatePlacementResponse
ReadS [UpdatePlacementResponse]
(Int -> ReadS UpdatePlacementResponse)
-> ReadS [UpdatePlacementResponse]
-> ReadPrec UpdatePlacementResponse
-> ReadPrec [UpdatePlacementResponse]
-> Read UpdatePlacementResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdatePlacementResponse]
$creadListPrec :: ReadPrec [UpdatePlacementResponse]
readPrec :: ReadPrec UpdatePlacementResponse
$creadPrec :: ReadPrec UpdatePlacementResponse
readList :: ReadS [UpdatePlacementResponse]
$creadList :: ReadS [UpdatePlacementResponse]
readsPrec :: Int -> ReadS UpdatePlacementResponse
$creadsPrec :: Int -> ReadS UpdatePlacementResponse
Prelude.Read, Int -> UpdatePlacementResponse -> ShowS
[UpdatePlacementResponse] -> ShowS
UpdatePlacementResponse -> String
(Int -> UpdatePlacementResponse -> ShowS)
-> (UpdatePlacementResponse -> String)
-> ([UpdatePlacementResponse] -> ShowS)
-> Show UpdatePlacementResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdatePlacementResponse] -> ShowS
$cshowList :: [UpdatePlacementResponse] -> ShowS
show :: UpdatePlacementResponse -> String
$cshow :: UpdatePlacementResponse -> String
showsPrec :: Int -> UpdatePlacementResponse -> ShowS
$cshowsPrec :: Int -> UpdatePlacementResponse -> ShowS
Prelude.Show, (forall x.
UpdatePlacementResponse -> Rep UpdatePlacementResponse x)
-> (forall x.
Rep UpdatePlacementResponse x -> UpdatePlacementResponse)
-> Generic UpdatePlacementResponse
forall x. Rep UpdatePlacementResponse x -> UpdatePlacementResponse
forall x. UpdatePlacementResponse -> Rep UpdatePlacementResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdatePlacementResponse x -> UpdatePlacementResponse
$cfrom :: forall x. UpdatePlacementResponse -> Rep UpdatePlacementResponse x
Prelude.Generic)
newUpdatePlacementResponse ::
Prelude.Int ->
UpdatePlacementResponse
newUpdatePlacementResponse :: Int -> UpdatePlacementResponse
newUpdatePlacementResponse Int
pHttpStatus_ =
UpdatePlacementResponse' :: Int -> UpdatePlacementResponse
UpdatePlacementResponse' {$sel:httpStatus:UpdatePlacementResponse' :: Int
httpStatus = Int
pHttpStatus_}
updatePlacementResponse_httpStatus :: Lens.Lens' UpdatePlacementResponse Prelude.Int
updatePlacementResponse_httpStatus :: (Int -> f Int)
-> UpdatePlacementResponse -> f UpdatePlacementResponse
updatePlacementResponse_httpStatus = (UpdatePlacementResponse -> Int)
-> (UpdatePlacementResponse -> Int -> UpdatePlacementResponse)
-> Lens UpdatePlacementResponse UpdatePlacementResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePlacementResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdatePlacementResponse' :: UpdatePlacementResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdatePlacementResponse
s@UpdatePlacementResponse' {} Int
a -> UpdatePlacementResponse
s {$sel:httpStatus:UpdatePlacementResponse' :: Int
httpStatus = Int
a} :: UpdatePlacementResponse)
instance Prelude.NFData UpdatePlacementResponse