{-# 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.WorkDocs.CreateNotificationSubscription
(
CreateNotificationSubscription (..),
newCreateNotificationSubscription,
createNotificationSubscription_organizationId,
createNotificationSubscription_endpoint,
createNotificationSubscription_protocol,
createNotificationSubscription_subscriptionType,
CreateNotificationSubscriptionResponse (..),
newCreateNotificationSubscriptionResponse,
createNotificationSubscriptionResponse_subscription,
createNotificationSubscriptionResponse_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.WorkDocs.Types
data CreateNotificationSubscription = CreateNotificationSubscription'
{
CreateNotificationSubscription -> Text
organizationId :: Prelude.Text,
CreateNotificationSubscription -> Text
endpoint :: Prelude.Text,
CreateNotificationSubscription -> SubscriptionProtocolType
protocol :: SubscriptionProtocolType,
CreateNotificationSubscription -> SubscriptionType
subscriptionType :: SubscriptionType
}
deriving (CreateNotificationSubscription
-> CreateNotificationSubscription -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateNotificationSubscription
-> CreateNotificationSubscription -> Bool
$c/= :: CreateNotificationSubscription
-> CreateNotificationSubscription -> Bool
== :: CreateNotificationSubscription
-> CreateNotificationSubscription -> Bool
$c== :: CreateNotificationSubscription
-> CreateNotificationSubscription -> Bool
Prelude.Eq, ReadPrec [CreateNotificationSubscription]
ReadPrec CreateNotificationSubscription
Int -> ReadS CreateNotificationSubscription
ReadS [CreateNotificationSubscription]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateNotificationSubscription]
$creadListPrec :: ReadPrec [CreateNotificationSubscription]
readPrec :: ReadPrec CreateNotificationSubscription
$creadPrec :: ReadPrec CreateNotificationSubscription
readList :: ReadS [CreateNotificationSubscription]
$creadList :: ReadS [CreateNotificationSubscription]
readsPrec :: Int -> ReadS CreateNotificationSubscription
$creadsPrec :: Int -> ReadS CreateNotificationSubscription
Prelude.Read, Int -> CreateNotificationSubscription -> ShowS
[CreateNotificationSubscription] -> ShowS
CreateNotificationSubscription -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateNotificationSubscription] -> ShowS
$cshowList :: [CreateNotificationSubscription] -> ShowS
show :: CreateNotificationSubscription -> String
$cshow :: CreateNotificationSubscription -> String
showsPrec :: Int -> CreateNotificationSubscription -> ShowS
$cshowsPrec :: Int -> CreateNotificationSubscription -> ShowS
Prelude.Show, forall x.
Rep CreateNotificationSubscription x
-> CreateNotificationSubscription
forall x.
CreateNotificationSubscription
-> Rep CreateNotificationSubscription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateNotificationSubscription x
-> CreateNotificationSubscription
$cfrom :: forall x.
CreateNotificationSubscription
-> Rep CreateNotificationSubscription x
Prelude.Generic)
newCreateNotificationSubscription ::
Prelude.Text ->
Prelude.Text ->
SubscriptionProtocolType ->
SubscriptionType ->
CreateNotificationSubscription
newCreateNotificationSubscription :: Text
-> Text
-> SubscriptionProtocolType
-> SubscriptionType
-> CreateNotificationSubscription
newCreateNotificationSubscription
Text
pOrganizationId_
Text
pEndpoint_
SubscriptionProtocolType
pProtocol_
SubscriptionType
pSubscriptionType_ =
CreateNotificationSubscription'
{ $sel:organizationId:CreateNotificationSubscription' :: Text
organizationId =
Text
pOrganizationId_,
$sel:endpoint:CreateNotificationSubscription' :: Text
endpoint = Text
pEndpoint_,
$sel:protocol:CreateNotificationSubscription' :: SubscriptionProtocolType
protocol = SubscriptionProtocolType
pProtocol_,
$sel:subscriptionType:CreateNotificationSubscription' :: SubscriptionType
subscriptionType = SubscriptionType
pSubscriptionType_
}
createNotificationSubscription_organizationId :: Lens.Lens' CreateNotificationSubscription Prelude.Text
createNotificationSubscription_organizationId :: Lens' CreateNotificationSubscription Text
createNotificationSubscription_organizationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNotificationSubscription' {Text
organizationId :: Text
$sel:organizationId:CreateNotificationSubscription' :: CreateNotificationSubscription -> Text
organizationId} -> Text
organizationId) (\s :: CreateNotificationSubscription
s@CreateNotificationSubscription' {} Text
a -> CreateNotificationSubscription
s {$sel:organizationId:CreateNotificationSubscription' :: Text
organizationId = Text
a} :: CreateNotificationSubscription)
createNotificationSubscription_endpoint :: Lens.Lens' CreateNotificationSubscription Prelude.Text
createNotificationSubscription_endpoint :: Lens' CreateNotificationSubscription Text
createNotificationSubscription_endpoint = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNotificationSubscription' {Text
endpoint :: Text
$sel:endpoint:CreateNotificationSubscription' :: CreateNotificationSubscription -> Text
endpoint} -> Text
endpoint) (\s :: CreateNotificationSubscription
s@CreateNotificationSubscription' {} Text
a -> CreateNotificationSubscription
s {$sel:endpoint:CreateNotificationSubscription' :: Text
endpoint = Text
a} :: CreateNotificationSubscription)
createNotificationSubscription_protocol :: Lens.Lens' CreateNotificationSubscription SubscriptionProtocolType
createNotificationSubscription_protocol :: Lens' CreateNotificationSubscription SubscriptionProtocolType
createNotificationSubscription_protocol = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNotificationSubscription' {SubscriptionProtocolType
protocol :: SubscriptionProtocolType
$sel:protocol:CreateNotificationSubscription' :: CreateNotificationSubscription -> SubscriptionProtocolType
protocol} -> SubscriptionProtocolType
protocol) (\s :: CreateNotificationSubscription
s@CreateNotificationSubscription' {} SubscriptionProtocolType
a -> CreateNotificationSubscription
s {$sel:protocol:CreateNotificationSubscription' :: SubscriptionProtocolType
protocol = SubscriptionProtocolType
a} :: CreateNotificationSubscription)
createNotificationSubscription_subscriptionType :: Lens.Lens' CreateNotificationSubscription SubscriptionType
createNotificationSubscription_subscriptionType :: Lens' CreateNotificationSubscription SubscriptionType
createNotificationSubscription_subscriptionType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNotificationSubscription' {SubscriptionType
subscriptionType :: SubscriptionType
$sel:subscriptionType:CreateNotificationSubscription' :: CreateNotificationSubscription -> SubscriptionType
subscriptionType} -> SubscriptionType
subscriptionType) (\s :: CreateNotificationSubscription
s@CreateNotificationSubscription' {} SubscriptionType
a -> CreateNotificationSubscription
s {$sel:subscriptionType:CreateNotificationSubscription' :: SubscriptionType
subscriptionType = SubscriptionType
a} :: CreateNotificationSubscription)
instance
Core.AWSRequest
CreateNotificationSubscription
where
type
AWSResponse CreateNotificationSubscription =
CreateNotificationSubscriptionResponse
request :: (Service -> Service)
-> CreateNotificationSubscription
-> Request CreateNotificationSubscription
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateNotificationSubscription
-> ClientResponse ClientBody
-> m (Either
Error
(ClientResponse (AWSResponse CreateNotificationSubscription)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Subscription -> Int -> CreateNotificationSubscriptionResponse
CreateNotificationSubscriptionResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Subscription")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance
Prelude.Hashable
CreateNotificationSubscription
where
hashWithSalt :: Int -> CreateNotificationSubscription -> Int
hashWithSalt
Int
_salt
CreateNotificationSubscription' {Text
SubscriptionProtocolType
SubscriptionType
subscriptionType :: SubscriptionType
protocol :: SubscriptionProtocolType
endpoint :: Text
organizationId :: Text
$sel:subscriptionType:CreateNotificationSubscription' :: CreateNotificationSubscription -> SubscriptionType
$sel:protocol:CreateNotificationSubscription' :: CreateNotificationSubscription -> SubscriptionProtocolType
$sel:endpoint:CreateNotificationSubscription' :: CreateNotificationSubscription -> Text
$sel:organizationId:CreateNotificationSubscription' :: CreateNotificationSubscription -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
organizationId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
endpoint
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` SubscriptionProtocolType
protocol
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` SubscriptionType
subscriptionType
instance
Prelude.NFData
CreateNotificationSubscription
where
rnf :: CreateNotificationSubscription -> ()
rnf CreateNotificationSubscription' {Text
SubscriptionProtocolType
SubscriptionType
subscriptionType :: SubscriptionType
protocol :: SubscriptionProtocolType
endpoint :: Text
organizationId :: Text
$sel:subscriptionType:CreateNotificationSubscription' :: CreateNotificationSubscription -> SubscriptionType
$sel:protocol:CreateNotificationSubscription' :: CreateNotificationSubscription -> SubscriptionProtocolType
$sel:endpoint:CreateNotificationSubscription' :: CreateNotificationSubscription -> Text
$sel:organizationId:CreateNotificationSubscription' :: CreateNotificationSubscription -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
organizationId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
endpoint
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf SubscriptionProtocolType
protocol
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf SubscriptionType
subscriptionType
instance
Data.ToHeaders
CreateNotificationSubscription
where
toHeaders :: CreateNotificationSubscription -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON CreateNotificationSubscription where
toJSON :: CreateNotificationSubscription -> Value
toJSON CreateNotificationSubscription' {Text
SubscriptionProtocolType
SubscriptionType
subscriptionType :: SubscriptionType
protocol :: SubscriptionProtocolType
endpoint :: Text
organizationId :: Text
$sel:subscriptionType:CreateNotificationSubscription' :: CreateNotificationSubscription -> SubscriptionType
$sel:protocol:CreateNotificationSubscription' :: CreateNotificationSubscription -> SubscriptionProtocolType
$sel:endpoint:CreateNotificationSubscription' :: CreateNotificationSubscription -> Text
$sel:organizationId:CreateNotificationSubscription' :: CreateNotificationSubscription -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"Endpoint" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
endpoint),
forall a. a -> Maybe a
Prelude.Just (Key
"Protocol" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= SubscriptionProtocolType
protocol),
forall a. a -> Maybe a
Prelude.Just
(Key
"SubscriptionType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= SubscriptionType
subscriptionType)
]
)
instance Data.ToPath CreateNotificationSubscription where
toPath :: CreateNotificationSubscription -> ByteString
toPath CreateNotificationSubscription' {Text
SubscriptionProtocolType
SubscriptionType
subscriptionType :: SubscriptionType
protocol :: SubscriptionProtocolType
endpoint :: Text
organizationId :: Text
$sel:subscriptionType:CreateNotificationSubscription' :: CreateNotificationSubscription -> SubscriptionType
$sel:protocol:CreateNotificationSubscription' :: CreateNotificationSubscription -> SubscriptionProtocolType
$sel:endpoint:CreateNotificationSubscription' :: CreateNotificationSubscription -> Text
$sel:organizationId:CreateNotificationSubscription' :: CreateNotificationSubscription -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/api/v1/organizations/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
organizationId,
ByteString
"/subscriptions"
]
instance Data.ToQuery CreateNotificationSubscription where
toQuery :: CreateNotificationSubscription -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateNotificationSubscriptionResponse = CreateNotificationSubscriptionResponse'
{
CreateNotificationSubscriptionResponse -> Maybe Subscription
subscription :: Prelude.Maybe Subscription,
CreateNotificationSubscriptionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateNotificationSubscriptionResponse
-> CreateNotificationSubscriptionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateNotificationSubscriptionResponse
-> CreateNotificationSubscriptionResponse -> Bool
$c/= :: CreateNotificationSubscriptionResponse
-> CreateNotificationSubscriptionResponse -> Bool
== :: CreateNotificationSubscriptionResponse
-> CreateNotificationSubscriptionResponse -> Bool
$c== :: CreateNotificationSubscriptionResponse
-> CreateNotificationSubscriptionResponse -> Bool
Prelude.Eq, ReadPrec [CreateNotificationSubscriptionResponse]
ReadPrec CreateNotificationSubscriptionResponse
Int -> ReadS CreateNotificationSubscriptionResponse
ReadS [CreateNotificationSubscriptionResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateNotificationSubscriptionResponse]
$creadListPrec :: ReadPrec [CreateNotificationSubscriptionResponse]
readPrec :: ReadPrec CreateNotificationSubscriptionResponse
$creadPrec :: ReadPrec CreateNotificationSubscriptionResponse
readList :: ReadS [CreateNotificationSubscriptionResponse]
$creadList :: ReadS [CreateNotificationSubscriptionResponse]
readsPrec :: Int -> ReadS CreateNotificationSubscriptionResponse
$creadsPrec :: Int -> ReadS CreateNotificationSubscriptionResponse
Prelude.Read, Int -> CreateNotificationSubscriptionResponse -> ShowS
[CreateNotificationSubscriptionResponse] -> ShowS
CreateNotificationSubscriptionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateNotificationSubscriptionResponse] -> ShowS
$cshowList :: [CreateNotificationSubscriptionResponse] -> ShowS
show :: CreateNotificationSubscriptionResponse -> String
$cshow :: CreateNotificationSubscriptionResponse -> String
showsPrec :: Int -> CreateNotificationSubscriptionResponse -> ShowS
$cshowsPrec :: Int -> CreateNotificationSubscriptionResponse -> ShowS
Prelude.Show, forall x.
Rep CreateNotificationSubscriptionResponse x
-> CreateNotificationSubscriptionResponse
forall x.
CreateNotificationSubscriptionResponse
-> Rep CreateNotificationSubscriptionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateNotificationSubscriptionResponse x
-> CreateNotificationSubscriptionResponse
$cfrom :: forall x.
CreateNotificationSubscriptionResponse
-> Rep CreateNotificationSubscriptionResponse x
Prelude.Generic)
newCreateNotificationSubscriptionResponse ::
Prelude.Int ->
CreateNotificationSubscriptionResponse
newCreateNotificationSubscriptionResponse :: Int -> CreateNotificationSubscriptionResponse
newCreateNotificationSubscriptionResponse
Int
pHttpStatus_ =
CreateNotificationSubscriptionResponse'
{ $sel:subscription:CreateNotificationSubscriptionResponse' :: Maybe Subscription
subscription =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateNotificationSubscriptionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createNotificationSubscriptionResponse_subscription :: Lens.Lens' CreateNotificationSubscriptionResponse (Prelude.Maybe Subscription)
createNotificationSubscriptionResponse_subscription :: Lens' CreateNotificationSubscriptionResponse (Maybe Subscription)
createNotificationSubscriptionResponse_subscription = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNotificationSubscriptionResponse' {Maybe Subscription
subscription :: Maybe Subscription
$sel:subscription:CreateNotificationSubscriptionResponse' :: CreateNotificationSubscriptionResponse -> Maybe Subscription
subscription} -> Maybe Subscription
subscription) (\s :: CreateNotificationSubscriptionResponse
s@CreateNotificationSubscriptionResponse' {} Maybe Subscription
a -> CreateNotificationSubscriptionResponse
s {$sel:subscription:CreateNotificationSubscriptionResponse' :: Maybe Subscription
subscription = Maybe Subscription
a} :: CreateNotificationSubscriptionResponse)
createNotificationSubscriptionResponse_httpStatus :: Lens.Lens' CreateNotificationSubscriptionResponse Prelude.Int
createNotificationSubscriptionResponse_httpStatus :: Lens' CreateNotificationSubscriptionResponse Int
createNotificationSubscriptionResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNotificationSubscriptionResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateNotificationSubscriptionResponse' :: CreateNotificationSubscriptionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateNotificationSubscriptionResponse
s@CreateNotificationSubscriptionResponse' {} Int
a -> CreateNotificationSubscriptionResponse
s {$sel:httpStatus:CreateNotificationSubscriptionResponse' :: Int
httpStatus = Int
a} :: CreateNotificationSubscriptionResponse)
instance
Prelude.NFData
CreateNotificationSubscriptionResponse
where
rnf :: CreateNotificationSubscriptionResponse -> ()
rnf CreateNotificationSubscriptionResponse' {Int
Maybe Subscription
httpStatus :: Int
subscription :: Maybe Subscription
$sel:httpStatus:CreateNotificationSubscriptionResponse' :: CreateNotificationSubscriptionResponse -> Int
$sel:subscription:CreateNotificationSubscriptionResponse' :: CreateNotificationSubscriptionResponse -> Maybe Subscription
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Subscription
subscription
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus