{-# 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.CreateEventBus
(
CreateEventBus (..),
newCreateEventBus,
createEventBus_eventSourceName,
createEventBus_tags,
createEventBus_name,
CreateEventBusResponse (..),
newCreateEventBusResponse,
createEventBusResponse_eventBusArn,
createEventBusResponse_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 CreateEventBus = CreateEventBus'
{
CreateEventBus -> Maybe Text
eventSourceName :: Prelude.Maybe Prelude.Text,
CreateEventBus -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateEventBus -> Text
name :: Prelude.Text
}
deriving (CreateEventBus -> CreateEventBus -> Bool
(CreateEventBus -> CreateEventBus -> Bool)
-> (CreateEventBus -> CreateEventBus -> Bool) -> Eq CreateEventBus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateEventBus -> CreateEventBus -> Bool
$c/= :: CreateEventBus -> CreateEventBus -> Bool
== :: CreateEventBus -> CreateEventBus -> Bool
$c== :: CreateEventBus -> CreateEventBus -> Bool
Prelude.Eq, ReadPrec [CreateEventBus]
ReadPrec CreateEventBus
Int -> ReadS CreateEventBus
ReadS [CreateEventBus]
(Int -> ReadS CreateEventBus)
-> ReadS [CreateEventBus]
-> ReadPrec CreateEventBus
-> ReadPrec [CreateEventBus]
-> Read CreateEventBus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateEventBus]
$creadListPrec :: ReadPrec [CreateEventBus]
readPrec :: ReadPrec CreateEventBus
$creadPrec :: ReadPrec CreateEventBus
readList :: ReadS [CreateEventBus]
$creadList :: ReadS [CreateEventBus]
readsPrec :: Int -> ReadS CreateEventBus
$creadsPrec :: Int -> ReadS CreateEventBus
Prelude.Read, Int -> CreateEventBus -> ShowS
[CreateEventBus] -> ShowS
CreateEventBus -> String
(Int -> CreateEventBus -> ShowS)
-> (CreateEventBus -> String)
-> ([CreateEventBus] -> ShowS)
-> Show CreateEventBus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateEventBus] -> ShowS
$cshowList :: [CreateEventBus] -> ShowS
show :: CreateEventBus -> String
$cshow :: CreateEventBus -> String
showsPrec :: Int -> CreateEventBus -> ShowS
$cshowsPrec :: Int -> CreateEventBus -> ShowS
Prelude.Show, (forall x. CreateEventBus -> Rep CreateEventBus x)
-> (forall x. Rep CreateEventBus x -> CreateEventBus)
-> Generic CreateEventBus
forall x. Rep CreateEventBus x -> CreateEventBus
forall x. CreateEventBus -> Rep CreateEventBus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateEventBus x -> CreateEventBus
$cfrom :: forall x. CreateEventBus -> Rep CreateEventBus x
Prelude.Generic)
newCreateEventBus ::
Prelude.Text ->
CreateEventBus
newCreateEventBus :: Text -> CreateEventBus
newCreateEventBus Text
pName_ =
CreateEventBus' :: Maybe Text -> Maybe [Tag] -> Text -> CreateEventBus
CreateEventBus'
{ $sel:eventSourceName:CreateEventBus' :: Maybe Text
eventSourceName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateEventBus' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:name:CreateEventBus' :: Text
name = Text
pName_
}
createEventBus_eventSourceName :: Lens.Lens' CreateEventBus (Prelude.Maybe Prelude.Text)
createEventBus_eventSourceName :: (Maybe Text -> f (Maybe Text))
-> CreateEventBus -> f CreateEventBus
createEventBus_eventSourceName = (CreateEventBus -> Maybe Text)
-> (CreateEventBus -> Maybe Text -> CreateEventBus)
-> Lens CreateEventBus CreateEventBus (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEventBus' {Maybe Text
eventSourceName :: Maybe Text
$sel:eventSourceName:CreateEventBus' :: CreateEventBus -> Maybe Text
eventSourceName} -> Maybe Text
eventSourceName) (\s :: CreateEventBus
s@CreateEventBus' {} Maybe Text
a -> CreateEventBus
s {$sel:eventSourceName:CreateEventBus' :: Maybe Text
eventSourceName = Maybe Text
a} :: CreateEventBus)
createEventBus_tags :: Lens.Lens' CreateEventBus (Prelude.Maybe [Tag])
createEventBus_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateEventBus -> f CreateEventBus
createEventBus_tags = (CreateEventBus -> Maybe [Tag])
-> (CreateEventBus -> Maybe [Tag] -> CreateEventBus)
-> Lens CreateEventBus CreateEventBus (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEventBus' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateEventBus' :: CreateEventBus -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateEventBus
s@CreateEventBus' {} Maybe [Tag]
a -> CreateEventBus
s {$sel:tags:CreateEventBus' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateEventBus) ((Maybe [Tag] -> f (Maybe [Tag]))
-> CreateEventBus -> f CreateEventBus)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateEventBus
-> f CreateEventBus
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createEventBus_name :: Lens.Lens' CreateEventBus Prelude.Text
createEventBus_name :: (Text -> f Text) -> CreateEventBus -> f CreateEventBus
createEventBus_name = (CreateEventBus -> Text)
-> (CreateEventBus -> Text -> CreateEventBus)
-> Lens CreateEventBus CreateEventBus Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEventBus' {Text
name :: Text
$sel:name:CreateEventBus' :: CreateEventBus -> Text
name} -> Text
name) (\s :: CreateEventBus
s@CreateEventBus' {} Text
a -> CreateEventBus
s {$sel:name:CreateEventBus' :: Text
name = Text
a} :: CreateEventBus)
instance Core.AWSRequest CreateEventBus where
type
AWSResponse CreateEventBus =
CreateEventBusResponse
request :: CreateEventBus -> Request CreateEventBus
request = Service -> CreateEventBus -> Request CreateEventBus
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateEventBus
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateEventBus)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateEventBus))
-> Logger
-> Service
-> Proxy CreateEventBus
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateEventBus)))
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 -> CreateEventBusResponse
CreateEventBusResponse'
(Maybe Text -> Int -> CreateEventBusResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateEventBusResponse)
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
"EventBusArn")
Either String (Int -> CreateEventBusResponse)
-> Either String Int -> Either String CreateEventBusResponse
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 CreateEventBus
instance Prelude.NFData CreateEventBus
instance Core.ToHeaders CreateEventBus where
toHeaders :: CreateEventBus -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateEventBus -> 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.CreateEventBus" :: 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 CreateEventBus where
toJSON :: CreateEventBus -> Value
toJSON CreateEventBus' {Maybe [Tag]
Maybe Text
Text
name :: Text
tags :: Maybe [Tag]
eventSourceName :: Maybe Text
$sel:name:CreateEventBus' :: CreateEventBus -> Text
$sel:tags:CreateEventBus' :: CreateEventBus -> Maybe [Tag]
$sel:eventSourceName:CreateEventBus' :: CreateEventBus -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"EventSourceName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
eventSourceName,
(Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
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)
]
)
instance Core.ToPath CreateEventBus where
toPath :: CreateEventBus -> ByteString
toPath = ByteString -> CreateEventBus -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateEventBus where
toQuery :: CreateEventBus -> QueryString
toQuery = QueryString -> CreateEventBus -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateEventBusResponse = CreateEventBusResponse'
{
CreateEventBusResponse -> Maybe Text
eventBusArn :: Prelude.Maybe Prelude.Text,
CreateEventBusResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateEventBusResponse -> CreateEventBusResponse -> Bool
(CreateEventBusResponse -> CreateEventBusResponse -> Bool)
-> (CreateEventBusResponse -> CreateEventBusResponse -> Bool)
-> Eq CreateEventBusResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateEventBusResponse -> CreateEventBusResponse -> Bool
$c/= :: CreateEventBusResponse -> CreateEventBusResponse -> Bool
== :: CreateEventBusResponse -> CreateEventBusResponse -> Bool
$c== :: CreateEventBusResponse -> CreateEventBusResponse -> Bool
Prelude.Eq, ReadPrec [CreateEventBusResponse]
ReadPrec CreateEventBusResponse
Int -> ReadS CreateEventBusResponse
ReadS [CreateEventBusResponse]
(Int -> ReadS CreateEventBusResponse)
-> ReadS [CreateEventBusResponse]
-> ReadPrec CreateEventBusResponse
-> ReadPrec [CreateEventBusResponse]
-> Read CreateEventBusResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateEventBusResponse]
$creadListPrec :: ReadPrec [CreateEventBusResponse]
readPrec :: ReadPrec CreateEventBusResponse
$creadPrec :: ReadPrec CreateEventBusResponse
readList :: ReadS [CreateEventBusResponse]
$creadList :: ReadS [CreateEventBusResponse]
readsPrec :: Int -> ReadS CreateEventBusResponse
$creadsPrec :: Int -> ReadS CreateEventBusResponse
Prelude.Read, Int -> CreateEventBusResponse -> ShowS
[CreateEventBusResponse] -> ShowS
CreateEventBusResponse -> String
(Int -> CreateEventBusResponse -> ShowS)
-> (CreateEventBusResponse -> String)
-> ([CreateEventBusResponse] -> ShowS)
-> Show CreateEventBusResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateEventBusResponse] -> ShowS
$cshowList :: [CreateEventBusResponse] -> ShowS
show :: CreateEventBusResponse -> String
$cshow :: CreateEventBusResponse -> String
showsPrec :: Int -> CreateEventBusResponse -> ShowS
$cshowsPrec :: Int -> CreateEventBusResponse -> ShowS
Prelude.Show, (forall x. CreateEventBusResponse -> Rep CreateEventBusResponse x)
-> (forall x.
Rep CreateEventBusResponse x -> CreateEventBusResponse)
-> Generic CreateEventBusResponse
forall x. Rep CreateEventBusResponse x -> CreateEventBusResponse
forall x. CreateEventBusResponse -> Rep CreateEventBusResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateEventBusResponse x -> CreateEventBusResponse
$cfrom :: forall x. CreateEventBusResponse -> Rep CreateEventBusResponse x
Prelude.Generic)
newCreateEventBusResponse ::
Prelude.Int ->
CreateEventBusResponse
newCreateEventBusResponse :: Int -> CreateEventBusResponse
newCreateEventBusResponse Int
pHttpStatus_ =
CreateEventBusResponse' :: Maybe Text -> Int -> CreateEventBusResponse
CreateEventBusResponse'
{ $sel:eventBusArn:CreateEventBusResponse' :: Maybe Text
eventBusArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateEventBusResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createEventBusResponse_eventBusArn :: Lens.Lens' CreateEventBusResponse (Prelude.Maybe Prelude.Text)
createEventBusResponse_eventBusArn :: (Maybe Text -> f (Maybe Text))
-> CreateEventBusResponse -> f CreateEventBusResponse
createEventBusResponse_eventBusArn = (CreateEventBusResponse -> Maybe Text)
-> (CreateEventBusResponse -> Maybe Text -> CreateEventBusResponse)
-> Lens
CreateEventBusResponse
CreateEventBusResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEventBusResponse' {Maybe Text
eventBusArn :: Maybe Text
$sel:eventBusArn:CreateEventBusResponse' :: CreateEventBusResponse -> Maybe Text
eventBusArn} -> Maybe Text
eventBusArn) (\s :: CreateEventBusResponse
s@CreateEventBusResponse' {} Maybe Text
a -> CreateEventBusResponse
s {$sel:eventBusArn:CreateEventBusResponse' :: Maybe Text
eventBusArn = Maybe Text
a} :: CreateEventBusResponse)
createEventBusResponse_httpStatus :: Lens.Lens' CreateEventBusResponse Prelude.Int
createEventBusResponse_httpStatus :: (Int -> f Int)
-> CreateEventBusResponse -> f CreateEventBusResponse
createEventBusResponse_httpStatus = (CreateEventBusResponse -> Int)
-> (CreateEventBusResponse -> Int -> CreateEventBusResponse)
-> Lens CreateEventBusResponse CreateEventBusResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEventBusResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateEventBusResponse' :: CreateEventBusResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateEventBusResponse
s@CreateEventBusResponse' {} Int
a -> CreateEventBusResponse
s {$sel:httpStatus:CreateEventBusResponse' :: Int
httpStatus = Int
a} :: CreateEventBusResponse)
instance Prelude.NFData CreateEventBusResponse