{-# 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.CloudWatchEvents.CreatePartnerEventSource
(
CreatePartnerEventSource (..),
newCreatePartnerEventSource,
createPartnerEventSource_name,
createPartnerEventSource_account,
CreatePartnerEventSourceResponse (..),
newCreatePartnerEventSourceResponse,
createPartnerEventSourceResponse_eventSourceArn,
createPartnerEventSourceResponse_httpStatus,
)
where
import Amazonka.CloudWatchEvents.Types
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
data CreatePartnerEventSource = CreatePartnerEventSource'
{
CreatePartnerEventSource -> Text
name :: Prelude.Text,
CreatePartnerEventSource -> Text
account :: Prelude.Text
}
deriving (CreatePartnerEventSource -> CreatePartnerEventSource -> Bool
(CreatePartnerEventSource -> CreatePartnerEventSource -> Bool)
-> (CreatePartnerEventSource -> CreatePartnerEventSource -> Bool)
-> Eq CreatePartnerEventSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePartnerEventSource -> CreatePartnerEventSource -> Bool
$c/= :: CreatePartnerEventSource -> CreatePartnerEventSource -> Bool
== :: CreatePartnerEventSource -> CreatePartnerEventSource -> Bool
$c== :: CreatePartnerEventSource -> CreatePartnerEventSource -> Bool
Prelude.Eq, ReadPrec [CreatePartnerEventSource]
ReadPrec CreatePartnerEventSource
Int -> ReadS CreatePartnerEventSource
ReadS [CreatePartnerEventSource]
(Int -> ReadS CreatePartnerEventSource)
-> ReadS [CreatePartnerEventSource]
-> ReadPrec CreatePartnerEventSource
-> ReadPrec [CreatePartnerEventSource]
-> Read CreatePartnerEventSource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePartnerEventSource]
$creadListPrec :: ReadPrec [CreatePartnerEventSource]
readPrec :: ReadPrec CreatePartnerEventSource
$creadPrec :: ReadPrec CreatePartnerEventSource
readList :: ReadS [CreatePartnerEventSource]
$creadList :: ReadS [CreatePartnerEventSource]
readsPrec :: Int -> ReadS CreatePartnerEventSource
$creadsPrec :: Int -> ReadS CreatePartnerEventSource
Prelude.Read, Int -> CreatePartnerEventSource -> ShowS
[CreatePartnerEventSource] -> ShowS
CreatePartnerEventSource -> String
(Int -> CreatePartnerEventSource -> ShowS)
-> (CreatePartnerEventSource -> String)
-> ([CreatePartnerEventSource] -> ShowS)
-> Show CreatePartnerEventSource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePartnerEventSource] -> ShowS
$cshowList :: [CreatePartnerEventSource] -> ShowS
show :: CreatePartnerEventSource -> String
$cshow :: CreatePartnerEventSource -> String
showsPrec :: Int -> CreatePartnerEventSource -> ShowS
$cshowsPrec :: Int -> CreatePartnerEventSource -> ShowS
Prelude.Show, (forall x.
CreatePartnerEventSource -> Rep CreatePartnerEventSource x)
-> (forall x.
Rep CreatePartnerEventSource x -> CreatePartnerEventSource)
-> Generic CreatePartnerEventSource
forall x.
Rep CreatePartnerEventSource x -> CreatePartnerEventSource
forall x.
CreatePartnerEventSource -> Rep CreatePartnerEventSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreatePartnerEventSource x -> CreatePartnerEventSource
$cfrom :: forall x.
CreatePartnerEventSource -> Rep CreatePartnerEventSource x
Prelude.Generic)
newCreatePartnerEventSource ::
Prelude.Text ->
Prelude.Text ->
CreatePartnerEventSource
newCreatePartnerEventSource :: Text -> Text -> CreatePartnerEventSource
newCreatePartnerEventSource Text
pName_ Text
pAccount_ =
CreatePartnerEventSource' :: Text -> Text -> CreatePartnerEventSource
CreatePartnerEventSource'
{ $sel:name:CreatePartnerEventSource' :: Text
name = Text
pName_,
$sel:account:CreatePartnerEventSource' :: Text
account = Text
pAccount_
}
createPartnerEventSource_name :: Lens.Lens' CreatePartnerEventSource Prelude.Text
createPartnerEventSource_name :: (Text -> f Text)
-> CreatePartnerEventSource -> f CreatePartnerEventSource
createPartnerEventSource_name = (CreatePartnerEventSource -> Text)
-> (CreatePartnerEventSource -> Text -> CreatePartnerEventSource)
-> Lens CreatePartnerEventSource CreatePartnerEventSource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePartnerEventSource' {Text
name :: Text
$sel:name:CreatePartnerEventSource' :: CreatePartnerEventSource -> Text
name} -> Text
name) (\s :: CreatePartnerEventSource
s@CreatePartnerEventSource' {} Text
a -> CreatePartnerEventSource
s {$sel:name:CreatePartnerEventSource' :: Text
name = Text
a} :: CreatePartnerEventSource)
createPartnerEventSource_account :: Lens.Lens' CreatePartnerEventSource Prelude.Text
createPartnerEventSource_account :: (Text -> f Text)
-> CreatePartnerEventSource -> f CreatePartnerEventSource
createPartnerEventSource_account = (CreatePartnerEventSource -> Text)
-> (CreatePartnerEventSource -> Text -> CreatePartnerEventSource)
-> Lens CreatePartnerEventSource CreatePartnerEventSource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePartnerEventSource' {Text
account :: Text
$sel:account:CreatePartnerEventSource' :: CreatePartnerEventSource -> Text
account} -> Text
account) (\s :: CreatePartnerEventSource
s@CreatePartnerEventSource' {} Text
a -> CreatePartnerEventSource
s {$sel:account:CreatePartnerEventSource' :: Text
account = Text
a} :: CreatePartnerEventSource)
instance Core.AWSRequest CreatePartnerEventSource where
type
AWSResponse CreatePartnerEventSource =
CreatePartnerEventSourceResponse
request :: CreatePartnerEventSource -> Request CreatePartnerEventSource
request = Service
-> CreatePartnerEventSource -> Request CreatePartnerEventSource
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreatePartnerEventSource
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreatePartnerEventSource)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreatePartnerEventSource))
-> Logger
-> Service
-> Proxy CreatePartnerEventSource
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreatePartnerEventSource)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text -> Int -> CreatePartnerEventSourceResponse
CreatePartnerEventSourceResponse'
(Maybe Text -> Int -> CreatePartnerEventSourceResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreatePartnerEventSourceResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"EventSourceArn")
Either String (Int -> CreatePartnerEventSourceResponse)
-> Either String Int
-> Either String CreatePartnerEventSourceResponse
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 CreatePartnerEventSource
instance Prelude.NFData CreatePartnerEventSource
instance Core.ToHeaders CreatePartnerEventSource where
toHeaders :: CreatePartnerEventSource -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreatePartnerEventSource -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSEvents.CreatePartnerEventSource" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON CreatePartnerEventSource where
toJSON :: CreatePartnerEventSource -> Value
toJSON CreatePartnerEventSource' {Text
account :: Text
name :: Text
$sel:account:CreatePartnerEventSource' :: CreatePartnerEventSource -> Text
$sel:name:CreatePartnerEventSource' :: CreatePartnerEventSource -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Account" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
account)
]
)
instance Core.ToPath CreatePartnerEventSource where
toPath :: CreatePartnerEventSource -> ByteString
toPath = ByteString -> CreatePartnerEventSource -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreatePartnerEventSource where
toQuery :: CreatePartnerEventSource -> QueryString
toQuery = QueryString -> CreatePartnerEventSource -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreatePartnerEventSourceResponse = CreatePartnerEventSourceResponse'
{
CreatePartnerEventSourceResponse -> Maybe Text
eventSourceArn :: Prelude.Maybe Prelude.Text,
CreatePartnerEventSourceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreatePartnerEventSourceResponse
-> CreatePartnerEventSourceResponse -> Bool
(CreatePartnerEventSourceResponse
-> CreatePartnerEventSourceResponse -> Bool)
-> (CreatePartnerEventSourceResponse
-> CreatePartnerEventSourceResponse -> Bool)
-> Eq CreatePartnerEventSourceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePartnerEventSourceResponse
-> CreatePartnerEventSourceResponse -> Bool
$c/= :: CreatePartnerEventSourceResponse
-> CreatePartnerEventSourceResponse -> Bool
== :: CreatePartnerEventSourceResponse
-> CreatePartnerEventSourceResponse -> Bool
$c== :: CreatePartnerEventSourceResponse
-> CreatePartnerEventSourceResponse -> Bool
Prelude.Eq, ReadPrec [CreatePartnerEventSourceResponse]
ReadPrec CreatePartnerEventSourceResponse
Int -> ReadS CreatePartnerEventSourceResponse
ReadS [CreatePartnerEventSourceResponse]
(Int -> ReadS CreatePartnerEventSourceResponse)
-> ReadS [CreatePartnerEventSourceResponse]
-> ReadPrec CreatePartnerEventSourceResponse
-> ReadPrec [CreatePartnerEventSourceResponse]
-> Read CreatePartnerEventSourceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePartnerEventSourceResponse]
$creadListPrec :: ReadPrec [CreatePartnerEventSourceResponse]
readPrec :: ReadPrec CreatePartnerEventSourceResponse
$creadPrec :: ReadPrec CreatePartnerEventSourceResponse
readList :: ReadS [CreatePartnerEventSourceResponse]
$creadList :: ReadS [CreatePartnerEventSourceResponse]
readsPrec :: Int -> ReadS CreatePartnerEventSourceResponse
$creadsPrec :: Int -> ReadS CreatePartnerEventSourceResponse
Prelude.Read, Int -> CreatePartnerEventSourceResponse -> ShowS
[CreatePartnerEventSourceResponse] -> ShowS
CreatePartnerEventSourceResponse -> String
(Int -> CreatePartnerEventSourceResponse -> ShowS)
-> (CreatePartnerEventSourceResponse -> String)
-> ([CreatePartnerEventSourceResponse] -> ShowS)
-> Show CreatePartnerEventSourceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePartnerEventSourceResponse] -> ShowS
$cshowList :: [CreatePartnerEventSourceResponse] -> ShowS
show :: CreatePartnerEventSourceResponse -> String
$cshow :: CreatePartnerEventSourceResponse -> String
showsPrec :: Int -> CreatePartnerEventSourceResponse -> ShowS
$cshowsPrec :: Int -> CreatePartnerEventSourceResponse -> ShowS
Prelude.Show, (forall x.
CreatePartnerEventSourceResponse
-> Rep CreatePartnerEventSourceResponse x)
-> (forall x.
Rep CreatePartnerEventSourceResponse x
-> CreatePartnerEventSourceResponse)
-> Generic CreatePartnerEventSourceResponse
forall x.
Rep CreatePartnerEventSourceResponse x
-> CreatePartnerEventSourceResponse
forall x.
CreatePartnerEventSourceResponse
-> Rep CreatePartnerEventSourceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreatePartnerEventSourceResponse x
-> CreatePartnerEventSourceResponse
$cfrom :: forall x.
CreatePartnerEventSourceResponse
-> Rep CreatePartnerEventSourceResponse x
Prelude.Generic)
newCreatePartnerEventSourceResponse ::
Prelude.Int ->
CreatePartnerEventSourceResponse
newCreatePartnerEventSourceResponse :: Int -> CreatePartnerEventSourceResponse
newCreatePartnerEventSourceResponse Int
pHttpStatus_ =
CreatePartnerEventSourceResponse' :: Maybe Text -> Int -> CreatePartnerEventSourceResponse
CreatePartnerEventSourceResponse'
{ $sel:eventSourceArn:CreatePartnerEventSourceResponse' :: Maybe Text
eventSourceArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreatePartnerEventSourceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createPartnerEventSourceResponse_eventSourceArn :: Lens.Lens' CreatePartnerEventSourceResponse (Prelude.Maybe Prelude.Text)
createPartnerEventSourceResponse_eventSourceArn :: (Maybe Text -> f (Maybe Text))
-> CreatePartnerEventSourceResponse
-> f CreatePartnerEventSourceResponse
createPartnerEventSourceResponse_eventSourceArn = (CreatePartnerEventSourceResponse -> Maybe Text)
-> (CreatePartnerEventSourceResponse
-> Maybe Text -> CreatePartnerEventSourceResponse)
-> Lens
CreatePartnerEventSourceResponse
CreatePartnerEventSourceResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePartnerEventSourceResponse' {Maybe Text
eventSourceArn :: Maybe Text
$sel:eventSourceArn:CreatePartnerEventSourceResponse' :: CreatePartnerEventSourceResponse -> Maybe Text
eventSourceArn} -> Maybe Text
eventSourceArn) (\s :: CreatePartnerEventSourceResponse
s@CreatePartnerEventSourceResponse' {} Maybe Text
a -> CreatePartnerEventSourceResponse
s {$sel:eventSourceArn:CreatePartnerEventSourceResponse' :: Maybe Text
eventSourceArn = Maybe Text
a} :: CreatePartnerEventSourceResponse)
createPartnerEventSourceResponse_httpStatus :: Lens.Lens' CreatePartnerEventSourceResponse Prelude.Int
createPartnerEventSourceResponse_httpStatus :: (Int -> f Int)
-> CreatePartnerEventSourceResponse
-> f CreatePartnerEventSourceResponse
createPartnerEventSourceResponse_httpStatus = (CreatePartnerEventSourceResponse -> Int)
-> (CreatePartnerEventSourceResponse
-> Int -> CreatePartnerEventSourceResponse)
-> Lens
CreatePartnerEventSourceResponse
CreatePartnerEventSourceResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePartnerEventSourceResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreatePartnerEventSourceResponse' :: CreatePartnerEventSourceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreatePartnerEventSourceResponse
s@CreatePartnerEventSourceResponse' {} Int
a -> CreatePartnerEventSourceResponse
s {$sel:httpStatus:CreatePartnerEventSourceResponse' :: Int
httpStatus = Int
a} :: CreatePartnerEventSourceResponse)
instance
Prelude.NFData
CreatePartnerEventSourceResponse