{-# 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.GetSubscriptionAttributes
(
GetSubscriptionAttributes (..),
newGetSubscriptionAttributes,
getSubscriptionAttributes_subscriptionArn,
GetSubscriptionAttributesResponse (..),
newGetSubscriptionAttributesResponse,
getSubscriptionAttributesResponse_attributes,
getSubscriptionAttributesResponse_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 GetSubscriptionAttributes = GetSubscriptionAttributes'
{
GetSubscriptionAttributes -> Text
subscriptionArn :: Prelude.Text
}
deriving (GetSubscriptionAttributes -> GetSubscriptionAttributes -> Bool
(GetSubscriptionAttributes -> GetSubscriptionAttributes -> Bool)
-> (GetSubscriptionAttributes -> GetSubscriptionAttributes -> Bool)
-> Eq GetSubscriptionAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSubscriptionAttributes -> GetSubscriptionAttributes -> Bool
$c/= :: GetSubscriptionAttributes -> GetSubscriptionAttributes -> Bool
== :: GetSubscriptionAttributes -> GetSubscriptionAttributes -> Bool
$c== :: GetSubscriptionAttributes -> GetSubscriptionAttributes -> Bool
Prelude.Eq, ReadPrec [GetSubscriptionAttributes]
ReadPrec GetSubscriptionAttributes
Int -> ReadS GetSubscriptionAttributes
ReadS [GetSubscriptionAttributes]
(Int -> ReadS GetSubscriptionAttributes)
-> ReadS [GetSubscriptionAttributes]
-> ReadPrec GetSubscriptionAttributes
-> ReadPrec [GetSubscriptionAttributes]
-> Read GetSubscriptionAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSubscriptionAttributes]
$creadListPrec :: ReadPrec [GetSubscriptionAttributes]
readPrec :: ReadPrec GetSubscriptionAttributes
$creadPrec :: ReadPrec GetSubscriptionAttributes
readList :: ReadS [GetSubscriptionAttributes]
$creadList :: ReadS [GetSubscriptionAttributes]
readsPrec :: Int -> ReadS GetSubscriptionAttributes
$creadsPrec :: Int -> ReadS GetSubscriptionAttributes
Prelude.Read, Int -> GetSubscriptionAttributes -> ShowS
[GetSubscriptionAttributes] -> ShowS
GetSubscriptionAttributes -> String
(Int -> GetSubscriptionAttributes -> ShowS)
-> (GetSubscriptionAttributes -> String)
-> ([GetSubscriptionAttributes] -> ShowS)
-> Show GetSubscriptionAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSubscriptionAttributes] -> ShowS
$cshowList :: [GetSubscriptionAttributes] -> ShowS
show :: GetSubscriptionAttributes -> String
$cshow :: GetSubscriptionAttributes -> String
showsPrec :: Int -> GetSubscriptionAttributes -> ShowS
$cshowsPrec :: Int -> GetSubscriptionAttributes -> ShowS
Prelude.Show, (forall x.
GetSubscriptionAttributes -> Rep GetSubscriptionAttributes x)
-> (forall x.
Rep GetSubscriptionAttributes x -> GetSubscriptionAttributes)
-> Generic GetSubscriptionAttributes
forall x.
Rep GetSubscriptionAttributes x -> GetSubscriptionAttributes
forall x.
GetSubscriptionAttributes -> Rep GetSubscriptionAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetSubscriptionAttributes x -> GetSubscriptionAttributes
$cfrom :: forall x.
GetSubscriptionAttributes -> Rep GetSubscriptionAttributes x
Prelude.Generic)
newGetSubscriptionAttributes ::
Prelude.Text ->
GetSubscriptionAttributes
newGetSubscriptionAttributes :: Text -> GetSubscriptionAttributes
newGetSubscriptionAttributes Text
pSubscriptionArn_ =
GetSubscriptionAttributes' :: Text -> GetSubscriptionAttributes
GetSubscriptionAttributes'
{ $sel:subscriptionArn:GetSubscriptionAttributes' :: Text
subscriptionArn =
Text
pSubscriptionArn_
}
getSubscriptionAttributes_subscriptionArn :: Lens.Lens' GetSubscriptionAttributes Prelude.Text
getSubscriptionAttributes_subscriptionArn :: (Text -> f Text)
-> GetSubscriptionAttributes -> f GetSubscriptionAttributes
getSubscriptionAttributes_subscriptionArn = (GetSubscriptionAttributes -> Text)
-> (GetSubscriptionAttributes -> Text -> GetSubscriptionAttributes)
-> Lens
GetSubscriptionAttributes GetSubscriptionAttributes Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSubscriptionAttributes' {Text
subscriptionArn :: Text
$sel:subscriptionArn:GetSubscriptionAttributes' :: GetSubscriptionAttributes -> Text
subscriptionArn} -> Text
subscriptionArn) (\s :: GetSubscriptionAttributes
s@GetSubscriptionAttributes' {} Text
a -> GetSubscriptionAttributes
s {$sel:subscriptionArn:GetSubscriptionAttributes' :: Text
subscriptionArn = Text
a} :: GetSubscriptionAttributes)
instance Core.AWSRequest GetSubscriptionAttributes where
type
AWSResponse GetSubscriptionAttributes =
GetSubscriptionAttributesResponse
request :: GetSubscriptionAttributes -> Request GetSubscriptionAttributes
request = Service
-> GetSubscriptionAttributes -> Request GetSubscriptionAttributes
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy GetSubscriptionAttributes
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetSubscriptionAttributes)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetSubscriptionAttributes))
-> Logger
-> Service
-> Proxy GetSubscriptionAttributes
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetSubscriptionAttributes)))
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
"GetSubscriptionAttributesResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe (HashMap Text Text)
-> Int -> GetSubscriptionAttributesResponse
GetSubscriptionAttributesResponse'
(Maybe (HashMap Text Text)
-> Int -> GetSubscriptionAttributesResponse)
-> Either String (Maybe (HashMap Text Text))
-> Either String (Int -> GetSubscriptionAttributesResponse)
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 -> GetSubscriptionAttributesResponse)
-> Either String Int
-> Either String GetSubscriptionAttributesResponse
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 GetSubscriptionAttributes
instance Prelude.NFData GetSubscriptionAttributes
instance Core.ToHeaders GetSubscriptionAttributes where
toHeaders :: GetSubscriptionAttributes -> ResponseHeaders
toHeaders = ResponseHeaders -> GetSubscriptionAttributes -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetSubscriptionAttributes where
toPath :: GetSubscriptionAttributes -> ByteString
toPath = ByteString -> GetSubscriptionAttributes -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetSubscriptionAttributes where
toQuery :: GetSubscriptionAttributes -> QueryString
toQuery GetSubscriptionAttributes' {Text
subscriptionArn :: Text
$sel:subscriptionArn:GetSubscriptionAttributes' :: GetSubscriptionAttributes -> 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
"GetSubscriptionAttributes" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-03-31" :: Prelude.ByteString),
ByteString
"SubscriptionArn" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
subscriptionArn
]
data GetSubscriptionAttributesResponse = GetSubscriptionAttributesResponse'
{
GetSubscriptionAttributesResponse -> Maybe (HashMap Text Text)
attributes :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
GetSubscriptionAttributesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetSubscriptionAttributesResponse
-> GetSubscriptionAttributesResponse -> Bool
(GetSubscriptionAttributesResponse
-> GetSubscriptionAttributesResponse -> Bool)
-> (GetSubscriptionAttributesResponse
-> GetSubscriptionAttributesResponse -> Bool)
-> Eq GetSubscriptionAttributesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSubscriptionAttributesResponse
-> GetSubscriptionAttributesResponse -> Bool
$c/= :: GetSubscriptionAttributesResponse
-> GetSubscriptionAttributesResponse -> Bool
== :: GetSubscriptionAttributesResponse
-> GetSubscriptionAttributesResponse -> Bool
$c== :: GetSubscriptionAttributesResponse
-> GetSubscriptionAttributesResponse -> Bool
Prelude.Eq, ReadPrec [GetSubscriptionAttributesResponse]
ReadPrec GetSubscriptionAttributesResponse
Int -> ReadS GetSubscriptionAttributesResponse
ReadS [GetSubscriptionAttributesResponse]
(Int -> ReadS GetSubscriptionAttributesResponse)
-> ReadS [GetSubscriptionAttributesResponse]
-> ReadPrec GetSubscriptionAttributesResponse
-> ReadPrec [GetSubscriptionAttributesResponse]
-> Read GetSubscriptionAttributesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSubscriptionAttributesResponse]
$creadListPrec :: ReadPrec [GetSubscriptionAttributesResponse]
readPrec :: ReadPrec GetSubscriptionAttributesResponse
$creadPrec :: ReadPrec GetSubscriptionAttributesResponse
readList :: ReadS [GetSubscriptionAttributesResponse]
$creadList :: ReadS [GetSubscriptionAttributesResponse]
readsPrec :: Int -> ReadS GetSubscriptionAttributesResponse
$creadsPrec :: Int -> ReadS GetSubscriptionAttributesResponse
Prelude.Read, Int -> GetSubscriptionAttributesResponse -> ShowS
[GetSubscriptionAttributesResponse] -> ShowS
GetSubscriptionAttributesResponse -> String
(Int -> GetSubscriptionAttributesResponse -> ShowS)
-> (GetSubscriptionAttributesResponse -> String)
-> ([GetSubscriptionAttributesResponse] -> ShowS)
-> Show GetSubscriptionAttributesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSubscriptionAttributesResponse] -> ShowS
$cshowList :: [GetSubscriptionAttributesResponse] -> ShowS
show :: GetSubscriptionAttributesResponse -> String
$cshow :: GetSubscriptionAttributesResponse -> String
showsPrec :: Int -> GetSubscriptionAttributesResponse -> ShowS
$cshowsPrec :: Int -> GetSubscriptionAttributesResponse -> ShowS
Prelude.Show, (forall x.
GetSubscriptionAttributesResponse
-> Rep GetSubscriptionAttributesResponse x)
-> (forall x.
Rep GetSubscriptionAttributesResponse x
-> GetSubscriptionAttributesResponse)
-> Generic GetSubscriptionAttributesResponse
forall x.
Rep GetSubscriptionAttributesResponse x
-> GetSubscriptionAttributesResponse
forall x.
GetSubscriptionAttributesResponse
-> Rep GetSubscriptionAttributesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetSubscriptionAttributesResponse x
-> GetSubscriptionAttributesResponse
$cfrom :: forall x.
GetSubscriptionAttributesResponse
-> Rep GetSubscriptionAttributesResponse x
Prelude.Generic)
newGetSubscriptionAttributesResponse ::
Prelude.Int ->
GetSubscriptionAttributesResponse
newGetSubscriptionAttributesResponse :: Int -> GetSubscriptionAttributesResponse
newGetSubscriptionAttributesResponse Int
pHttpStatus_ =
GetSubscriptionAttributesResponse' :: Maybe (HashMap Text Text)
-> Int -> GetSubscriptionAttributesResponse
GetSubscriptionAttributesResponse'
{ $sel:attributes:GetSubscriptionAttributesResponse' :: Maybe (HashMap Text Text)
attributes =
Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetSubscriptionAttributesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getSubscriptionAttributesResponse_attributes :: Lens.Lens' GetSubscriptionAttributesResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
getSubscriptionAttributesResponse_attributes :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> GetSubscriptionAttributesResponse
-> f GetSubscriptionAttributesResponse
getSubscriptionAttributesResponse_attributes = (GetSubscriptionAttributesResponse -> Maybe (HashMap Text Text))
-> (GetSubscriptionAttributesResponse
-> Maybe (HashMap Text Text) -> GetSubscriptionAttributesResponse)
-> Lens
GetSubscriptionAttributesResponse
GetSubscriptionAttributesResponse
(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 (\GetSubscriptionAttributesResponse' {Maybe (HashMap Text Text)
attributes :: Maybe (HashMap Text Text)
$sel:attributes:GetSubscriptionAttributesResponse' :: GetSubscriptionAttributesResponse -> Maybe (HashMap Text Text)
attributes} -> Maybe (HashMap Text Text)
attributes) (\s :: GetSubscriptionAttributesResponse
s@GetSubscriptionAttributesResponse' {} Maybe (HashMap Text Text)
a -> GetSubscriptionAttributesResponse
s {$sel:attributes:GetSubscriptionAttributesResponse' :: Maybe (HashMap Text Text)
attributes = Maybe (HashMap Text Text)
a} :: GetSubscriptionAttributesResponse) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> GetSubscriptionAttributesResponse
-> f GetSubscriptionAttributesResponse)
-> ((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)))
-> GetSubscriptionAttributesResponse
-> f GetSubscriptionAttributesResponse
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
getSubscriptionAttributesResponse_httpStatus :: Lens.Lens' GetSubscriptionAttributesResponse Prelude.Int
getSubscriptionAttributesResponse_httpStatus :: (Int -> f Int)
-> GetSubscriptionAttributesResponse
-> f GetSubscriptionAttributesResponse
getSubscriptionAttributesResponse_httpStatus = (GetSubscriptionAttributesResponse -> Int)
-> (GetSubscriptionAttributesResponse
-> Int -> GetSubscriptionAttributesResponse)
-> Lens
GetSubscriptionAttributesResponse
GetSubscriptionAttributesResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSubscriptionAttributesResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetSubscriptionAttributesResponse' :: GetSubscriptionAttributesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetSubscriptionAttributesResponse
s@GetSubscriptionAttributesResponse' {} Int
a -> GetSubscriptionAttributesResponse
s {$sel:httpStatus:GetSubscriptionAttributesResponse' :: Int
httpStatus = Int
a} :: GetSubscriptionAttributesResponse)
instance
Prelude.NFData
GetSubscriptionAttributesResponse