{-# 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.ListEventBuses
(
ListEventBuses (..),
newListEventBuses,
listEventBuses_nextToken,
listEventBuses_namePrefix,
listEventBuses_limit,
ListEventBusesResponse (..),
newListEventBusesResponse,
listEventBusesResponse_eventBuses,
listEventBusesResponse_nextToken,
listEventBusesResponse_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 ListEventBuses = ListEventBuses'
{
ListEventBuses -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListEventBuses -> Maybe Text
namePrefix :: Prelude.Maybe Prelude.Text,
ListEventBuses -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural
}
deriving (ListEventBuses -> ListEventBuses -> Bool
(ListEventBuses -> ListEventBuses -> Bool)
-> (ListEventBuses -> ListEventBuses -> Bool) -> Eq ListEventBuses
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListEventBuses -> ListEventBuses -> Bool
$c/= :: ListEventBuses -> ListEventBuses -> Bool
== :: ListEventBuses -> ListEventBuses -> Bool
$c== :: ListEventBuses -> ListEventBuses -> Bool
Prelude.Eq, ReadPrec [ListEventBuses]
ReadPrec ListEventBuses
Int -> ReadS ListEventBuses
ReadS [ListEventBuses]
(Int -> ReadS ListEventBuses)
-> ReadS [ListEventBuses]
-> ReadPrec ListEventBuses
-> ReadPrec [ListEventBuses]
-> Read ListEventBuses
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListEventBuses]
$creadListPrec :: ReadPrec [ListEventBuses]
readPrec :: ReadPrec ListEventBuses
$creadPrec :: ReadPrec ListEventBuses
readList :: ReadS [ListEventBuses]
$creadList :: ReadS [ListEventBuses]
readsPrec :: Int -> ReadS ListEventBuses
$creadsPrec :: Int -> ReadS ListEventBuses
Prelude.Read, Int -> ListEventBuses -> ShowS
[ListEventBuses] -> ShowS
ListEventBuses -> String
(Int -> ListEventBuses -> ShowS)
-> (ListEventBuses -> String)
-> ([ListEventBuses] -> ShowS)
-> Show ListEventBuses
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListEventBuses] -> ShowS
$cshowList :: [ListEventBuses] -> ShowS
show :: ListEventBuses -> String
$cshow :: ListEventBuses -> String
showsPrec :: Int -> ListEventBuses -> ShowS
$cshowsPrec :: Int -> ListEventBuses -> ShowS
Prelude.Show, (forall x. ListEventBuses -> Rep ListEventBuses x)
-> (forall x. Rep ListEventBuses x -> ListEventBuses)
-> Generic ListEventBuses
forall x. Rep ListEventBuses x -> ListEventBuses
forall x. ListEventBuses -> Rep ListEventBuses x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListEventBuses x -> ListEventBuses
$cfrom :: forall x. ListEventBuses -> Rep ListEventBuses x
Prelude.Generic)
newListEventBuses ::
ListEventBuses
newListEventBuses :: ListEventBuses
newListEventBuses =
ListEventBuses' :: Maybe Text -> Maybe Text -> Maybe Natural -> ListEventBuses
ListEventBuses'
{ $sel:nextToken:ListEventBuses' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:namePrefix:ListEventBuses' :: Maybe Text
namePrefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:limit:ListEventBuses' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listEventBuses_nextToken :: Lens.Lens' ListEventBuses (Prelude.Maybe Prelude.Text)
listEventBuses_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListEventBuses -> f ListEventBuses
listEventBuses_nextToken = (ListEventBuses -> Maybe Text)
-> (ListEventBuses -> Maybe Text -> ListEventBuses)
-> Lens ListEventBuses ListEventBuses (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEventBuses' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListEventBuses' :: ListEventBuses -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListEventBuses
s@ListEventBuses' {} Maybe Text
a -> ListEventBuses
s {$sel:nextToken:ListEventBuses' :: Maybe Text
nextToken = Maybe Text
a} :: ListEventBuses)
listEventBuses_namePrefix :: Lens.Lens' ListEventBuses (Prelude.Maybe Prelude.Text)
listEventBuses_namePrefix :: (Maybe Text -> f (Maybe Text))
-> ListEventBuses -> f ListEventBuses
listEventBuses_namePrefix = (ListEventBuses -> Maybe Text)
-> (ListEventBuses -> Maybe Text -> ListEventBuses)
-> Lens ListEventBuses ListEventBuses (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEventBuses' {Maybe Text
namePrefix :: Maybe Text
$sel:namePrefix:ListEventBuses' :: ListEventBuses -> Maybe Text
namePrefix} -> Maybe Text
namePrefix) (\s :: ListEventBuses
s@ListEventBuses' {} Maybe Text
a -> ListEventBuses
s {$sel:namePrefix:ListEventBuses' :: Maybe Text
namePrefix = Maybe Text
a} :: ListEventBuses)
listEventBuses_limit :: Lens.Lens' ListEventBuses (Prelude.Maybe Prelude.Natural)
listEventBuses_limit :: (Maybe Natural -> f (Maybe Natural))
-> ListEventBuses -> f ListEventBuses
listEventBuses_limit = (ListEventBuses -> Maybe Natural)
-> (ListEventBuses -> Maybe Natural -> ListEventBuses)
-> Lens
ListEventBuses ListEventBuses (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEventBuses' {Maybe Natural
limit :: Maybe Natural
$sel:limit:ListEventBuses' :: ListEventBuses -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: ListEventBuses
s@ListEventBuses' {} Maybe Natural
a -> ListEventBuses
s {$sel:limit:ListEventBuses' :: Maybe Natural
limit = Maybe Natural
a} :: ListEventBuses)
instance Core.AWSRequest ListEventBuses where
type
AWSResponse ListEventBuses =
ListEventBusesResponse
request :: ListEventBuses -> Request ListEventBuses
request = Service -> ListEventBuses -> Request ListEventBuses
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListEventBuses
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListEventBuses)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListEventBuses))
-> Logger
-> Service
-> Proxy ListEventBuses
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListEventBuses)))
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 [EventBus] -> Maybe Text -> Int -> ListEventBusesResponse
ListEventBusesResponse'
(Maybe [EventBus] -> Maybe Text -> Int -> ListEventBusesResponse)
-> Either String (Maybe [EventBus])
-> Either String (Maybe Text -> Int -> ListEventBusesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [EventBus]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"EventBuses" Either String (Maybe (Maybe [EventBus]))
-> Maybe [EventBus] -> Either String (Maybe [EventBus])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [EventBus]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe Text -> Int -> ListEventBusesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListEventBusesResponse)
forall (f :: * -> *) a b. Applicative f => 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
"NextToken")
Either String (Int -> ListEventBusesResponse)
-> Either String Int -> Either String ListEventBusesResponse
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 ListEventBuses
instance Prelude.NFData ListEventBuses
instance Core.ToHeaders ListEventBuses where
toHeaders :: ListEventBuses -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListEventBuses -> 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.ListEventBuses" :: 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 ListEventBuses where
toJSON :: ListEventBuses -> Value
toJSON ListEventBuses' {Maybe Natural
Maybe Text
limit :: Maybe Natural
namePrefix :: Maybe Text
nextToken :: Maybe Text
$sel:limit:ListEventBuses' :: ListEventBuses -> Maybe Natural
$sel:namePrefix:ListEventBuses' :: ListEventBuses -> Maybe Text
$sel:nextToken:ListEventBuses' :: ListEventBuses -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"NextToken" 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
nextToken,
(Text
"NamePrefix" 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
namePrefix,
(Text
"Limit" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
limit
]
)
instance Core.ToPath ListEventBuses where
toPath :: ListEventBuses -> ByteString
toPath = ByteString -> ListEventBuses -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ListEventBuses where
toQuery :: ListEventBuses -> QueryString
toQuery = QueryString -> ListEventBuses -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListEventBusesResponse = ListEventBusesResponse'
{
ListEventBusesResponse -> Maybe [EventBus]
eventBuses :: Prelude.Maybe [EventBus],
ListEventBusesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListEventBusesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListEventBusesResponse -> ListEventBusesResponse -> Bool
(ListEventBusesResponse -> ListEventBusesResponse -> Bool)
-> (ListEventBusesResponse -> ListEventBusesResponse -> Bool)
-> Eq ListEventBusesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListEventBusesResponse -> ListEventBusesResponse -> Bool
$c/= :: ListEventBusesResponse -> ListEventBusesResponse -> Bool
== :: ListEventBusesResponse -> ListEventBusesResponse -> Bool
$c== :: ListEventBusesResponse -> ListEventBusesResponse -> Bool
Prelude.Eq, ReadPrec [ListEventBusesResponse]
ReadPrec ListEventBusesResponse
Int -> ReadS ListEventBusesResponse
ReadS [ListEventBusesResponse]
(Int -> ReadS ListEventBusesResponse)
-> ReadS [ListEventBusesResponse]
-> ReadPrec ListEventBusesResponse
-> ReadPrec [ListEventBusesResponse]
-> Read ListEventBusesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListEventBusesResponse]
$creadListPrec :: ReadPrec [ListEventBusesResponse]
readPrec :: ReadPrec ListEventBusesResponse
$creadPrec :: ReadPrec ListEventBusesResponse
readList :: ReadS [ListEventBusesResponse]
$creadList :: ReadS [ListEventBusesResponse]
readsPrec :: Int -> ReadS ListEventBusesResponse
$creadsPrec :: Int -> ReadS ListEventBusesResponse
Prelude.Read, Int -> ListEventBusesResponse -> ShowS
[ListEventBusesResponse] -> ShowS
ListEventBusesResponse -> String
(Int -> ListEventBusesResponse -> ShowS)
-> (ListEventBusesResponse -> String)
-> ([ListEventBusesResponse] -> ShowS)
-> Show ListEventBusesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListEventBusesResponse] -> ShowS
$cshowList :: [ListEventBusesResponse] -> ShowS
show :: ListEventBusesResponse -> String
$cshow :: ListEventBusesResponse -> String
showsPrec :: Int -> ListEventBusesResponse -> ShowS
$cshowsPrec :: Int -> ListEventBusesResponse -> ShowS
Prelude.Show, (forall x. ListEventBusesResponse -> Rep ListEventBusesResponse x)
-> (forall x.
Rep ListEventBusesResponse x -> ListEventBusesResponse)
-> Generic ListEventBusesResponse
forall x. Rep ListEventBusesResponse x -> ListEventBusesResponse
forall x. ListEventBusesResponse -> Rep ListEventBusesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListEventBusesResponse x -> ListEventBusesResponse
$cfrom :: forall x. ListEventBusesResponse -> Rep ListEventBusesResponse x
Prelude.Generic)
newListEventBusesResponse ::
Prelude.Int ->
ListEventBusesResponse
newListEventBusesResponse :: Int -> ListEventBusesResponse
newListEventBusesResponse Int
pHttpStatus_ =
ListEventBusesResponse' :: Maybe [EventBus] -> Maybe Text -> Int -> ListEventBusesResponse
ListEventBusesResponse'
{ $sel:eventBuses:ListEventBusesResponse' :: Maybe [EventBus]
eventBuses =
Maybe [EventBus]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListEventBusesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListEventBusesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listEventBusesResponse_eventBuses :: Lens.Lens' ListEventBusesResponse (Prelude.Maybe [EventBus])
listEventBusesResponse_eventBuses :: (Maybe [EventBus] -> f (Maybe [EventBus]))
-> ListEventBusesResponse -> f ListEventBusesResponse
listEventBusesResponse_eventBuses = (ListEventBusesResponse -> Maybe [EventBus])
-> (ListEventBusesResponse
-> Maybe [EventBus] -> ListEventBusesResponse)
-> Lens
ListEventBusesResponse
ListEventBusesResponse
(Maybe [EventBus])
(Maybe [EventBus])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEventBusesResponse' {Maybe [EventBus]
eventBuses :: Maybe [EventBus]
$sel:eventBuses:ListEventBusesResponse' :: ListEventBusesResponse -> Maybe [EventBus]
eventBuses} -> Maybe [EventBus]
eventBuses) (\s :: ListEventBusesResponse
s@ListEventBusesResponse' {} Maybe [EventBus]
a -> ListEventBusesResponse
s {$sel:eventBuses:ListEventBusesResponse' :: Maybe [EventBus]
eventBuses = Maybe [EventBus]
a} :: ListEventBusesResponse) ((Maybe [EventBus] -> f (Maybe [EventBus]))
-> ListEventBusesResponse -> f ListEventBusesResponse)
-> ((Maybe [EventBus] -> f (Maybe [EventBus]))
-> Maybe [EventBus] -> f (Maybe [EventBus]))
-> (Maybe [EventBus] -> f (Maybe [EventBus]))
-> ListEventBusesResponse
-> f ListEventBusesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [EventBus] [EventBus] [EventBus] [EventBus]
-> Iso
(Maybe [EventBus])
(Maybe [EventBus])
(Maybe [EventBus])
(Maybe [EventBus])
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 [EventBus] [EventBus] [EventBus] [EventBus]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listEventBusesResponse_nextToken :: Lens.Lens' ListEventBusesResponse (Prelude.Maybe Prelude.Text)
listEventBusesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListEventBusesResponse -> f ListEventBusesResponse
listEventBusesResponse_nextToken = (ListEventBusesResponse -> Maybe Text)
-> (ListEventBusesResponse -> Maybe Text -> ListEventBusesResponse)
-> Lens
ListEventBusesResponse
ListEventBusesResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEventBusesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListEventBusesResponse' :: ListEventBusesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListEventBusesResponse
s@ListEventBusesResponse' {} Maybe Text
a -> ListEventBusesResponse
s {$sel:nextToken:ListEventBusesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListEventBusesResponse)
listEventBusesResponse_httpStatus :: Lens.Lens' ListEventBusesResponse Prelude.Int
listEventBusesResponse_httpStatus :: (Int -> f Int)
-> ListEventBusesResponse -> f ListEventBusesResponse
listEventBusesResponse_httpStatus = (ListEventBusesResponse -> Int)
-> (ListEventBusesResponse -> Int -> ListEventBusesResponse)
-> Lens ListEventBusesResponse ListEventBusesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEventBusesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListEventBusesResponse' :: ListEventBusesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListEventBusesResponse
s@ListEventBusesResponse' {} Int
a -> ListEventBusesResponse
s {$sel:httpStatus:ListEventBusesResponse' :: Int
httpStatus = Int
a} :: ListEventBusesResponse)
instance Prelude.NFData ListEventBusesResponse