{-# 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.DescribePlacement
(
DescribePlacement (..),
newDescribePlacement,
describePlacement_placementName,
describePlacement_projectName,
DescribePlacementResponse (..),
newDescribePlacementResponse,
describePlacementResponse_httpStatus,
describePlacementResponse_placement,
)
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 DescribePlacement = DescribePlacement'
{
DescribePlacement -> Text
placementName :: Prelude.Text,
DescribePlacement -> Text
projectName :: Prelude.Text
}
deriving (DescribePlacement -> DescribePlacement -> Bool
(DescribePlacement -> DescribePlacement -> Bool)
-> (DescribePlacement -> DescribePlacement -> Bool)
-> Eq DescribePlacement
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribePlacement -> DescribePlacement -> Bool
$c/= :: DescribePlacement -> DescribePlacement -> Bool
== :: DescribePlacement -> DescribePlacement -> Bool
$c== :: DescribePlacement -> DescribePlacement -> Bool
Prelude.Eq, ReadPrec [DescribePlacement]
ReadPrec DescribePlacement
Int -> ReadS DescribePlacement
ReadS [DescribePlacement]
(Int -> ReadS DescribePlacement)
-> ReadS [DescribePlacement]
-> ReadPrec DescribePlacement
-> ReadPrec [DescribePlacement]
-> Read DescribePlacement
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribePlacement]
$creadListPrec :: ReadPrec [DescribePlacement]
readPrec :: ReadPrec DescribePlacement
$creadPrec :: ReadPrec DescribePlacement
readList :: ReadS [DescribePlacement]
$creadList :: ReadS [DescribePlacement]
readsPrec :: Int -> ReadS DescribePlacement
$creadsPrec :: Int -> ReadS DescribePlacement
Prelude.Read, Int -> DescribePlacement -> ShowS
[DescribePlacement] -> ShowS
DescribePlacement -> String
(Int -> DescribePlacement -> ShowS)
-> (DescribePlacement -> String)
-> ([DescribePlacement] -> ShowS)
-> Show DescribePlacement
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribePlacement] -> ShowS
$cshowList :: [DescribePlacement] -> ShowS
show :: DescribePlacement -> String
$cshow :: DescribePlacement -> String
showsPrec :: Int -> DescribePlacement -> ShowS
$cshowsPrec :: Int -> DescribePlacement -> ShowS
Prelude.Show, (forall x. DescribePlacement -> Rep DescribePlacement x)
-> (forall x. Rep DescribePlacement x -> DescribePlacement)
-> Generic DescribePlacement
forall x. Rep DescribePlacement x -> DescribePlacement
forall x. DescribePlacement -> Rep DescribePlacement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribePlacement x -> DescribePlacement
$cfrom :: forall x. DescribePlacement -> Rep DescribePlacement x
Prelude.Generic)
newDescribePlacement ::
Prelude.Text ->
Prelude.Text ->
DescribePlacement
newDescribePlacement :: Text -> Text -> DescribePlacement
newDescribePlacement Text
pPlacementName_ Text
pProjectName_ =
DescribePlacement' :: Text -> Text -> DescribePlacement
DescribePlacement'
{ $sel:placementName:DescribePlacement' :: Text
placementName = Text
pPlacementName_,
$sel:projectName:DescribePlacement' :: Text
projectName = Text
pProjectName_
}
describePlacement_placementName :: Lens.Lens' DescribePlacement Prelude.Text
describePlacement_placementName :: (Text -> f Text) -> DescribePlacement -> f DescribePlacement
describePlacement_placementName = (DescribePlacement -> Text)
-> (DescribePlacement -> Text -> DescribePlacement)
-> Lens DescribePlacement DescribePlacement Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePlacement' {Text
placementName :: Text
$sel:placementName:DescribePlacement' :: DescribePlacement -> Text
placementName} -> Text
placementName) (\s :: DescribePlacement
s@DescribePlacement' {} Text
a -> DescribePlacement
s {$sel:placementName:DescribePlacement' :: Text
placementName = Text
a} :: DescribePlacement)
describePlacement_projectName :: Lens.Lens' DescribePlacement Prelude.Text
describePlacement_projectName :: (Text -> f Text) -> DescribePlacement -> f DescribePlacement
describePlacement_projectName = (DescribePlacement -> Text)
-> (DescribePlacement -> Text -> DescribePlacement)
-> Lens DescribePlacement DescribePlacement Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePlacement' {Text
projectName :: Text
$sel:projectName:DescribePlacement' :: DescribePlacement -> Text
projectName} -> Text
projectName) (\s :: DescribePlacement
s@DescribePlacement' {} Text
a -> DescribePlacement
s {$sel:projectName:DescribePlacement' :: Text
projectName = Text
a} :: DescribePlacement)
instance Core.AWSRequest DescribePlacement where
type
AWSResponse DescribePlacement =
DescribePlacementResponse
request :: DescribePlacement -> Request DescribePlacement
request = Service -> DescribePlacement -> Request DescribePlacement
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy DescribePlacement
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribePlacement)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribePlacement))
-> Logger
-> Service
-> Proxy DescribePlacement
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribePlacement)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Int -> PlacementDescription -> DescribePlacementResponse
DescribePlacementResponse'
(Int -> PlacementDescription -> DescribePlacementResponse)
-> Either String Int
-> Either
String (PlacementDescription -> DescribePlacementResponse)
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))
Either String (PlacementDescription -> DescribePlacementResponse)
-> Either String PlacementDescription
-> Either String DescribePlacementResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String PlacementDescription
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"placement")
)
instance Prelude.Hashable DescribePlacement
instance Prelude.NFData DescribePlacement
instance Core.ToHeaders DescribePlacement where
toHeaders :: DescribePlacement -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribePlacement -> 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.ToPath DescribePlacement where
toPath :: DescribePlacement -> ByteString
toPath DescribePlacement' {Text
projectName :: Text
placementName :: Text
$sel:projectName:DescribePlacement' :: DescribePlacement -> Text
$sel:placementName:DescribePlacement' :: DescribePlacement -> 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 DescribePlacement where
toQuery :: DescribePlacement -> QueryString
toQuery = QueryString -> DescribePlacement -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribePlacementResponse = DescribePlacementResponse'
{
DescribePlacementResponse -> Int
httpStatus :: Prelude.Int,
DescribePlacementResponse -> PlacementDescription
placement :: PlacementDescription
}
deriving (DescribePlacementResponse -> DescribePlacementResponse -> Bool
(DescribePlacementResponse -> DescribePlacementResponse -> Bool)
-> (DescribePlacementResponse -> DescribePlacementResponse -> Bool)
-> Eq DescribePlacementResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribePlacementResponse -> DescribePlacementResponse -> Bool
$c/= :: DescribePlacementResponse -> DescribePlacementResponse -> Bool
== :: DescribePlacementResponse -> DescribePlacementResponse -> Bool
$c== :: DescribePlacementResponse -> DescribePlacementResponse -> Bool
Prelude.Eq, ReadPrec [DescribePlacementResponse]
ReadPrec DescribePlacementResponse
Int -> ReadS DescribePlacementResponse
ReadS [DescribePlacementResponse]
(Int -> ReadS DescribePlacementResponse)
-> ReadS [DescribePlacementResponse]
-> ReadPrec DescribePlacementResponse
-> ReadPrec [DescribePlacementResponse]
-> Read DescribePlacementResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribePlacementResponse]
$creadListPrec :: ReadPrec [DescribePlacementResponse]
readPrec :: ReadPrec DescribePlacementResponse
$creadPrec :: ReadPrec DescribePlacementResponse
readList :: ReadS [DescribePlacementResponse]
$creadList :: ReadS [DescribePlacementResponse]
readsPrec :: Int -> ReadS DescribePlacementResponse
$creadsPrec :: Int -> ReadS DescribePlacementResponse
Prelude.Read, Int -> DescribePlacementResponse -> ShowS
[DescribePlacementResponse] -> ShowS
DescribePlacementResponse -> String
(Int -> DescribePlacementResponse -> ShowS)
-> (DescribePlacementResponse -> String)
-> ([DescribePlacementResponse] -> ShowS)
-> Show DescribePlacementResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribePlacementResponse] -> ShowS
$cshowList :: [DescribePlacementResponse] -> ShowS
show :: DescribePlacementResponse -> String
$cshow :: DescribePlacementResponse -> String
showsPrec :: Int -> DescribePlacementResponse -> ShowS
$cshowsPrec :: Int -> DescribePlacementResponse -> ShowS
Prelude.Show, (forall x.
DescribePlacementResponse -> Rep DescribePlacementResponse x)
-> (forall x.
Rep DescribePlacementResponse x -> DescribePlacementResponse)
-> Generic DescribePlacementResponse
forall x.
Rep DescribePlacementResponse x -> DescribePlacementResponse
forall x.
DescribePlacementResponse -> Rep DescribePlacementResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribePlacementResponse x -> DescribePlacementResponse
$cfrom :: forall x.
DescribePlacementResponse -> Rep DescribePlacementResponse x
Prelude.Generic)
newDescribePlacementResponse ::
Prelude.Int ->
PlacementDescription ->
DescribePlacementResponse
newDescribePlacementResponse :: Int -> PlacementDescription -> DescribePlacementResponse
newDescribePlacementResponse Int
pHttpStatus_ PlacementDescription
pPlacement_ =
DescribePlacementResponse' :: Int -> PlacementDescription -> DescribePlacementResponse
DescribePlacementResponse'
{ $sel:httpStatus:DescribePlacementResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:placement:DescribePlacementResponse' :: PlacementDescription
placement = PlacementDescription
pPlacement_
}
describePlacementResponse_httpStatus :: Lens.Lens' DescribePlacementResponse Prelude.Int
describePlacementResponse_httpStatus :: (Int -> f Int)
-> DescribePlacementResponse -> f DescribePlacementResponse
describePlacementResponse_httpStatus = (DescribePlacementResponse -> Int)
-> (DescribePlacementResponse -> Int -> DescribePlacementResponse)
-> Lens DescribePlacementResponse DescribePlacementResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePlacementResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribePlacementResponse' :: DescribePlacementResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribePlacementResponse
s@DescribePlacementResponse' {} Int
a -> DescribePlacementResponse
s {$sel:httpStatus:DescribePlacementResponse' :: Int
httpStatus = Int
a} :: DescribePlacementResponse)
describePlacementResponse_placement :: Lens.Lens' DescribePlacementResponse PlacementDescription
describePlacementResponse_placement :: (PlacementDescription -> f PlacementDescription)
-> DescribePlacementResponse -> f DescribePlacementResponse
describePlacementResponse_placement = (DescribePlacementResponse -> PlacementDescription)
-> (DescribePlacementResponse
-> PlacementDescription -> DescribePlacementResponse)
-> Lens
DescribePlacementResponse
DescribePlacementResponse
PlacementDescription
PlacementDescription
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePlacementResponse' {PlacementDescription
placement :: PlacementDescription
$sel:placement:DescribePlacementResponse' :: DescribePlacementResponse -> PlacementDescription
placement} -> PlacementDescription
placement) (\s :: DescribePlacementResponse
s@DescribePlacementResponse' {} PlacementDescription
a -> DescribePlacementResponse
s {$sel:placement:DescribePlacementResponse' :: PlacementDescription
placement = PlacementDescription
a} :: DescribePlacementResponse)
instance Prelude.NFData DescribePlacementResponse