{-# 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.SNS.GetEndpointAttributes
(
GetEndpointAttributes (..),
newGetEndpointAttributes,
getEndpointAttributes_endpointArn,
GetEndpointAttributesResponse (..),
newGetEndpointAttributesResponse,
getEndpointAttributesResponse_attributes,
getEndpointAttributesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SNS.Types
data GetEndpointAttributes = GetEndpointAttributes'
{
GetEndpointAttributes -> Text
endpointArn :: Prelude.Text
}
deriving (GetEndpointAttributes -> GetEndpointAttributes -> Bool
(GetEndpointAttributes -> GetEndpointAttributes -> Bool)
-> (GetEndpointAttributes -> GetEndpointAttributes -> Bool)
-> Eq GetEndpointAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetEndpointAttributes -> GetEndpointAttributes -> Bool
== :: GetEndpointAttributes -> GetEndpointAttributes -> Bool
$c/= :: GetEndpointAttributes -> GetEndpointAttributes -> Bool
/= :: GetEndpointAttributes -> GetEndpointAttributes -> Bool
Prelude.Eq, ReadPrec [GetEndpointAttributes]
ReadPrec GetEndpointAttributes
Int -> ReadS GetEndpointAttributes
ReadS [GetEndpointAttributes]
(Int -> ReadS GetEndpointAttributes)
-> ReadS [GetEndpointAttributes]
-> ReadPrec GetEndpointAttributes
-> ReadPrec [GetEndpointAttributes]
-> Read GetEndpointAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS GetEndpointAttributes
readsPrec :: Int -> ReadS GetEndpointAttributes
$creadList :: ReadS [GetEndpointAttributes]
readList :: ReadS [GetEndpointAttributes]
$creadPrec :: ReadPrec GetEndpointAttributes
readPrec :: ReadPrec GetEndpointAttributes
$creadListPrec :: ReadPrec [GetEndpointAttributes]
readListPrec :: ReadPrec [GetEndpointAttributes]
Prelude.Read, Int -> GetEndpointAttributes -> ShowS
[GetEndpointAttributes] -> ShowS
GetEndpointAttributes -> String
(Int -> GetEndpointAttributes -> ShowS)
-> (GetEndpointAttributes -> String)
-> ([GetEndpointAttributes] -> ShowS)
-> Show GetEndpointAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetEndpointAttributes -> ShowS
showsPrec :: Int -> GetEndpointAttributes -> ShowS
$cshow :: GetEndpointAttributes -> String
show :: GetEndpointAttributes -> String
$cshowList :: [GetEndpointAttributes] -> ShowS
showList :: [GetEndpointAttributes] -> ShowS
Prelude.Show, (forall x. GetEndpointAttributes -> Rep GetEndpointAttributes x)
-> (forall x. Rep GetEndpointAttributes x -> GetEndpointAttributes)
-> Generic GetEndpointAttributes
forall x. Rep GetEndpointAttributes x -> GetEndpointAttributes
forall x. GetEndpointAttributes -> Rep GetEndpointAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. GetEndpointAttributes -> Rep GetEndpointAttributes x
from :: forall x. GetEndpointAttributes -> Rep GetEndpointAttributes x
$cto :: forall x. Rep GetEndpointAttributes x -> GetEndpointAttributes
to :: forall x. Rep GetEndpointAttributes x -> GetEndpointAttributes
Prelude.Generic)
newGetEndpointAttributes ::
Prelude.Text ->
GetEndpointAttributes
newGetEndpointAttributes :: Text -> GetEndpointAttributes
newGetEndpointAttributes Text
pEndpointArn_ =
GetEndpointAttributes' {endpointArn :: Text
endpointArn = Text
pEndpointArn_}
getEndpointAttributes_endpointArn :: Lens.Lens' GetEndpointAttributes Prelude.Text
getEndpointAttributes_endpointArn :: Lens' GetEndpointAttributes Text
getEndpointAttributes_endpointArn = (GetEndpointAttributes -> Text)
-> (GetEndpointAttributes -> Text -> GetEndpointAttributes)
-> Lens' GetEndpointAttributes Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEndpointAttributes' {Text
endpointArn :: GetEndpointAttributes -> Text
endpointArn :: Text
endpointArn} -> Text
endpointArn) (\s :: GetEndpointAttributes
s@GetEndpointAttributes' {} Text
a -> GetEndpointAttributes
s {endpointArn = a} :: GetEndpointAttributes)
instance Core.AWSRequest GetEndpointAttributes where
type
AWSResponse GetEndpointAttributes =
GetEndpointAttributesResponse
request :: (Service -> Service)
-> GetEndpointAttributes -> Request GetEndpointAttributes
request Service -> Service
overrides =
Service -> GetEndpointAttributes -> Request GetEndpointAttributes
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetEndpointAttributes
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetEndpointAttributes)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetEndpointAttributes))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetEndpointAttributes
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetEndpointAttributes)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"GetEndpointAttributesResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe (HashMap Text Text) -> Int -> GetEndpointAttributesResponse
GetEndpointAttributesResponse'
(Maybe (HashMap Text Text) -> Int -> GetEndpointAttributesResponse)
-> Either String (Maybe (HashMap Text Text))
-> Either String (Int -> GetEndpointAttributesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Attributes" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
Either String [Node]
-> ([Node] -> Either String (Maybe (HashMap Text Text)))
-> Either String (Maybe (HashMap Text Text))
forall a b.
Either String a -> (a -> Either String b) -> Either String b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String (HashMap Text Text))
-> [Node] -> Either String (Maybe (HashMap Text Text))
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> Text -> Text -> [Node] -> Either String (HashMap Text Text)
forall k v.
(Eq k, Hashable k, FromText k, FromXML v) =>
Text -> Text -> Text -> [Node] -> Either String (HashMap k v)
Data.parseXMLMap Text
"entry" Text
"key" Text
"value")
)
Either String (Int -> GetEndpointAttributesResponse)
-> Either String Int -> Either String GetEndpointAttributesResponse
forall a b.
Either String (a -> b) -> Either String a -> Either String b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall a. a -> Either String a
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 GetEndpointAttributes where
hashWithSalt :: Int -> GetEndpointAttributes -> Int
hashWithSalt Int
_salt GetEndpointAttributes' {Text
endpointArn :: GetEndpointAttributes -> Text
endpointArn :: Text
..} =
Int
_salt Int -> Text -> Int
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
endpointArn
instance Prelude.NFData GetEndpointAttributes where
rnf :: GetEndpointAttributes -> ()
rnf GetEndpointAttributes' {Text
endpointArn :: GetEndpointAttributes -> Text
endpointArn :: Text
..} =
Text -> ()
forall a. NFData a => a -> ()
Prelude.rnf Text
endpointArn
instance Data.ToHeaders GetEndpointAttributes where
toHeaders :: GetEndpointAttributes -> ResponseHeaders
toHeaders = ResponseHeaders -> GetEndpointAttributes -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath GetEndpointAttributes where
toPath :: GetEndpointAttributes -> ByteString
toPath = ByteString -> GetEndpointAttributes -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetEndpointAttributes where
toQuery :: GetEndpointAttributes -> QueryString
toQuery GetEndpointAttributes' {Text
endpointArn :: GetEndpointAttributes -> Text
endpointArn :: Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"GetEndpointAttributes" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-03-31" :: Prelude.ByteString),
ByteString
"EndpointArn" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
endpointArn
]
data GetEndpointAttributesResponse = GetEndpointAttributesResponse'
{
GetEndpointAttributesResponse -> Maybe (HashMap Text Text)
attributes :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
GetEndpointAttributesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetEndpointAttributesResponse
-> GetEndpointAttributesResponse -> Bool
(GetEndpointAttributesResponse
-> GetEndpointAttributesResponse -> Bool)
-> (GetEndpointAttributesResponse
-> GetEndpointAttributesResponse -> Bool)
-> Eq GetEndpointAttributesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetEndpointAttributesResponse
-> GetEndpointAttributesResponse -> Bool
== :: GetEndpointAttributesResponse
-> GetEndpointAttributesResponse -> Bool
$c/= :: GetEndpointAttributesResponse
-> GetEndpointAttributesResponse -> Bool
/= :: GetEndpointAttributesResponse
-> GetEndpointAttributesResponse -> Bool
Prelude.Eq, ReadPrec [GetEndpointAttributesResponse]
ReadPrec GetEndpointAttributesResponse
Int -> ReadS GetEndpointAttributesResponse
ReadS [GetEndpointAttributesResponse]
(Int -> ReadS GetEndpointAttributesResponse)
-> ReadS [GetEndpointAttributesResponse]
-> ReadPrec GetEndpointAttributesResponse
-> ReadPrec [GetEndpointAttributesResponse]
-> Read GetEndpointAttributesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS GetEndpointAttributesResponse
readsPrec :: Int -> ReadS GetEndpointAttributesResponse
$creadList :: ReadS [GetEndpointAttributesResponse]
readList :: ReadS [GetEndpointAttributesResponse]
$creadPrec :: ReadPrec GetEndpointAttributesResponse
readPrec :: ReadPrec GetEndpointAttributesResponse
$creadListPrec :: ReadPrec [GetEndpointAttributesResponse]
readListPrec :: ReadPrec [GetEndpointAttributesResponse]
Prelude.Read, Int -> GetEndpointAttributesResponse -> ShowS
[GetEndpointAttributesResponse] -> ShowS
GetEndpointAttributesResponse -> String
(Int -> GetEndpointAttributesResponse -> ShowS)
-> (GetEndpointAttributesResponse -> String)
-> ([GetEndpointAttributesResponse] -> ShowS)
-> Show GetEndpointAttributesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetEndpointAttributesResponse -> ShowS
showsPrec :: Int -> GetEndpointAttributesResponse -> ShowS
$cshow :: GetEndpointAttributesResponse -> String
show :: GetEndpointAttributesResponse -> String
$cshowList :: [GetEndpointAttributesResponse] -> ShowS
showList :: [GetEndpointAttributesResponse] -> ShowS
Prelude.Show, (forall x.
GetEndpointAttributesResponse
-> Rep GetEndpointAttributesResponse x)
-> (forall x.
Rep GetEndpointAttributesResponse x
-> GetEndpointAttributesResponse)
-> Generic GetEndpointAttributesResponse
forall x.
Rep GetEndpointAttributesResponse x
-> GetEndpointAttributesResponse
forall x.
GetEndpointAttributesResponse
-> Rep GetEndpointAttributesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
GetEndpointAttributesResponse
-> Rep GetEndpointAttributesResponse x
from :: forall x.
GetEndpointAttributesResponse
-> Rep GetEndpointAttributesResponse x
$cto :: forall x.
Rep GetEndpointAttributesResponse x
-> GetEndpointAttributesResponse
to :: forall x.
Rep GetEndpointAttributesResponse x
-> GetEndpointAttributesResponse
Prelude.Generic)
newGetEndpointAttributesResponse ::
Prelude.Int ->
GetEndpointAttributesResponse
newGetEndpointAttributesResponse :: Int -> GetEndpointAttributesResponse
newGetEndpointAttributesResponse Int
pHttpStatus_ =
GetEndpointAttributesResponse'
{ attributes :: Maybe (HashMap Text Text)
attributes =
Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
httpStatus :: Int
httpStatus = Int
pHttpStatus_
}
getEndpointAttributesResponse_attributes :: Lens.Lens' GetEndpointAttributesResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
getEndpointAttributesResponse_attributes :: Lens' GetEndpointAttributesResponse (Maybe (HashMap Text Text))
getEndpointAttributesResponse_attributes = (GetEndpointAttributesResponse -> Maybe (HashMap Text Text))
-> (GetEndpointAttributesResponse
-> Maybe (HashMap Text Text) -> GetEndpointAttributesResponse)
-> Lens' GetEndpointAttributesResponse (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEndpointAttributesResponse' {Maybe (HashMap Text Text)
attributes :: GetEndpointAttributesResponse -> Maybe (HashMap Text Text)
attributes :: Maybe (HashMap Text Text)
attributes} -> Maybe (HashMap Text Text)
attributes) (\s :: GetEndpointAttributesResponse
s@GetEndpointAttributesResponse' {} Maybe (HashMap Text Text)
a -> GetEndpointAttributesResponse
s {attributes = a} :: GetEndpointAttributesResponse) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> GetEndpointAttributesResponse
-> f GetEndpointAttributesResponse)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> GetEndpointAttributesResponse
-> f GetEndpointAttributesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Iso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
Lens.coerced
getEndpointAttributesResponse_httpStatus :: Lens.Lens' GetEndpointAttributesResponse Prelude.Int
getEndpointAttributesResponse_httpStatus :: Lens' GetEndpointAttributesResponse Int
getEndpointAttributesResponse_httpStatus = (GetEndpointAttributesResponse -> Int)
-> (GetEndpointAttributesResponse
-> Int -> GetEndpointAttributesResponse)
-> Lens' GetEndpointAttributesResponse Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEndpointAttributesResponse' {Int
httpStatus :: GetEndpointAttributesResponse -> Int
httpStatus :: Int
httpStatus} -> Int
httpStatus) (\s :: GetEndpointAttributesResponse
s@GetEndpointAttributesResponse' {} Int
a -> GetEndpointAttributesResponse
s {httpStatus = a} :: GetEndpointAttributesResponse)
instance Prelude.NFData GetEndpointAttributesResponse where
rnf :: GetEndpointAttributesResponse -> ()
rnf GetEndpointAttributesResponse' {Int
Maybe (HashMap Text Text)
attributes :: GetEndpointAttributesResponse -> Maybe (HashMap Text Text)
httpStatus :: GetEndpointAttributesResponse -> Int
attributes :: Maybe (HashMap Text Text)
httpStatus :: Int
..} =
Maybe (HashMap Text Text) -> ()
forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
attributes () -> () -> ()
forall a b. a -> b -> b
`Prelude.seq`
Int -> ()
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus