{-# 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.Comprehend.DescribeEndpoint
(
DescribeEndpoint (..),
newDescribeEndpoint,
describeEndpoint_endpointArn,
DescribeEndpointResponse (..),
newDescribeEndpointResponse,
describeEndpointResponse_endpointProperties,
describeEndpointResponse_httpStatus,
)
where
import Amazonka.Comprehend.Types
import qualified Amazonka.Core as Core
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 -> Text
endpointArn :: 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 ::
Prelude.Text ->
DescribeEndpoint
newDescribeEndpoint :: Text -> DescribeEndpoint
newDescribeEndpoint Text
pEndpointArn_ =
DescribeEndpoint' :: Text -> DescribeEndpoint
DescribeEndpoint' {$sel:endpointArn:DescribeEndpoint' :: Text
endpointArn = Text
pEndpointArn_}
describeEndpoint_endpointArn :: Lens.Lens' DescribeEndpoint Prelude.Text
describeEndpoint_endpointArn :: (Text -> f Text) -> DescribeEndpoint -> f DescribeEndpoint
describeEndpoint_endpointArn = (DescribeEndpoint -> Text)
-> (DescribeEndpoint -> Text -> DescribeEndpoint)
-> Lens DescribeEndpoint DescribeEndpoint Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEndpoint' {Text
endpointArn :: Text
$sel:endpointArn:DescribeEndpoint' :: DescribeEndpoint -> Text
endpointArn} -> Text
endpointArn) (\s :: DescribeEndpoint
s@DescribeEndpoint' {} Text
a -> DescribeEndpoint
s {$sel:endpointArn:DescribeEndpoint' :: Text
endpointArn = 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, ToJSON a) => Service -> a -> Request a
Request.postJSON 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 EndpointProperties -> Int -> DescribeEndpointResponse
DescribeEndpointResponse'
(Maybe EndpointProperties -> Int -> DescribeEndpointResponse)
-> Either String (Maybe EndpointProperties)
-> Either String (Int -> DescribeEndpointResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe EndpointProperties)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"EndpointProperties")
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] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"Comprehend_20171127.DescribeEndpoint" ::
Prelude.ByteString
),
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 DescribeEndpoint where
toJSON :: DescribeEndpoint -> Value
toJSON DescribeEndpoint' {Text
endpointArn :: Text
$sel:endpointArn:DescribeEndpoint' :: DescribeEndpoint -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"EndpointArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
endpointArn)]
)
instance Core.ToPath DescribeEndpoint where
toPath :: DescribeEndpoint -> ByteString
toPath = ByteString -> DescribeEndpoint -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeEndpoint where
toQuery :: DescribeEndpoint -> QueryString
toQuery = QueryString -> DescribeEndpoint -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeEndpointResponse = DescribeEndpointResponse'
{
DescribeEndpointResponse -> Maybe EndpointProperties
endpointProperties :: Prelude.Maybe EndpointProperties,
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 EndpointProperties -> Int -> DescribeEndpointResponse
DescribeEndpointResponse'
{ $sel:endpointProperties:DescribeEndpointResponse' :: Maybe EndpointProperties
endpointProperties =
Maybe EndpointProperties
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeEndpointResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeEndpointResponse_endpointProperties :: Lens.Lens' DescribeEndpointResponse (Prelude.Maybe EndpointProperties)
describeEndpointResponse_endpointProperties :: (Maybe EndpointProperties -> f (Maybe EndpointProperties))
-> DescribeEndpointResponse -> f DescribeEndpointResponse
describeEndpointResponse_endpointProperties = (DescribeEndpointResponse -> Maybe EndpointProperties)
-> (DescribeEndpointResponse
-> Maybe EndpointProperties -> DescribeEndpointResponse)
-> Lens
DescribeEndpointResponse
DescribeEndpointResponse
(Maybe EndpointProperties)
(Maybe EndpointProperties)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEndpointResponse' {Maybe EndpointProperties
endpointProperties :: Maybe EndpointProperties
$sel:endpointProperties:DescribeEndpointResponse' :: DescribeEndpointResponse -> Maybe EndpointProperties
endpointProperties} -> Maybe EndpointProperties
endpointProperties) (\s :: DescribeEndpointResponse
s@DescribeEndpointResponse' {} Maybe EndpointProperties
a -> DescribeEndpointResponse
s {$sel:endpointProperties:DescribeEndpointResponse' :: Maybe EndpointProperties
endpointProperties = Maybe EndpointProperties
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