{-# 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.ListEventSources
(
ListEventSources (..),
newListEventSources,
listEventSources_nextToken,
listEventSources_namePrefix,
listEventSources_limit,
ListEventSourcesResponse (..),
newListEventSourcesResponse,
listEventSourcesResponse_nextToken,
listEventSourcesResponse_eventSources,
listEventSourcesResponse_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 ListEventSources = ListEventSources'
{
ListEventSources -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListEventSources -> Maybe Text
namePrefix :: Prelude.Maybe Prelude.Text,
ListEventSources -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural
}
deriving (ListEventSources -> ListEventSources -> Bool
(ListEventSources -> ListEventSources -> Bool)
-> (ListEventSources -> ListEventSources -> Bool)
-> Eq ListEventSources
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListEventSources -> ListEventSources -> Bool
$c/= :: ListEventSources -> ListEventSources -> Bool
== :: ListEventSources -> ListEventSources -> Bool
$c== :: ListEventSources -> ListEventSources -> Bool
Prelude.Eq, ReadPrec [ListEventSources]
ReadPrec ListEventSources
Int -> ReadS ListEventSources
ReadS [ListEventSources]
(Int -> ReadS ListEventSources)
-> ReadS [ListEventSources]
-> ReadPrec ListEventSources
-> ReadPrec [ListEventSources]
-> Read ListEventSources
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListEventSources]
$creadListPrec :: ReadPrec [ListEventSources]
readPrec :: ReadPrec ListEventSources
$creadPrec :: ReadPrec ListEventSources
readList :: ReadS [ListEventSources]
$creadList :: ReadS [ListEventSources]
readsPrec :: Int -> ReadS ListEventSources
$creadsPrec :: Int -> ReadS ListEventSources
Prelude.Read, Int -> ListEventSources -> ShowS
[ListEventSources] -> ShowS
ListEventSources -> String
(Int -> ListEventSources -> ShowS)
-> (ListEventSources -> String)
-> ([ListEventSources] -> ShowS)
-> Show ListEventSources
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListEventSources] -> ShowS
$cshowList :: [ListEventSources] -> ShowS
show :: ListEventSources -> String
$cshow :: ListEventSources -> String
showsPrec :: Int -> ListEventSources -> ShowS
$cshowsPrec :: Int -> ListEventSources -> ShowS
Prelude.Show, (forall x. ListEventSources -> Rep ListEventSources x)
-> (forall x. Rep ListEventSources x -> ListEventSources)
-> Generic ListEventSources
forall x. Rep ListEventSources x -> ListEventSources
forall x. ListEventSources -> Rep ListEventSources x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListEventSources x -> ListEventSources
$cfrom :: forall x. ListEventSources -> Rep ListEventSources x
Prelude.Generic)
newListEventSources ::
ListEventSources
newListEventSources :: ListEventSources
newListEventSources =
ListEventSources' :: Maybe Text -> Maybe Text -> Maybe Natural -> ListEventSources
ListEventSources'
{ $sel:nextToken:ListEventSources' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:namePrefix:ListEventSources' :: Maybe Text
namePrefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:limit:ListEventSources' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listEventSources_nextToken :: Lens.Lens' ListEventSources (Prelude.Maybe Prelude.Text)
listEventSources_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListEventSources -> f ListEventSources
listEventSources_nextToken = (ListEventSources -> Maybe Text)
-> (ListEventSources -> Maybe Text -> ListEventSources)
-> Lens ListEventSources ListEventSources (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEventSources' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListEventSources' :: ListEventSources -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListEventSources
s@ListEventSources' {} Maybe Text
a -> ListEventSources
s {$sel:nextToken:ListEventSources' :: Maybe Text
nextToken = Maybe Text
a} :: ListEventSources)
listEventSources_namePrefix :: Lens.Lens' ListEventSources (Prelude.Maybe Prelude.Text)
listEventSources_namePrefix :: (Maybe Text -> f (Maybe Text))
-> ListEventSources -> f ListEventSources
listEventSources_namePrefix = (ListEventSources -> Maybe Text)
-> (ListEventSources -> Maybe Text -> ListEventSources)
-> Lens ListEventSources ListEventSources (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEventSources' {Maybe Text
namePrefix :: Maybe Text
$sel:namePrefix:ListEventSources' :: ListEventSources -> Maybe Text
namePrefix} -> Maybe Text
namePrefix) (\s :: ListEventSources
s@ListEventSources' {} Maybe Text
a -> ListEventSources
s {$sel:namePrefix:ListEventSources' :: Maybe Text
namePrefix = Maybe Text
a} :: ListEventSources)
listEventSources_limit :: Lens.Lens' ListEventSources (Prelude.Maybe Prelude.Natural)
listEventSources_limit :: (Maybe Natural -> f (Maybe Natural))
-> ListEventSources -> f ListEventSources
listEventSources_limit = (ListEventSources -> Maybe Natural)
-> (ListEventSources -> Maybe Natural -> ListEventSources)
-> Lens
ListEventSources ListEventSources (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEventSources' {Maybe Natural
limit :: Maybe Natural
$sel:limit:ListEventSources' :: ListEventSources -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: ListEventSources
s@ListEventSources' {} Maybe Natural
a -> ListEventSources
s {$sel:limit:ListEventSources' :: Maybe Natural
limit = Maybe Natural
a} :: ListEventSources)
instance Core.AWSRequest ListEventSources where
type
AWSResponse ListEventSources =
ListEventSourcesResponse
request :: ListEventSources -> Request ListEventSources
request = Service -> ListEventSources -> Request ListEventSources
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListEventSources
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListEventSources)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListEventSources))
-> Logger
-> Service
-> Proxy ListEventSources
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListEventSources)))
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
-> Maybe [EventSource] -> Int -> ListEventSourcesResponse
ListEventSourcesResponse'
(Maybe Text
-> Maybe [EventSource] -> Int -> ListEventSourcesResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe [EventSource] -> Int -> ListEventSourcesResponse)
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
"NextToken")
Either
String (Maybe [EventSource] -> Int -> ListEventSourcesResponse)
-> Either String (Maybe [EventSource])
-> Either String (Int -> ListEventSourcesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [EventSource]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"EventSources" Either String (Maybe (Maybe [EventSource]))
-> Maybe [EventSource] -> Either String (Maybe [EventSource])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [EventSource]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> ListEventSourcesResponse)
-> Either String Int -> Either String ListEventSourcesResponse
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 ListEventSources
instance Prelude.NFData ListEventSources
instance Core.ToHeaders ListEventSources where
toHeaders :: ListEventSources -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListEventSources -> 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.ListEventSources" :: 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 ListEventSources where
toJSON :: ListEventSources -> Value
toJSON ListEventSources' {Maybe Natural
Maybe Text
limit :: Maybe Natural
namePrefix :: Maybe Text
nextToken :: Maybe Text
$sel:limit:ListEventSources' :: ListEventSources -> Maybe Natural
$sel:namePrefix:ListEventSources' :: ListEventSources -> Maybe Text
$sel:nextToken:ListEventSources' :: ListEventSources -> 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 ListEventSources where
toPath :: ListEventSources -> ByteString
toPath = ByteString -> ListEventSources -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ListEventSources where
toQuery :: ListEventSources -> QueryString
toQuery = QueryString -> ListEventSources -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListEventSourcesResponse = ListEventSourcesResponse'
{
ListEventSourcesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListEventSourcesResponse -> Maybe [EventSource]
eventSources :: Prelude.Maybe [EventSource],
ListEventSourcesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListEventSourcesResponse -> ListEventSourcesResponse -> Bool
(ListEventSourcesResponse -> ListEventSourcesResponse -> Bool)
-> (ListEventSourcesResponse -> ListEventSourcesResponse -> Bool)
-> Eq ListEventSourcesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListEventSourcesResponse -> ListEventSourcesResponse -> Bool
$c/= :: ListEventSourcesResponse -> ListEventSourcesResponse -> Bool
== :: ListEventSourcesResponse -> ListEventSourcesResponse -> Bool
$c== :: ListEventSourcesResponse -> ListEventSourcesResponse -> Bool
Prelude.Eq, ReadPrec [ListEventSourcesResponse]
ReadPrec ListEventSourcesResponse
Int -> ReadS ListEventSourcesResponse
ReadS [ListEventSourcesResponse]
(Int -> ReadS ListEventSourcesResponse)
-> ReadS [ListEventSourcesResponse]
-> ReadPrec ListEventSourcesResponse
-> ReadPrec [ListEventSourcesResponse]
-> Read ListEventSourcesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListEventSourcesResponse]
$creadListPrec :: ReadPrec [ListEventSourcesResponse]
readPrec :: ReadPrec ListEventSourcesResponse
$creadPrec :: ReadPrec ListEventSourcesResponse
readList :: ReadS [ListEventSourcesResponse]
$creadList :: ReadS [ListEventSourcesResponse]
readsPrec :: Int -> ReadS ListEventSourcesResponse
$creadsPrec :: Int -> ReadS ListEventSourcesResponse
Prelude.Read, Int -> ListEventSourcesResponse -> ShowS
[ListEventSourcesResponse] -> ShowS
ListEventSourcesResponse -> String
(Int -> ListEventSourcesResponse -> ShowS)
-> (ListEventSourcesResponse -> String)
-> ([ListEventSourcesResponse] -> ShowS)
-> Show ListEventSourcesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListEventSourcesResponse] -> ShowS
$cshowList :: [ListEventSourcesResponse] -> ShowS
show :: ListEventSourcesResponse -> String
$cshow :: ListEventSourcesResponse -> String
showsPrec :: Int -> ListEventSourcesResponse -> ShowS
$cshowsPrec :: Int -> ListEventSourcesResponse -> ShowS
Prelude.Show, (forall x.
ListEventSourcesResponse -> Rep ListEventSourcesResponse x)
-> (forall x.
Rep ListEventSourcesResponse x -> ListEventSourcesResponse)
-> Generic ListEventSourcesResponse
forall x.
Rep ListEventSourcesResponse x -> ListEventSourcesResponse
forall x.
ListEventSourcesResponse -> Rep ListEventSourcesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListEventSourcesResponse x -> ListEventSourcesResponse
$cfrom :: forall x.
ListEventSourcesResponse -> Rep ListEventSourcesResponse x
Prelude.Generic)
newListEventSourcesResponse ::
Prelude.Int ->
ListEventSourcesResponse
newListEventSourcesResponse :: Int -> ListEventSourcesResponse
newListEventSourcesResponse Int
pHttpStatus_ =
ListEventSourcesResponse' :: Maybe Text
-> Maybe [EventSource] -> Int -> ListEventSourcesResponse
ListEventSourcesResponse'
{ $sel:nextToken:ListEventSourcesResponse' :: Maybe Text
nextToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:eventSources:ListEventSourcesResponse' :: Maybe [EventSource]
eventSources = Maybe [EventSource]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListEventSourcesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listEventSourcesResponse_nextToken :: Lens.Lens' ListEventSourcesResponse (Prelude.Maybe Prelude.Text)
listEventSourcesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListEventSourcesResponse -> f ListEventSourcesResponse
listEventSourcesResponse_nextToken = (ListEventSourcesResponse -> Maybe Text)
-> (ListEventSourcesResponse
-> Maybe Text -> ListEventSourcesResponse)
-> Lens
ListEventSourcesResponse
ListEventSourcesResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEventSourcesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListEventSourcesResponse' :: ListEventSourcesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListEventSourcesResponse
s@ListEventSourcesResponse' {} Maybe Text
a -> ListEventSourcesResponse
s {$sel:nextToken:ListEventSourcesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListEventSourcesResponse)
listEventSourcesResponse_eventSources :: Lens.Lens' ListEventSourcesResponse (Prelude.Maybe [EventSource])
listEventSourcesResponse_eventSources :: (Maybe [EventSource] -> f (Maybe [EventSource]))
-> ListEventSourcesResponse -> f ListEventSourcesResponse
listEventSourcesResponse_eventSources = (ListEventSourcesResponse -> Maybe [EventSource])
-> (ListEventSourcesResponse
-> Maybe [EventSource] -> ListEventSourcesResponse)
-> Lens
ListEventSourcesResponse
ListEventSourcesResponse
(Maybe [EventSource])
(Maybe [EventSource])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEventSourcesResponse' {Maybe [EventSource]
eventSources :: Maybe [EventSource]
$sel:eventSources:ListEventSourcesResponse' :: ListEventSourcesResponse -> Maybe [EventSource]
eventSources} -> Maybe [EventSource]
eventSources) (\s :: ListEventSourcesResponse
s@ListEventSourcesResponse' {} Maybe [EventSource]
a -> ListEventSourcesResponse
s {$sel:eventSources:ListEventSourcesResponse' :: Maybe [EventSource]
eventSources = Maybe [EventSource]
a} :: ListEventSourcesResponse) ((Maybe [EventSource] -> f (Maybe [EventSource]))
-> ListEventSourcesResponse -> f ListEventSourcesResponse)
-> ((Maybe [EventSource] -> f (Maybe [EventSource]))
-> Maybe [EventSource] -> f (Maybe [EventSource]))
-> (Maybe [EventSource] -> f (Maybe [EventSource]))
-> ListEventSourcesResponse
-> f ListEventSourcesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [EventSource] [EventSource] [EventSource] [EventSource]
-> Iso
(Maybe [EventSource])
(Maybe [EventSource])
(Maybe [EventSource])
(Maybe [EventSource])
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 [EventSource] [EventSource] [EventSource] [EventSource]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listEventSourcesResponse_httpStatus :: Lens.Lens' ListEventSourcesResponse Prelude.Int
listEventSourcesResponse_httpStatus :: (Int -> f Int)
-> ListEventSourcesResponse -> f ListEventSourcesResponse
listEventSourcesResponse_httpStatus = (ListEventSourcesResponse -> Int)
-> (ListEventSourcesResponse -> Int -> ListEventSourcesResponse)
-> Lens ListEventSourcesResponse ListEventSourcesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEventSourcesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListEventSourcesResponse' :: ListEventSourcesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListEventSourcesResponse
s@ListEventSourcesResponse' {} Int
a -> ListEventSourcesResponse
s {$sel:httpStatus:ListEventSourcesResponse' :: Int
httpStatus = Int
a} :: ListEventSourcesResponse)
instance Prelude.NFData ListEventSourcesResponse