{-# 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.IoTDeviceAdvisor.GetEndpoint
(
GetEndpoint (..),
newGetEndpoint,
getEndpoint_certificateArn,
getEndpoint_thingArn,
GetEndpointResponse (..),
newGetEndpointResponse,
getEndpointResponse_endpoint,
getEndpointResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTDeviceAdvisor.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetEndpoint = GetEndpoint'
{
GetEndpoint -> Maybe Text
certificateArn :: Prelude.Maybe Prelude.Text,
GetEndpoint -> Maybe Text
thingArn :: Prelude.Maybe 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 ::
GetEndpoint
newGetEndpoint :: GetEndpoint
newGetEndpoint =
GetEndpoint'
{ $sel:certificateArn:GetEndpoint' :: Maybe Text
certificateArn = forall a. Maybe a
Prelude.Nothing,
$sel:thingArn:GetEndpoint' :: Maybe Text
thingArn = forall a. Maybe a
Prelude.Nothing
}
getEndpoint_certificateArn :: Lens.Lens' GetEndpoint (Prelude.Maybe Prelude.Text)
getEndpoint_certificateArn :: Lens' GetEndpoint (Maybe Text)
getEndpoint_certificateArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEndpoint' {Maybe Text
certificateArn :: Maybe Text
$sel:certificateArn:GetEndpoint' :: GetEndpoint -> Maybe Text
certificateArn} -> Maybe Text
certificateArn) (\s :: GetEndpoint
s@GetEndpoint' {} Maybe Text
a -> GetEndpoint
s {$sel:certificateArn:GetEndpoint' :: Maybe Text
certificateArn = Maybe Text
a} :: GetEndpoint)
getEndpoint_thingArn :: Lens.Lens' GetEndpoint (Prelude.Maybe Prelude.Text)
getEndpoint_thingArn :: Lens' GetEndpoint (Maybe Text)
getEndpoint_thingArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEndpoint' {Maybe Text
thingArn :: Maybe Text
$sel:thingArn:GetEndpoint' :: GetEndpoint -> Maybe Text
thingArn} -> Maybe Text
thingArn) (\s :: GetEndpoint
s@GetEndpoint' {} Maybe Text
a -> GetEndpoint
s {$sel:thingArn:GetEndpoint' :: Maybe Text
thingArn = Maybe 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 ->
Maybe Text -> Int -> GetEndpointResponse
GetEndpointResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"endpoint")
forall (f :: * -> *) a b. Applicative f => 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))
)
instance Prelude.Hashable GetEndpoint where
hashWithSalt :: Int -> GetEndpoint -> Int
hashWithSalt Int
_salt GetEndpoint' {Maybe Text
thingArn :: Maybe Text
certificateArn :: Maybe Text
$sel:thingArn:GetEndpoint' :: GetEndpoint -> Maybe Text
$sel:certificateArn:GetEndpoint' :: GetEndpoint -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
certificateArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
thingArn
instance Prelude.NFData GetEndpoint where
rnf :: GetEndpoint -> ()
rnf GetEndpoint' {Maybe Text
thingArn :: Maybe Text
certificateArn :: Maybe Text
$sel:thingArn:GetEndpoint' :: GetEndpoint -> Maybe Text
$sel:certificateArn:GetEndpoint' :: GetEndpoint -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
certificateArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
thingArn
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 = forall a b. a -> b -> a
Prelude.const ByteString
"/endpoint"
instance Data.ToQuery GetEndpoint where
toQuery :: GetEndpoint -> QueryString
toQuery GetEndpoint' {Maybe Text
thingArn :: Maybe Text
certificateArn :: Maybe Text
$sel:thingArn:GetEndpoint' :: GetEndpoint -> Maybe Text
$sel:certificateArn:GetEndpoint' :: GetEndpoint -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"certificateArn" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
certificateArn,
ByteString
"thingArn" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
thingArn
]
data GetEndpointResponse = GetEndpointResponse'
{
GetEndpointResponse -> Maybe Text
endpoint :: Prelude.Maybe Prelude.Text,
GetEndpointResponse -> Int
httpStatus :: Prelude.Int
}
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 ->
GetEndpointResponse
newGetEndpointResponse :: Int -> GetEndpointResponse
newGetEndpointResponse Int
pHttpStatus_ =
GetEndpointResponse'
{ $sel:endpoint:GetEndpointResponse' :: Maybe Text
endpoint = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetEndpointResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getEndpointResponse_endpoint :: Lens.Lens' GetEndpointResponse (Prelude.Maybe Prelude.Text)
getEndpointResponse_endpoint :: Lens' GetEndpointResponse (Maybe Text)
getEndpointResponse_endpoint = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEndpointResponse' {Maybe Text
endpoint :: Maybe Text
$sel:endpoint:GetEndpointResponse' :: GetEndpointResponse -> Maybe Text
endpoint} -> Maybe Text
endpoint) (\s :: GetEndpointResponse
s@GetEndpointResponse' {} Maybe Text
a -> GetEndpointResponse
s {$sel:endpoint:GetEndpointResponse' :: Maybe Text
endpoint = Maybe Text
a} :: GetEndpointResponse)
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)
instance Prelude.NFData GetEndpointResponse where
rnf :: GetEndpointResponse -> ()
rnf GetEndpointResponse' {Int
Maybe Text
httpStatus :: Int
endpoint :: Maybe Text
$sel:httpStatus:GetEndpointResponse' :: GetEndpointResponse -> Int
$sel:endpoint:GetEndpointResponse' :: GetEndpointResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
endpoint
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus