{-# 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.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 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
$c== :: CreatePlatformApplication -> CreatePlatformApplication -> Bool
== :: CreatePlatformApplication -> CreatePlatformApplication -> Bool
$c/= :: CreatePlatformApplication -> CreatePlatformApplication -> Bool
/= :: 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
$creadsPrec :: Int -> ReadS CreatePlatformApplication
readsPrec :: Int -> ReadS CreatePlatformApplication
$creadList :: ReadS [CreatePlatformApplication]
readList :: ReadS [CreatePlatformApplication]
$creadPrec :: ReadPrec CreatePlatformApplication
readPrec :: ReadPrec CreatePlatformApplication
$creadListPrec :: ReadPrec [CreatePlatformApplication]
readListPrec :: ReadPrec [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
$cshowsPrec :: Int -> CreatePlatformApplication -> ShowS
showsPrec :: Int -> CreatePlatformApplication -> ShowS
$cshow :: CreatePlatformApplication -> String
show :: CreatePlatformApplication -> String
$cshowList :: [CreatePlatformApplication] -> ShowS
showList :: [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
$cfrom :: forall x.
CreatePlatformApplication -> Rep CreatePlatformApplication x
from :: forall x.
CreatePlatformApplication -> Rep CreatePlatformApplication x
$cto :: forall x.
Rep CreatePlatformApplication x -> CreatePlatformApplication
to :: forall x.
Rep CreatePlatformApplication x -> CreatePlatformApplication
Prelude.Generic)
newCreatePlatformApplication ::
Prelude.Text ->
Prelude.Text ->
CreatePlatformApplication
newCreatePlatformApplication :: Text -> Text -> CreatePlatformApplication
newCreatePlatformApplication Text
pName_ Text
pPlatform_ =
CreatePlatformApplication'
{ name :: Text
name = Text
pName_,
platform :: Text
platform = Text
pPlatform_,
attributes :: HashMap Text Text
attributes = HashMap Text Text
forall a. Monoid a => a
Prelude.mempty
}
createPlatformApplication_name :: Lens.Lens' CreatePlatformApplication Prelude.Text
createPlatformApplication_name :: Lens' CreatePlatformApplication Text
createPlatformApplication_name = (CreatePlatformApplication -> Text)
-> (CreatePlatformApplication -> Text -> CreatePlatformApplication)
-> Lens' CreatePlatformApplication Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePlatformApplication' {Text
name :: CreatePlatformApplication -> Text
name :: Text
name} -> Text
name) (\s :: CreatePlatformApplication
s@CreatePlatformApplication' {} Text
a -> CreatePlatformApplication
s {name = a} :: CreatePlatformApplication)
createPlatformApplication_platform :: Lens.Lens' CreatePlatformApplication Prelude.Text
createPlatformApplication_platform :: Lens' CreatePlatformApplication Text
createPlatformApplication_platform = (CreatePlatformApplication -> Text)
-> (CreatePlatformApplication -> Text -> CreatePlatformApplication)
-> Lens' CreatePlatformApplication Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePlatformApplication' {Text
platform :: CreatePlatformApplication -> Text
platform :: Text
platform} -> Text
platform) (\s :: CreatePlatformApplication
s@CreatePlatformApplication' {} Text
a -> CreatePlatformApplication
s {platform = a} :: CreatePlatformApplication)
createPlatformApplication_attributes :: Lens.Lens' CreatePlatformApplication (Prelude.HashMap Prelude.Text Prelude.Text)
createPlatformApplication_attributes :: Lens' CreatePlatformApplication (HashMap Text Text)
createPlatformApplication_attributes = (CreatePlatformApplication -> HashMap Text Text)
-> (CreatePlatformApplication
-> HashMap Text Text -> CreatePlatformApplication)
-> Lens' CreatePlatformApplication (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 :: CreatePlatformApplication -> HashMap Text Text
attributes :: HashMap Text Text
attributes} -> HashMap Text Text
attributes) (\s :: CreatePlatformApplication
s@CreatePlatformApplication' {} HashMap Text Text
a -> CreatePlatformApplication
s {attributes = 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
Iso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
Lens.coerced
instance Core.AWSRequest CreatePlatformApplication where
type
AWSResponse CreatePlatformApplication =
CreatePlatformApplicationResponse
request :: (Service -> Service)
-> CreatePlatformApplication -> Request CreatePlatformApplication
request Service -> Service
overrides =
Service
-> CreatePlatformApplication -> Request CreatePlatformApplication
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 CreatePlatformApplication
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreatePlatformApplication)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse CreatePlatformApplication))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreatePlatformApplication
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreatePlatformApplication)))
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
"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)
Data..@? Text
"PlatformApplicationArn")
Either String (Int -> CreatePlatformApplicationResponse)
-> Either String Int
-> Either String CreatePlatformApplicationResponse
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 CreatePlatformApplication where
hashWithSalt :: Int -> CreatePlatformApplication -> Int
hashWithSalt Int
_salt CreatePlatformApplication' {Text
HashMap Text Text
name :: CreatePlatformApplication -> Text
platform :: CreatePlatformApplication -> Text
attributes :: CreatePlatformApplication -> HashMap Text Text
name :: Text
platform :: Text
attributes :: HashMap Text Text
..} =
Int
_salt
Int -> Text -> Int
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
Int -> Text -> Int
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
platform
Int -> HashMap Text Text -> Int
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` HashMap Text Text
attributes
instance Prelude.NFData CreatePlatformApplication where
rnf :: CreatePlatformApplication -> ()
rnf CreatePlatformApplication' {Text
HashMap Text Text
name :: CreatePlatformApplication -> Text
platform :: CreatePlatformApplication -> Text
attributes :: CreatePlatformApplication -> HashMap Text Text
name :: Text
platform :: Text
attributes :: HashMap Text Text
..} =
Text -> ()
forall a. NFData a => a -> ()
Prelude.rnf Text
name () -> () -> ()
forall a b. a -> b -> b
`Prelude.seq`
Text -> ()
forall a. NFData a => a -> ()
Prelude.rnf Text
platform () -> () -> ()
forall a b. a -> b -> b
`Prelude.seq`
HashMap Text Text -> ()
forall a. NFData a => a -> ()
Prelude.rnf HashMap Text Text
attributes
instance Data.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 Data.ToPath CreatePlatformApplication where
toPath :: CreatePlatformApplication -> ByteString
toPath = ByteString -> CreatePlatformApplication -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CreatePlatformApplication where
toQuery :: CreatePlatformApplication -> QueryString
toQuery CreatePlatformApplication' {Text
HashMap Text Text
name :: CreatePlatformApplication -> Text
platform :: CreatePlatformApplication -> Text
attributes :: CreatePlatformApplication -> HashMap Text Text
name :: Text
platform :: Text
attributes :: HashMap Text 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
"CreatePlatformApplication" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-03-31" :: Prelude.ByteString),
ByteString
"Name" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
name,
ByteString
"Platform" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
platform,
ByteString
"Attributes"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: ByteString
-> ByteString -> ByteString -> HashMap Text Text -> QueryString
forall k v.
(ToQuery k, ToQuery v) =>
ByteString
-> ByteString -> ByteString -> HashMap k v -> QueryString
Data.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
$c== :: CreatePlatformApplicationResponse
-> CreatePlatformApplicationResponse -> Bool
== :: CreatePlatformApplicationResponse
-> CreatePlatformApplicationResponse -> Bool
$c/= :: CreatePlatformApplicationResponse
-> CreatePlatformApplicationResponse -> Bool
/= :: 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
$creadsPrec :: Int -> ReadS CreatePlatformApplicationResponse
readsPrec :: Int -> ReadS CreatePlatformApplicationResponse
$creadList :: ReadS [CreatePlatformApplicationResponse]
readList :: ReadS [CreatePlatformApplicationResponse]
$creadPrec :: ReadPrec CreatePlatformApplicationResponse
readPrec :: ReadPrec CreatePlatformApplicationResponse
$creadListPrec :: ReadPrec [CreatePlatformApplicationResponse]
readListPrec :: ReadPrec [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
$cshowsPrec :: Int -> CreatePlatformApplicationResponse -> ShowS
showsPrec :: Int -> CreatePlatformApplicationResponse -> ShowS
$cshow :: CreatePlatformApplicationResponse -> String
show :: CreatePlatformApplicationResponse -> String
$cshowList :: [CreatePlatformApplicationResponse] -> ShowS
showList :: [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
$cfrom :: forall x.
CreatePlatformApplicationResponse
-> Rep CreatePlatformApplicationResponse x
from :: forall x.
CreatePlatformApplicationResponse
-> Rep CreatePlatformApplicationResponse x
$cto :: forall x.
Rep CreatePlatformApplicationResponse x
-> CreatePlatformApplicationResponse
to :: forall x.
Rep CreatePlatformApplicationResponse x
-> CreatePlatformApplicationResponse
Prelude.Generic)
newCreatePlatformApplicationResponse ::
Prelude.Int ->
CreatePlatformApplicationResponse
newCreatePlatformApplicationResponse :: Int -> CreatePlatformApplicationResponse
newCreatePlatformApplicationResponse Int
pHttpStatus_ =
CreatePlatformApplicationResponse'
{ platformApplicationArn :: Maybe Text
platformApplicationArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
httpStatus :: Int
httpStatus = Int
pHttpStatus_
}
createPlatformApplicationResponse_platformApplicationArn :: Lens.Lens' CreatePlatformApplicationResponse (Prelude.Maybe Prelude.Text)
createPlatformApplicationResponse_platformApplicationArn :: Lens' CreatePlatformApplicationResponse (Maybe Text)
createPlatformApplicationResponse_platformApplicationArn = (CreatePlatformApplicationResponse -> Maybe Text)
-> (CreatePlatformApplicationResponse
-> Maybe Text -> CreatePlatformApplicationResponse)
-> Lens' CreatePlatformApplicationResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePlatformApplicationResponse' {Maybe Text
platformApplicationArn :: CreatePlatformApplicationResponse -> Maybe Text
platformApplicationArn :: Maybe Text
platformApplicationArn} -> Maybe Text
platformApplicationArn) (\s :: CreatePlatformApplicationResponse
s@CreatePlatformApplicationResponse' {} Maybe Text
a -> CreatePlatformApplicationResponse
s {platformApplicationArn = a} :: CreatePlatformApplicationResponse)
createPlatformApplicationResponse_httpStatus :: Lens.Lens' CreatePlatformApplicationResponse Prelude.Int
createPlatformApplicationResponse_httpStatus :: Lens' CreatePlatformApplicationResponse Int
createPlatformApplicationResponse_httpStatus = (CreatePlatformApplicationResponse -> Int)
-> (CreatePlatformApplicationResponse
-> Int -> CreatePlatformApplicationResponse)
-> Lens' CreatePlatformApplicationResponse Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePlatformApplicationResponse' {Int
httpStatus :: CreatePlatformApplicationResponse -> Int
httpStatus :: Int
httpStatus} -> Int
httpStatus) (\s :: CreatePlatformApplicationResponse
s@CreatePlatformApplicationResponse' {} Int
a -> CreatePlatformApplicationResponse
s {httpStatus = a} :: CreatePlatformApplicationResponse)
instance
Prelude.NFData
CreatePlatformApplicationResponse
where
rnf :: CreatePlatformApplicationResponse -> ()
rnf CreatePlatformApplicationResponse' {Int
Maybe Text
platformApplicationArn :: CreatePlatformApplicationResponse -> Maybe Text
httpStatus :: CreatePlatformApplicationResponse -> Int
platformApplicationArn :: Maybe Text
httpStatus :: Int
..} =
Maybe Text -> ()
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
platformApplicationArn () -> () -> ()
forall a b. a -> b -> b
`Prelude.seq`
Int -> ()
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus