{-# 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.Pinpoint.GetEndpoint
(
GetEndpoint (..),
newGetEndpoint,
getEndpoint_applicationId,
getEndpoint_endpointId,
GetEndpointResponse (..),
newGetEndpointResponse,
getEndpointResponse_httpStatus,
getEndpointResponse_endpointResponse,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Pinpoint.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetEndpoint = GetEndpoint'
{
GetEndpoint -> Text
applicationId :: Prelude.Text,
GetEndpoint -> Text
endpointId :: Prelude.Text
}
deriving (GetEndpoint -> GetEndpoint -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetEndpoint -> GetEndpoint -> Bool
$c/= :: GetEndpoint -> GetEndpoint -> Bool
== :: GetEndpoint -> GetEndpoint -> Bool
$c== :: GetEndpoint -> GetEndpoint -> Bool
Prelude.Eq, ReadPrec [GetEndpoint]
ReadPrec GetEndpoint
Int -> ReadS GetEndpoint
ReadS [GetEndpoint]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetEndpoint]
$creadListPrec :: ReadPrec [GetEndpoint]
readPrec :: ReadPrec GetEndpoint
$creadPrec :: ReadPrec GetEndpoint
readList :: ReadS [GetEndpoint]
$creadList :: ReadS [GetEndpoint]
readsPrec :: Int -> ReadS GetEndpoint
$creadsPrec :: Int -> ReadS GetEndpoint
Prelude.Read, Int -> GetEndpoint -> ShowS
[GetEndpoint] -> ShowS
GetEndpoint -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetEndpoint] -> ShowS
$cshowList :: [GetEndpoint] -> ShowS
show :: GetEndpoint -> String
$cshow :: GetEndpoint -> String
showsPrec :: Int -> GetEndpoint -> ShowS
$cshowsPrec :: Int -> GetEndpoint -> ShowS
Prelude.Show, forall x. Rep GetEndpoint x -> GetEndpoint
forall x. GetEndpoint -> Rep GetEndpoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetEndpoint x -> GetEndpoint
$cfrom :: forall x. GetEndpoint -> Rep GetEndpoint x
Prelude.Generic)
newGetEndpoint ::
Prelude.Text ->
Prelude.Text ->
GetEndpoint
newGetEndpoint :: Text -> Text -> GetEndpoint
newGetEndpoint Text
pApplicationId_ Text
pEndpointId_ =
GetEndpoint'
{ $sel:applicationId:GetEndpoint' :: Text
applicationId = Text
pApplicationId_,
$sel:endpointId:GetEndpoint' :: Text
endpointId = Text
pEndpointId_
}
getEndpoint_applicationId :: Lens.Lens' GetEndpoint Prelude.Text
getEndpoint_applicationId :: Lens' GetEndpoint Text
getEndpoint_applicationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEndpoint' {Text
applicationId :: Text
$sel:applicationId:GetEndpoint' :: GetEndpoint -> Text
applicationId} -> Text
applicationId) (\s :: GetEndpoint
s@GetEndpoint' {} Text
a -> GetEndpoint
s {$sel:applicationId:GetEndpoint' :: Text
applicationId = Text
a} :: GetEndpoint)
getEndpoint_endpointId :: Lens.Lens' GetEndpoint Prelude.Text
getEndpoint_endpointId :: Lens' GetEndpoint Text
getEndpoint_endpointId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEndpoint' {Text
endpointId :: Text
$sel:endpointId:GetEndpoint' :: GetEndpoint -> Text
endpointId} -> Text
endpointId) (\s :: GetEndpoint
s@GetEndpoint' {} Text
a -> GetEndpoint
s {$sel:endpointId:GetEndpoint' :: Text
endpointId = Text
a} :: GetEndpoint)
instance Core.AWSRequest GetEndpoint where
type AWSResponse GetEndpoint = GetEndpointResponse
request :: (Service -> Service) -> GetEndpoint -> Request GetEndpoint
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetEndpoint
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetEndpoint)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Int -> EndpointResponse -> GetEndpointResponse
GetEndpointResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall a. FromJSON a => Object -> Either String a
Data.eitherParseJSON Object
x)
)
instance Prelude.Hashable GetEndpoint where
hashWithSalt :: Int -> GetEndpoint -> Int
hashWithSalt Int
_salt GetEndpoint' {Text
endpointId :: Text
applicationId :: Text
$sel:endpointId:GetEndpoint' :: GetEndpoint -> Text
$sel:applicationId:GetEndpoint' :: GetEndpoint -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
applicationId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
endpointId
instance Prelude.NFData GetEndpoint where
rnf :: GetEndpoint -> ()
rnf GetEndpoint' {Text
endpointId :: Text
applicationId :: Text
$sel:endpointId:GetEndpoint' :: GetEndpoint -> Text
$sel:applicationId:GetEndpoint' :: GetEndpoint -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
applicationId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
endpointId
instance Data.ToHeaders GetEndpoint where
toHeaders :: GetEndpoint -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath GetEndpoint where
toPath :: GetEndpoint -> ByteString
toPath GetEndpoint' {Text
endpointId :: Text
applicationId :: Text
$sel:endpointId:GetEndpoint' :: GetEndpoint -> Text
$sel:applicationId:GetEndpoint' :: GetEndpoint -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/v1/apps/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
applicationId,
ByteString
"/endpoints/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
endpointId
]
instance Data.ToQuery GetEndpoint where
toQuery :: GetEndpoint -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetEndpointResponse = GetEndpointResponse'
{
GetEndpointResponse -> Int
httpStatus :: Prelude.Int,
GetEndpointResponse -> EndpointResponse
endpointResponse :: EndpointResponse
}
deriving (GetEndpointResponse -> GetEndpointResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetEndpointResponse -> GetEndpointResponse -> Bool
$c/= :: GetEndpointResponse -> GetEndpointResponse -> Bool
== :: GetEndpointResponse -> GetEndpointResponse -> Bool
$c== :: GetEndpointResponse -> GetEndpointResponse -> Bool
Prelude.Eq, ReadPrec [GetEndpointResponse]
ReadPrec GetEndpointResponse
Int -> ReadS GetEndpointResponse
ReadS [GetEndpointResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetEndpointResponse]
$creadListPrec :: ReadPrec [GetEndpointResponse]
readPrec :: ReadPrec GetEndpointResponse
$creadPrec :: ReadPrec GetEndpointResponse
readList :: ReadS [GetEndpointResponse]
$creadList :: ReadS [GetEndpointResponse]
readsPrec :: Int -> ReadS GetEndpointResponse
$creadsPrec :: Int -> ReadS GetEndpointResponse
Prelude.Read, Int -> GetEndpointResponse -> ShowS
[GetEndpointResponse] -> ShowS
GetEndpointResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetEndpointResponse] -> ShowS
$cshowList :: [GetEndpointResponse] -> ShowS
show :: GetEndpointResponse -> String
$cshow :: GetEndpointResponse -> String
showsPrec :: Int -> GetEndpointResponse -> ShowS
$cshowsPrec :: Int -> GetEndpointResponse -> ShowS
Prelude.Show, forall x. Rep GetEndpointResponse x -> GetEndpointResponse
forall x. GetEndpointResponse -> Rep GetEndpointResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetEndpointResponse x -> GetEndpointResponse
$cfrom :: forall x. GetEndpointResponse -> Rep GetEndpointResponse x
Prelude.Generic)
newGetEndpointResponse ::
Prelude.Int ->
EndpointResponse ->
GetEndpointResponse
newGetEndpointResponse :: Int -> EndpointResponse -> GetEndpointResponse
newGetEndpointResponse
Int
pHttpStatus_
EndpointResponse
pEndpointResponse_ =
GetEndpointResponse'
{ $sel:httpStatus:GetEndpointResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:endpointResponse:GetEndpointResponse' :: EndpointResponse
endpointResponse = EndpointResponse
pEndpointResponse_
}
getEndpointResponse_httpStatus :: Lens.Lens' GetEndpointResponse Prelude.Int
getEndpointResponse_httpStatus :: Lens' GetEndpointResponse Int
getEndpointResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEndpointResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetEndpointResponse' :: GetEndpointResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetEndpointResponse
s@GetEndpointResponse' {} Int
a -> GetEndpointResponse
s {$sel:httpStatus:GetEndpointResponse' :: Int
httpStatus = Int
a} :: GetEndpointResponse)
getEndpointResponse_endpointResponse :: Lens.Lens' GetEndpointResponse EndpointResponse
getEndpointResponse_endpointResponse :: Lens' GetEndpointResponse EndpointResponse
getEndpointResponse_endpointResponse = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEndpointResponse' {EndpointResponse
endpointResponse :: EndpointResponse
$sel:endpointResponse:GetEndpointResponse' :: GetEndpointResponse -> EndpointResponse
endpointResponse} -> EndpointResponse
endpointResponse) (\s :: GetEndpointResponse
s@GetEndpointResponse' {} EndpointResponse
a -> GetEndpointResponse
s {$sel:endpointResponse:GetEndpointResponse' :: EndpointResponse
endpointResponse = EndpointResponse
a} :: GetEndpointResponse)
instance Prelude.NFData GetEndpointResponse where
rnf :: GetEndpointResponse -> ()
rnf GetEndpointResponse' {Int
EndpointResponse
endpointResponse :: EndpointResponse
httpStatus :: Int
$sel:endpointResponse:GetEndpointResponse' :: GetEndpointResponse -> EndpointResponse
$sel:httpStatus:GetEndpointResponse' :: GetEndpointResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf EndpointResponse
endpointResponse