{-# 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.IoT.DescribeEndpoint
(
DescribeEndpoint (..),
newDescribeEndpoint,
describeEndpoint_endpointType,
DescribeEndpointResponse (..),
newDescribeEndpointResponse,
describeEndpointResponse_endpointAddress,
describeEndpointResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IoT.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 DescribeEndpoint = DescribeEndpoint'
{
DescribeEndpoint -> Maybe Text
endpointType :: Prelude.Maybe Prelude.Text
}
deriving (DescribeEndpoint -> DescribeEndpoint -> Bool
(DescribeEndpoint -> DescribeEndpoint -> Bool)
-> (DescribeEndpoint -> DescribeEndpoint -> Bool)
-> Eq DescribeEndpoint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeEndpoint -> DescribeEndpoint -> Bool
$c/= :: DescribeEndpoint -> DescribeEndpoint -> Bool
== :: DescribeEndpoint -> DescribeEndpoint -> Bool
$c== :: DescribeEndpoint -> DescribeEndpoint -> Bool
Prelude.Eq, ReadPrec [DescribeEndpoint]
ReadPrec DescribeEndpoint
Int -> ReadS DescribeEndpoint
ReadS [DescribeEndpoint]
(Int -> ReadS DescribeEndpoint)
-> ReadS [DescribeEndpoint]
-> ReadPrec DescribeEndpoint
-> ReadPrec [DescribeEndpoint]
-> Read DescribeEndpoint
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeEndpoint]
$creadListPrec :: ReadPrec [DescribeEndpoint]
readPrec :: ReadPrec DescribeEndpoint
$creadPrec :: ReadPrec DescribeEndpoint
readList :: ReadS [DescribeEndpoint]
$creadList :: ReadS [DescribeEndpoint]
readsPrec :: Int -> ReadS DescribeEndpoint
$creadsPrec :: Int -> ReadS DescribeEndpoint
Prelude.Read, Int -> DescribeEndpoint -> ShowS
[DescribeEndpoint] -> ShowS
DescribeEndpoint -> String
(Int -> DescribeEndpoint -> ShowS)
-> (DescribeEndpoint -> String)
-> ([DescribeEndpoint] -> ShowS)
-> Show DescribeEndpoint
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeEndpoint] -> ShowS
$cshowList :: [DescribeEndpoint] -> ShowS
show :: DescribeEndpoint -> String
$cshow :: DescribeEndpoint -> String
showsPrec :: Int -> DescribeEndpoint -> ShowS
$cshowsPrec :: Int -> DescribeEndpoint -> ShowS
Prelude.Show, (forall x. DescribeEndpoint -> Rep DescribeEndpoint x)
-> (forall x. Rep DescribeEndpoint x -> DescribeEndpoint)
-> Generic DescribeEndpoint
forall x. Rep DescribeEndpoint x -> DescribeEndpoint
forall x. DescribeEndpoint -> Rep DescribeEndpoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeEndpoint x -> DescribeEndpoint
$cfrom :: forall x. DescribeEndpoint -> Rep DescribeEndpoint x
Prelude.Generic)
newDescribeEndpoint ::
DescribeEndpoint
newDescribeEndpoint :: DescribeEndpoint
newDescribeEndpoint =
DescribeEndpoint' :: Maybe Text -> DescribeEndpoint
DescribeEndpoint' {$sel:endpointType:DescribeEndpoint' :: Maybe Text
endpointType = Maybe Text
forall a. Maybe a
Prelude.Nothing}
describeEndpoint_endpointType :: Lens.Lens' DescribeEndpoint (Prelude.Maybe Prelude.Text)
describeEndpoint_endpointType :: (Maybe Text -> f (Maybe Text))
-> DescribeEndpoint -> f DescribeEndpoint
describeEndpoint_endpointType = (DescribeEndpoint -> Maybe Text)
-> (DescribeEndpoint -> Maybe Text -> DescribeEndpoint)
-> Lens DescribeEndpoint DescribeEndpoint (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEndpoint' {Maybe Text
endpointType :: Maybe Text
$sel:endpointType:DescribeEndpoint' :: DescribeEndpoint -> Maybe Text
endpointType} -> Maybe Text
endpointType) (\s :: DescribeEndpoint
s@DescribeEndpoint' {} Maybe Text
a -> DescribeEndpoint
s {$sel:endpointType:DescribeEndpoint' :: Maybe Text
endpointType = Maybe Text
a} :: DescribeEndpoint)
instance Core.AWSRequest DescribeEndpoint where
type
AWSResponse DescribeEndpoint =
DescribeEndpointResponse
request :: DescribeEndpoint -> Request DescribeEndpoint
request = Service -> DescribeEndpoint -> Request DescribeEndpoint
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeEndpoint
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeEndpoint)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeEndpoint))
-> Logger
-> Service
-> Proxy DescribeEndpoint
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeEndpoint)))
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 ->
Maybe Text -> Int -> DescribeEndpointResponse
DescribeEndpointResponse'
(Maybe Text -> Int -> DescribeEndpointResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeEndpointResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"endpointAddress")
Either String (Int -> DescribeEndpointResponse)
-> Either String Int -> Either String DescribeEndpointResponse
forall (f :: * -> *) a b. Applicative f => 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 DescribeEndpoint
instance Prelude.NFData DescribeEndpoint
instance Core.ToHeaders DescribeEndpoint where
toHeaders :: DescribeEndpoint -> ResponseHeaders
toHeaders = ResponseHeaders -> DescribeEndpoint -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath DescribeEndpoint where
toPath :: DescribeEndpoint -> ByteString
toPath = ByteString -> DescribeEndpoint -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/endpoint"
instance Core.ToQuery DescribeEndpoint where
toQuery :: DescribeEndpoint -> QueryString
toQuery DescribeEndpoint' {Maybe Text
endpointType :: Maybe Text
$sel:endpointType:DescribeEndpoint' :: DescribeEndpoint -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"endpointType" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
endpointType]
data DescribeEndpointResponse = DescribeEndpointResponse'
{
DescribeEndpointResponse -> Maybe Text
endpointAddress :: Prelude.Maybe Prelude.Text,
DescribeEndpointResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeEndpointResponse -> DescribeEndpointResponse -> Bool
(DescribeEndpointResponse -> DescribeEndpointResponse -> Bool)
-> (DescribeEndpointResponse -> DescribeEndpointResponse -> Bool)
-> Eq DescribeEndpointResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeEndpointResponse -> DescribeEndpointResponse -> Bool
$c/= :: DescribeEndpointResponse -> DescribeEndpointResponse -> Bool
== :: DescribeEndpointResponse -> DescribeEndpointResponse -> Bool
$c== :: DescribeEndpointResponse -> DescribeEndpointResponse -> Bool
Prelude.Eq, ReadPrec [DescribeEndpointResponse]
ReadPrec DescribeEndpointResponse
Int -> ReadS DescribeEndpointResponse
ReadS [DescribeEndpointResponse]
(Int -> ReadS DescribeEndpointResponse)
-> ReadS [DescribeEndpointResponse]
-> ReadPrec DescribeEndpointResponse
-> ReadPrec [DescribeEndpointResponse]
-> Read DescribeEndpointResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeEndpointResponse]
$creadListPrec :: ReadPrec [DescribeEndpointResponse]
readPrec :: ReadPrec DescribeEndpointResponse
$creadPrec :: ReadPrec DescribeEndpointResponse
readList :: ReadS [DescribeEndpointResponse]
$creadList :: ReadS [DescribeEndpointResponse]
readsPrec :: Int -> ReadS DescribeEndpointResponse
$creadsPrec :: Int -> ReadS DescribeEndpointResponse
Prelude.Read, Int -> DescribeEndpointResponse -> ShowS
[DescribeEndpointResponse] -> ShowS
DescribeEndpointResponse -> String
(Int -> DescribeEndpointResponse -> ShowS)
-> (DescribeEndpointResponse -> String)
-> ([DescribeEndpointResponse] -> ShowS)
-> Show DescribeEndpointResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeEndpointResponse] -> ShowS
$cshowList :: [DescribeEndpointResponse] -> ShowS
show :: DescribeEndpointResponse -> String
$cshow :: DescribeEndpointResponse -> String
showsPrec :: Int -> DescribeEndpointResponse -> ShowS
$cshowsPrec :: Int -> DescribeEndpointResponse -> ShowS
Prelude.Show, (forall x.
DescribeEndpointResponse -> Rep DescribeEndpointResponse x)
-> (forall x.
Rep DescribeEndpointResponse x -> DescribeEndpointResponse)
-> Generic DescribeEndpointResponse
forall x.
Rep DescribeEndpointResponse x -> DescribeEndpointResponse
forall x.
DescribeEndpointResponse -> Rep DescribeEndpointResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeEndpointResponse x -> DescribeEndpointResponse
$cfrom :: forall x.
DescribeEndpointResponse -> Rep DescribeEndpointResponse x
Prelude.Generic)
newDescribeEndpointResponse ::
Prelude.Int ->
DescribeEndpointResponse
newDescribeEndpointResponse :: Int -> DescribeEndpointResponse
newDescribeEndpointResponse Int
pHttpStatus_ =
DescribeEndpointResponse' :: Maybe Text -> Int -> DescribeEndpointResponse
DescribeEndpointResponse'
{ $sel:endpointAddress:DescribeEndpointResponse' :: Maybe Text
endpointAddress =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeEndpointResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeEndpointResponse_endpointAddress :: Lens.Lens' DescribeEndpointResponse (Prelude.Maybe Prelude.Text)
describeEndpointResponse_endpointAddress :: (Maybe Text -> f (Maybe Text))
-> DescribeEndpointResponse -> f DescribeEndpointResponse
describeEndpointResponse_endpointAddress = (DescribeEndpointResponse -> Maybe Text)
-> (DescribeEndpointResponse
-> Maybe Text -> DescribeEndpointResponse)
-> Lens
DescribeEndpointResponse
DescribeEndpointResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEndpointResponse' {Maybe Text
endpointAddress :: Maybe Text
$sel:endpointAddress:DescribeEndpointResponse' :: DescribeEndpointResponse -> Maybe Text
endpointAddress} -> Maybe Text
endpointAddress) (\s :: DescribeEndpointResponse
s@DescribeEndpointResponse' {} Maybe Text
a -> DescribeEndpointResponse
s {$sel:endpointAddress:DescribeEndpointResponse' :: Maybe Text
endpointAddress = Maybe Text
a} :: DescribeEndpointResponse)
describeEndpointResponse_httpStatus :: Lens.Lens' DescribeEndpointResponse Prelude.Int
describeEndpointResponse_httpStatus :: (Int -> f Int)
-> DescribeEndpointResponse -> f DescribeEndpointResponse
describeEndpointResponse_httpStatus = (DescribeEndpointResponse -> Int)
-> (DescribeEndpointResponse -> Int -> DescribeEndpointResponse)
-> Lens DescribeEndpointResponse DescribeEndpointResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEndpointResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeEndpointResponse' :: DescribeEndpointResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeEndpointResponse
s@DescribeEndpointResponse' {} Int
a -> DescribeEndpointResponse
s {$sel:httpStatus:DescribeEndpointResponse' :: Int
httpStatus = Int
a} :: DescribeEndpointResponse)
instance Prelude.NFData DescribeEndpointResponse