{-# 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.CreatePlatformApplication
(
CreatePlatformApplication (..),
newCreatePlatformApplication,
createPlatformApplication_name,
createPlatformApplication_platform,
createPlatformApplication_attributes,
CreatePlatformApplicationResponse (..),
newCreatePlatformApplicationResponse,
createPlatformApplicationResponse_platformApplicationArn,
createPlatformApplicationResponse_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 CreatePlatformApplication = CreatePlatformApplication'
{
CreatePlatformApplication -> Text
name :: Prelude.Text,
CreatePlatformApplication -> Text
platform :: Prelude.Text,
CreatePlatformApplication -> HashMap Text Text
attributes :: Prelude.HashMap Prelude.Text Prelude.Text
}
deriving (CreatePlatformApplication -> CreatePlatformApplication -> Bool
(CreatePlatformApplication -> CreatePlatformApplication -> Bool)
-> (CreatePlatformApplication -> CreatePlatformApplication -> Bool)
-> Eq CreatePlatformApplication
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePlatformApplication -> CreatePlatformApplication -> Bool
$c/= :: CreatePlatformApplication -> CreatePlatformApplication -> Bool
== :: CreatePlatformApplication -> CreatePlatformApplication -> Bool
$c== :: CreatePlatformApplication -> CreatePlatformApplication -> Bool
Prelude.Eq, ReadPrec [CreatePlatformApplication]
ReadPrec CreatePlatformApplication
Int -> ReadS CreatePlatformApplication
ReadS [CreatePlatformApplication]
(Int -> ReadS CreatePlatformApplication)
-> ReadS [CreatePlatformApplication]
-> ReadPrec CreatePlatformApplication
-> ReadPrec [CreatePlatformApplication]
-> Read CreatePlatformApplication
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePlatformApplication]
$creadListPrec :: ReadPrec [CreatePlatformApplication]
readPrec :: ReadPrec CreatePlatformApplication
$creadPrec :: ReadPrec CreatePlatformApplication
readList :: ReadS [CreatePlatformApplication]
$creadList :: ReadS [CreatePlatformApplication]
readsPrec :: Int -> ReadS CreatePlatformApplication
$creadsPrec :: Int -> ReadS CreatePlatformApplication
Prelude.Read, Int -> CreatePlatformApplication -> ShowS
[CreatePlatformApplication] -> ShowS
CreatePlatformApplication -> String
(Int -> CreatePlatformApplication -> ShowS)
-> (CreatePlatformApplication -> String)
-> ([CreatePlatformApplication] -> ShowS)
-> Show CreatePlatformApplication
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePlatformApplication] -> ShowS
$cshowList :: [CreatePlatformApplication] -> ShowS
show :: CreatePlatformApplication -> String
$cshow :: CreatePlatformApplication -> String
showsPrec :: Int -> CreatePlatformApplication -> ShowS
$cshowsPrec :: Int -> CreatePlatformApplication -> ShowS
Prelude.Show, (forall x.
CreatePlatformApplication -> Rep CreatePlatformApplication x)
-> (forall x.
Rep CreatePlatformApplication x -> CreatePlatformApplication)
-> Generic CreatePlatformApplication
forall x.
Rep CreatePlatformApplication x -> CreatePlatformApplication
forall x.
CreatePlatformApplication -> Rep CreatePlatformApplication x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreatePlatformApplication x -> CreatePlatformApplication
$cfrom :: forall x.
CreatePlatformApplication -> Rep CreatePlatformApplication x
Prelude.Generic)
newCreatePlatformApplication ::
Prelude.Text ->
Prelude.Text ->
CreatePlatformApplication
newCreatePlatformApplication :: Text -> Text -> CreatePlatformApplication
newCreatePlatformApplication Text
pName_ Text
pPlatform_ =
CreatePlatformApplication' :: Text -> Text -> HashMap Text Text -> CreatePlatformApplication
CreatePlatformApplication'
{ $sel:name:CreatePlatformApplication' :: Text
name = Text
pName_,
$sel:platform:CreatePlatformApplication' :: Text
platform = Text
pPlatform_,
$sel:attributes:CreatePlatformApplication' :: HashMap Text Text
attributes = HashMap Text Text
forall a. Monoid a => a
Prelude.mempty
}
createPlatformApplication_name :: Lens.Lens' CreatePlatformApplication Prelude.Text
createPlatformApplication_name :: (Text -> f Text)
-> CreatePlatformApplication -> f CreatePlatformApplication
createPlatformApplication_name = (CreatePlatformApplication -> Text)
-> (CreatePlatformApplication -> Text -> CreatePlatformApplication)
-> Lens
CreatePlatformApplication CreatePlatformApplication Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePlatformApplication' {Text
name :: Text
$sel:name:CreatePlatformApplication' :: CreatePlatformApplication -> Text
name} -> Text
name) (\s :: CreatePlatformApplication
s@CreatePlatformApplication' {} Text
a -> CreatePlatformApplication
s {$sel:name:CreatePlatformApplication' :: Text
name = Text
a} :: CreatePlatformApplication)
createPlatformApplication_platform :: Lens.Lens' CreatePlatformApplication Prelude.Text
createPlatformApplication_platform :: (Text -> f Text)
-> CreatePlatformApplication -> f CreatePlatformApplication
createPlatformApplication_platform = (CreatePlatformApplication -> Text)
-> (CreatePlatformApplication -> Text -> CreatePlatformApplication)
-> Lens
CreatePlatformApplication CreatePlatformApplication Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePlatformApplication' {Text
platform :: Text
$sel:platform:CreatePlatformApplication' :: CreatePlatformApplication -> Text
platform} -> Text
platform) (\s :: CreatePlatformApplication
s@CreatePlatformApplication' {} Text
a -> CreatePlatformApplication
s {$sel:platform:CreatePlatformApplication' :: Text
platform = Text
a} :: CreatePlatformApplication)
createPlatformApplication_attributes :: Lens.Lens' CreatePlatformApplication (Prelude.HashMap Prelude.Text Prelude.Text)
createPlatformApplication_attributes :: (HashMap Text Text -> f (HashMap Text Text))
-> CreatePlatformApplication -> f CreatePlatformApplication
createPlatformApplication_attributes = (CreatePlatformApplication -> HashMap Text Text)
-> (CreatePlatformApplication
-> HashMap Text Text -> CreatePlatformApplication)
-> Lens
CreatePlatformApplication
CreatePlatformApplication
(HashMap Text Text)
(HashMap Text Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePlatformApplication' {HashMap Text Text
attributes :: HashMap Text Text
$sel:attributes:CreatePlatformApplication' :: CreatePlatformApplication -> HashMap Text Text
attributes} -> HashMap Text Text
attributes) (\s :: CreatePlatformApplication
s@CreatePlatformApplication' {} HashMap Text Text
a -> CreatePlatformApplication
s {$sel:attributes:CreatePlatformApplication' :: HashMap Text Text
attributes = HashMap Text Text
a} :: CreatePlatformApplication) ((HashMap Text Text -> f (HashMap Text Text))
-> CreatePlatformApplication -> f CreatePlatformApplication)
-> ((HashMap Text Text -> f (HashMap Text Text))
-> HashMap Text Text -> f (HashMap Text Text))
-> (HashMap Text Text -> f (HashMap Text Text))
-> CreatePlatformApplication
-> f CreatePlatformApplication
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text Text -> f (HashMap Text Text))
-> HashMap Text Text -> f (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest CreatePlatformApplication where
type
AWSResponse CreatePlatformApplication =
CreatePlatformApplicationResponse
request :: CreatePlatformApplication -> Request CreatePlatformApplication
request = Service
-> CreatePlatformApplication -> Request CreatePlatformApplication
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy CreatePlatformApplication
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreatePlatformApplication)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse CreatePlatformApplication))
-> Logger
-> Service
-> Proxy CreatePlatformApplication
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreatePlatformApplication)))
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
"CreatePlatformApplicationResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Text -> Int -> CreatePlatformApplicationResponse
CreatePlatformApplicationResponse'
(Maybe Text -> Int -> CreatePlatformApplicationResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreatePlatformApplicationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PlatformApplicationArn")
Either String (Int -> CreatePlatformApplicationResponse)
-> Either String Int
-> Either String CreatePlatformApplicationResponse
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 CreatePlatformApplication
instance Prelude.NFData CreatePlatformApplication
instance Core.ToHeaders CreatePlatformApplication where
toHeaders :: CreatePlatformApplication -> ResponseHeaders
toHeaders = ResponseHeaders -> CreatePlatformApplication -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath CreatePlatformApplication where
toPath :: CreatePlatformApplication -> ByteString
toPath = ByteString -> CreatePlatformApplication -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreatePlatformApplication where
toQuery :: CreatePlatformApplication -> QueryString
toQuery CreatePlatformApplication' {Text
HashMap Text Text
attributes :: HashMap Text Text
platform :: Text
name :: Text
$sel:attributes:CreatePlatformApplication' :: CreatePlatformApplication -> HashMap Text Text
$sel:platform:CreatePlatformApplication' :: CreatePlatformApplication -> Text
$sel:name:CreatePlatformApplication' :: CreatePlatformApplication -> 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
"CreatePlatformApplication" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-03-31" :: Prelude.ByteString),
ByteString
"Name" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
name,
ByteString
"Platform" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
platform,
ByteString
"Attributes"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ByteString
-> ByteString -> ByteString -> HashMap Text Text -> QueryString
forall k v.
(ToQuery k, ToQuery v) =>
ByteString
-> ByteString -> ByteString -> HashMap k v -> QueryString
Core.toQueryMap ByteString
"entry" ByteString
"key" ByteString
"value" HashMap Text Text
attributes
]
data CreatePlatformApplicationResponse = CreatePlatformApplicationResponse'
{
CreatePlatformApplicationResponse -> Maybe Text
platformApplicationArn :: Prelude.Maybe Prelude.Text,
CreatePlatformApplicationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreatePlatformApplicationResponse
-> CreatePlatformApplicationResponse -> Bool
(CreatePlatformApplicationResponse
-> CreatePlatformApplicationResponse -> Bool)
-> (CreatePlatformApplicationResponse
-> CreatePlatformApplicationResponse -> Bool)
-> Eq CreatePlatformApplicationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePlatformApplicationResponse
-> CreatePlatformApplicationResponse -> Bool
$c/= :: CreatePlatformApplicationResponse
-> CreatePlatformApplicationResponse -> Bool
== :: CreatePlatformApplicationResponse
-> CreatePlatformApplicationResponse -> Bool
$c== :: CreatePlatformApplicationResponse
-> CreatePlatformApplicationResponse -> Bool
Prelude.Eq, ReadPrec [CreatePlatformApplicationResponse]
ReadPrec CreatePlatformApplicationResponse
Int -> ReadS CreatePlatformApplicationResponse
ReadS [CreatePlatformApplicationResponse]
(Int -> ReadS CreatePlatformApplicationResponse)
-> ReadS [CreatePlatformApplicationResponse]
-> ReadPrec CreatePlatformApplicationResponse
-> ReadPrec [CreatePlatformApplicationResponse]
-> Read CreatePlatformApplicationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePlatformApplicationResponse]
$creadListPrec :: ReadPrec [CreatePlatformApplicationResponse]
readPrec :: ReadPrec CreatePlatformApplicationResponse
$creadPrec :: ReadPrec CreatePlatformApplicationResponse
readList :: ReadS [CreatePlatformApplicationResponse]
$creadList :: ReadS [CreatePlatformApplicationResponse]
readsPrec :: Int -> ReadS CreatePlatformApplicationResponse
$creadsPrec :: Int -> ReadS CreatePlatformApplicationResponse
Prelude.Read, Int -> CreatePlatformApplicationResponse -> ShowS
[CreatePlatformApplicationResponse] -> ShowS
CreatePlatformApplicationResponse -> String
(Int -> CreatePlatformApplicationResponse -> ShowS)
-> (CreatePlatformApplicationResponse -> String)
-> ([CreatePlatformApplicationResponse] -> ShowS)
-> Show CreatePlatformApplicationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePlatformApplicationResponse] -> ShowS
$cshowList :: [CreatePlatformApplicationResponse] -> ShowS
show :: CreatePlatformApplicationResponse -> String
$cshow :: CreatePlatformApplicationResponse -> String
showsPrec :: Int -> CreatePlatformApplicationResponse -> ShowS
$cshowsPrec :: Int -> CreatePlatformApplicationResponse -> ShowS
Prelude.Show, (forall x.
CreatePlatformApplicationResponse
-> Rep CreatePlatformApplicationResponse x)
-> (forall x.
Rep CreatePlatformApplicationResponse x
-> CreatePlatformApplicationResponse)
-> Generic CreatePlatformApplicationResponse
forall x.
Rep CreatePlatformApplicationResponse x
-> CreatePlatformApplicationResponse
forall x.
CreatePlatformApplicationResponse
-> Rep CreatePlatformApplicationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreatePlatformApplicationResponse x
-> CreatePlatformApplicationResponse
$cfrom :: forall x.
CreatePlatformApplicationResponse
-> Rep CreatePlatformApplicationResponse x
Prelude.Generic)
newCreatePlatformApplicationResponse ::
Prelude.Int ->
CreatePlatformApplicationResponse
newCreatePlatformApplicationResponse :: Int -> CreatePlatformApplicationResponse
newCreatePlatformApplicationResponse Int
pHttpStatus_ =
CreatePlatformApplicationResponse' :: Maybe Text -> Int -> CreatePlatformApplicationResponse
CreatePlatformApplicationResponse'
{ $sel:platformApplicationArn:CreatePlatformApplicationResponse' :: Maybe Text
platformApplicationArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreatePlatformApplicationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createPlatformApplicationResponse_platformApplicationArn :: Lens.Lens' CreatePlatformApplicationResponse (Prelude.Maybe Prelude.Text)
createPlatformApplicationResponse_platformApplicationArn :: (Maybe Text -> f (Maybe Text))
-> CreatePlatformApplicationResponse
-> f CreatePlatformApplicationResponse
createPlatformApplicationResponse_platformApplicationArn = (CreatePlatformApplicationResponse -> Maybe Text)
-> (CreatePlatformApplicationResponse
-> Maybe Text -> CreatePlatformApplicationResponse)
-> Lens
CreatePlatformApplicationResponse
CreatePlatformApplicationResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePlatformApplicationResponse' {Maybe Text
platformApplicationArn :: Maybe Text
$sel:platformApplicationArn:CreatePlatformApplicationResponse' :: CreatePlatformApplicationResponse -> Maybe Text
platformApplicationArn} -> Maybe Text
platformApplicationArn) (\s :: CreatePlatformApplicationResponse
s@CreatePlatformApplicationResponse' {} Maybe Text
a -> CreatePlatformApplicationResponse
s {$sel:platformApplicationArn:CreatePlatformApplicationResponse' :: Maybe Text
platformApplicationArn = Maybe Text
a} :: CreatePlatformApplicationResponse)
createPlatformApplicationResponse_httpStatus :: Lens.Lens' CreatePlatformApplicationResponse Prelude.Int
createPlatformApplicationResponse_httpStatus :: (Int -> f Int)
-> CreatePlatformApplicationResponse
-> f CreatePlatformApplicationResponse
createPlatformApplicationResponse_httpStatus = (CreatePlatformApplicationResponse -> Int)
-> (CreatePlatformApplicationResponse
-> Int -> CreatePlatformApplicationResponse)
-> Lens
CreatePlatformApplicationResponse
CreatePlatformApplicationResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePlatformApplicationResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreatePlatformApplicationResponse' :: CreatePlatformApplicationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreatePlatformApplicationResponse
s@CreatePlatformApplicationResponse' {} Int
a -> CreatePlatformApplicationResponse
s {$sel:httpStatus:CreatePlatformApplicationResponse' :: Int
httpStatus = Int
a} :: CreatePlatformApplicationResponse)
instance
Prelude.NFData
CreatePlatformApplicationResponse