{-# 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.GetTopicAttributes
(
GetTopicAttributes (..),
newGetTopicAttributes,
getTopicAttributes_topicArn,
GetTopicAttributesResponse (..),
newGetTopicAttributesResponse,
getTopicAttributesResponse_attributes,
getTopicAttributesResponse_httpStatus,
)
where
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
import Amazonka.SNS.Types
data GetTopicAttributes = GetTopicAttributes'
{
GetTopicAttributes -> Text
topicArn :: Prelude.Text
}
deriving (GetTopicAttributes -> GetTopicAttributes -> Bool
(GetTopicAttributes -> GetTopicAttributes -> Bool)
-> (GetTopicAttributes -> GetTopicAttributes -> Bool)
-> Eq GetTopicAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTopicAttributes -> GetTopicAttributes -> Bool
$c/= :: GetTopicAttributes -> GetTopicAttributes -> Bool
== :: GetTopicAttributes -> GetTopicAttributes -> Bool
$c== :: GetTopicAttributes -> GetTopicAttributes -> Bool
Prelude.Eq, ReadPrec [GetTopicAttributes]
ReadPrec GetTopicAttributes
Int -> ReadS GetTopicAttributes
ReadS [GetTopicAttributes]
(Int -> ReadS GetTopicAttributes)
-> ReadS [GetTopicAttributes]
-> ReadPrec GetTopicAttributes
-> ReadPrec [GetTopicAttributes]
-> Read GetTopicAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTopicAttributes]
$creadListPrec :: ReadPrec [GetTopicAttributes]
readPrec :: ReadPrec GetTopicAttributes
$creadPrec :: ReadPrec GetTopicAttributes
readList :: ReadS [GetTopicAttributes]
$creadList :: ReadS [GetTopicAttributes]
readsPrec :: Int -> ReadS GetTopicAttributes
$creadsPrec :: Int -> ReadS GetTopicAttributes
Prelude.Read, Int -> GetTopicAttributes -> ShowS
[GetTopicAttributes] -> ShowS
GetTopicAttributes -> String
(Int -> GetTopicAttributes -> ShowS)
-> (GetTopicAttributes -> String)
-> ([GetTopicAttributes] -> ShowS)
-> Show GetTopicAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTopicAttributes] -> ShowS
$cshowList :: [GetTopicAttributes] -> ShowS
show :: GetTopicAttributes -> String
$cshow :: GetTopicAttributes -> String
showsPrec :: Int -> GetTopicAttributes -> ShowS
$cshowsPrec :: Int -> GetTopicAttributes -> ShowS
Prelude.Show, (forall x. GetTopicAttributes -> Rep GetTopicAttributes x)
-> (forall x. Rep GetTopicAttributes x -> GetTopicAttributes)
-> Generic GetTopicAttributes
forall x. Rep GetTopicAttributes x -> GetTopicAttributes
forall x. GetTopicAttributes -> Rep GetTopicAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetTopicAttributes x -> GetTopicAttributes
$cfrom :: forall x. GetTopicAttributes -> Rep GetTopicAttributes x
Prelude.Generic)
newGetTopicAttributes ::
Prelude.Text ->
GetTopicAttributes
newGetTopicAttributes :: Text -> GetTopicAttributes
newGetTopicAttributes Text
pTopicArn_ =
GetTopicAttributes' :: Text -> GetTopicAttributes
GetTopicAttributes' {$sel:topicArn:GetTopicAttributes' :: Text
topicArn = Text
pTopicArn_}
getTopicAttributes_topicArn :: Lens.Lens' GetTopicAttributes Prelude.Text
getTopicAttributes_topicArn :: (Text -> f Text) -> GetTopicAttributes -> f GetTopicAttributes
getTopicAttributes_topicArn = (GetTopicAttributes -> Text)
-> (GetTopicAttributes -> Text -> GetTopicAttributes)
-> Lens GetTopicAttributes GetTopicAttributes Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTopicAttributes' {Text
topicArn :: Text
$sel:topicArn:GetTopicAttributes' :: GetTopicAttributes -> Text
topicArn} -> Text
topicArn) (\s :: GetTopicAttributes
s@GetTopicAttributes' {} Text
a -> GetTopicAttributes
s {$sel:topicArn:GetTopicAttributes' :: Text
topicArn = Text
a} :: GetTopicAttributes)
instance Core.AWSRequest GetTopicAttributes where
type
AWSResponse GetTopicAttributes =
GetTopicAttributesResponse
request :: GetTopicAttributes -> Request GetTopicAttributes
request = Service -> GetTopicAttributes -> Request GetTopicAttributes
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy GetTopicAttributes
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetTopicAttributes)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetTopicAttributes))
-> Logger
-> Service
-> Proxy GetTopicAttributes
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetTopicAttributes)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"GetTopicAttributesResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe (HashMap Text Text) -> Int -> GetTopicAttributesResponse
GetTopicAttributesResponse'
(Maybe (HashMap Text Text) -> Int -> GetTopicAttributesResponse)
-> Either String (Maybe (HashMap Text Text))
-> Either String (Int -> GetTopicAttributesResponse)
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)
Core..@? 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 (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)
Core.parseXMLMap Text
"entry" Text
"key" Text
"value")
)
Either String (Int -> GetTopicAttributesResponse)
-> Either String Int -> Either String GetTopicAttributesResponse
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 GetTopicAttributes
instance Prelude.NFData GetTopicAttributes
instance Core.ToHeaders GetTopicAttributes where
toHeaders :: GetTopicAttributes -> ResponseHeaders
toHeaders = ResponseHeaders -> GetTopicAttributes -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetTopicAttributes where
toPath :: GetTopicAttributes -> ByteString
toPath = ByteString -> GetTopicAttributes -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetTopicAttributes where
toQuery :: GetTopicAttributes -> QueryString
toQuery GetTopicAttributes' {Text
topicArn :: Text
$sel:topicArn:GetTopicAttributes' :: GetTopicAttributes -> Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"GetTopicAttributes" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-03-31" :: Prelude.ByteString),
ByteString
"TopicArn" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
topicArn
]
data GetTopicAttributesResponse = GetTopicAttributesResponse'
{
GetTopicAttributesResponse -> Maybe (HashMap Text Text)
attributes :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
GetTopicAttributesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetTopicAttributesResponse -> GetTopicAttributesResponse -> Bool
(GetTopicAttributesResponse -> GetTopicAttributesResponse -> Bool)
-> (GetTopicAttributesResponse
-> GetTopicAttributesResponse -> Bool)
-> Eq GetTopicAttributesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTopicAttributesResponse -> GetTopicAttributesResponse -> Bool
$c/= :: GetTopicAttributesResponse -> GetTopicAttributesResponse -> Bool
== :: GetTopicAttributesResponse -> GetTopicAttributesResponse -> Bool
$c== :: GetTopicAttributesResponse -> GetTopicAttributesResponse -> Bool
Prelude.Eq, ReadPrec [GetTopicAttributesResponse]
ReadPrec GetTopicAttributesResponse
Int -> ReadS GetTopicAttributesResponse
ReadS [GetTopicAttributesResponse]
(Int -> ReadS GetTopicAttributesResponse)
-> ReadS [GetTopicAttributesResponse]
-> ReadPrec GetTopicAttributesResponse
-> ReadPrec [GetTopicAttributesResponse]
-> Read GetTopicAttributesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTopicAttributesResponse]
$creadListPrec :: ReadPrec [GetTopicAttributesResponse]
readPrec :: ReadPrec GetTopicAttributesResponse
$creadPrec :: ReadPrec GetTopicAttributesResponse
readList :: ReadS [GetTopicAttributesResponse]
$creadList :: ReadS [GetTopicAttributesResponse]
readsPrec :: Int -> ReadS GetTopicAttributesResponse
$creadsPrec :: Int -> ReadS GetTopicAttributesResponse
Prelude.Read, Int -> GetTopicAttributesResponse -> ShowS
[GetTopicAttributesResponse] -> ShowS
GetTopicAttributesResponse -> String
(Int -> GetTopicAttributesResponse -> ShowS)
-> (GetTopicAttributesResponse -> String)
-> ([GetTopicAttributesResponse] -> ShowS)
-> Show GetTopicAttributesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTopicAttributesResponse] -> ShowS
$cshowList :: [GetTopicAttributesResponse] -> ShowS
show :: GetTopicAttributesResponse -> String
$cshow :: GetTopicAttributesResponse -> String
showsPrec :: Int -> GetTopicAttributesResponse -> ShowS
$cshowsPrec :: Int -> GetTopicAttributesResponse -> ShowS
Prelude.Show, (forall x.
GetTopicAttributesResponse -> Rep GetTopicAttributesResponse x)
-> (forall x.
Rep GetTopicAttributesResponse x -> GetTopicAttributesResponse)
-> Generic GetTopicAttributesResponse
forall x.
Rep GetTopicAttributesResponse x -> GetTopicAttributesResponse
forall x.
GetTopicAttributesResponse -> Rep GetTopicAttributesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetTopicAttributesResponse x -> GetTopicAttributesResponse
$cfrom :: forall x.
GetTopicAttributesResponse -> Rep GetTopicAttributesResponse x
Prelude.Generic)
newGetTopicAttributesResponse ::
Prelude.Int ->
GetTopicAttributesResponse
newGetTopicAttributesResponse :: Int -> GetTopicAttributesResponse
newGetTopicAttributesResponse Int
pHttpStatus_ =
GetTopicAttributesResponse' :: Maybe (HashMap Text Text) -> Int -> GetTopicAttributesResponse
GetTopicAttributesResponse'
{ $sel:attributes:GetTopicAttributesResponse' :: Maybe (HashMap Text Text)
attributes =
Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetTopicAttributesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getTopicAttributesResponse_attributes :: Lens.Lens' GetTopicAttributesResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
getTopicAttributesResponse_attributes :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> GetTopicAttributesResponse -> f GetTopicAttributesResponse
getTopicAttributesResponse_attributes = (GetTopicAttributesResponse -> Maybe (HashMap Text Text))
-> (GetTopicAttributesResponse
-> Maybe (HashMap Text Text) -> GetTopicAttributesResponse)
-> Lens
GetTopicAttributesResponse
GetTopicAttributesResponse
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTopicAttributesResponse' {Maybe (HashMap Text Text)
attributes :: Maybe (HashMap Text Text)
$sel:attributes:GetTopicAttributesResponse' :: GetTopicAttributesResponse -> Maybe (HashMap Text Text)
attributes} -> Maybe (HashMap Text Text)
attributes) (\s :: GetTopicAttributesResponse
s@GetTopicAttributesResponse' {} Maybe (HashMap Text Text)
a -> GetTopicAttributesResponse
s {$sel:attributes:GetTopicAttributesResponse' :: Maybe (HashMap Text Text)
attributes = Maybe (HashMap Text Text)
a} :: GetTopicAttributesResponse) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> GetTopicAttributesResponse -> f GetTopicAttributesResponse)
-> ((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)))
-> GetTopicAttributesResponse
-> f GetTopicAttributesResponse
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
Lens.coerced
getTopicAttributesResponse_httpStatus :: Lens.Lens' GetTopicAttributesResponse Prelude.Int
getTopicAttributesResponse_httpStatus :: (Int -> f Int)
-> GetTopicAttributesResponse -> f GetTopicAttributesResponse
getTopicAttributesResponse_httpStatus = (GetTopicAttributesResponse -> Int)
-> (GetTopicAttributesResponse
-> Int -> GetTopicAttributesResponse)
-> Lens
GetTopicAttributesResponse GetTopicAttributesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTopicAttributesResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetTopicAttributesResponse' :: GetTopicAttributesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetTopicAttributesResponse
s@GetTopicAttributesResponse' {} Int
a -> GetTopicAttributesResponse
s {$sel:httpStatus:GetTopicAttributesResponse' :: Int
httpStatus = Int
a} :: GetTopicAttributesResponse)
instance Prelude.NFData GetTopicAttributesResponse