{-# 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.DevOpsGuru.ListEvents
(
ListEvents (..),
newListEvents,
listEvents_nextToken,
listEvents_maxResults,
listEvents_filters,
ListEventsResponse (..),
newListEventsResponse,
listEventsResponse_nextToken,
listEventsResponse_httpStatus,
listEventsResponse_events,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DevOpsGuru.Types
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 ListEvents = ListEvents'
{
ListEvents -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListEvents -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListEvents -> ListEventsFilters
filters :: ListEventsFilters
}
deriving (ListEvents -> ListEvents -> Bool
(ListEvents -> ListEvents -> Bool)
-> (ListEvents -> ListEvents -> Bool) -> Eq ListEvents
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListEvents -> ListEvents -> Bool
$c/= :: ListEvents -> ListEvents -> Bool
== :: ListEvents -> ListEvents -> Bool
$c== :: ListEvents -> ListEvents -> Bool
Prelude.Eq, ReadPrec [ListEvents]
ReadPrec ListEvents
Int -> ReadS ListEvents
ReadS [ListEvents]
(Int -> ReadS ListEvents)
-> ReadS [ListEvents]
-> ReadPrec ListEvents
-> ReadPrec [ListEvents]
-> Read ListEvents
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListEvents]
$creadListPrec :: ReadPrec [ListEvents]
readPrec :: ReadPrec ListEvents
$creadPrec :: ReadPrec ListEvents
readList :: ReadS [ListEvents]
$creadList :: ReadS [ListEvents]
readsPrec :: Int -> ReadS ListEvents
$creadsPrec :: Int -> ReadS ListEvents
Prelude.Read, Int -> ListEvents -> ShowS
[ListEvents] -> ShowS
ListEvents -> String
(Int -> ListEvents -> ShowS)
-> (ListEvents -> String)
-> ([ListEvents] -> ShowS)
-> Show ListEvents
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListEvents] -> ShowS
$cshowList :: [ListEvents] -> ShowS
show :: ListEvents -> String
$cshow :: ListEvents -> String
showsPrec :: Int -> ListEvents -> ShowS
$cshowsPrec :: Int -> ListEvents -> ShowS
Prelude.Show, (forall x. ListEvents -> Rep ListEvents x)
-> (forall x. Rep ListEvents x -> ListEvents) -> Generic ListEvents
forall x. Rep ListEvents x -> ListEvents
forall x. ListEvents -> Rep ListEvents x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListEvents x -> ListEvents
$cfrom :: forall x. ListEvents -> Rep ListEvents x
Prelude.Generic)
newListEvents ::
ListEventsFilters ->
ListEvents
newListEvents :: ListEventsFilters -> ListEvents
newListEvents ListEventsFilters
pFilters_ =
ListEvents' :: Maybe Text -> Maybe Natural -> ListEventsFilters -> ListEvents
ListEvents'
{ $sel:nextToken:ListEvents' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListEvents' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:filters:ListEvents' :: ListEventsFilters
filters = ListEventsFilters
pFilters_
}
listEvents_nextToken :: Lens.Lens' ListEvents (Prelude.Maybe Prelude.Text)
listEvents_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListEvents -> f ListEvents
listEvents_nextToken = (ListEvents -> Maybe Text)
-> (ListEvents -> Maybe Text -> ListEvents)
-> Lens ListEvents ListEvents (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEvents' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListEvents' :: ListEvents -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListEvents
s@ListEvents' {} Maybe Text
a -> ListEvents
s {$sel:nextToken:ListEvents' :: Maybe Text
nextToken = Maybe Text
a} :: ListEvents)
listEvents_maxResults :: Lens.Lens' ListEvents (Prelude.Maybe Prelude.Natural)
listEvents_maxResults :: (Maybe Natural -> f (Maybe Natural)) -> ListEvents -> f ListEvents
listEvents_maxResults = (ListEvents -> Maybe Natural)
-> (ListEvents -> Maybe Natural -> ListEvents)
-> Lens ListEvents ListEvents (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEvents' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListEvents' :: ListEvents -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListEvents
s@ListEvents' {} Maybe Natural
a -> ListEvents
s {$sel:maxResults:ListEvents' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListEvents)
listEvents_filters :: Lens.Lens' ListEvents ListEventsFilters
listEvents_filters :: (ListEventsFilters -> f ListEventsFilters)
-> ListEvents -> f ListEvents
listEvents_filters = (ListEvents -> ListEventsFilters)
-> (ListEvents -> ListEventsFilters -> ListEvents)
-> Lens ListEvents ListEvents ListEventsFilters ListEventsFilters
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEvents' {ListEventsFilters
filters :: ListEventsFilters
$sel:filters:ListEvents' :: ListEvents -> ListEventsFilters
filters} -> ListEventsFilters
filters) (\s :: ListEvents
s@ListEvents' {} ListEventsFilters
a -> ListEvents
s {$sel:filters:ListEvents' :: ListEventsFilters
filters = ListEventsFilters
a} :: ListEvents)
instance Core.AWSPager ListEvents where
page :: ListEvents -> AWSResponse ListEvents -> Maybe ListEvents
page ListEvents
rq AWSResponse ListEvents
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListEvents
ListEventsResponse
rs
ListEventsResponse
-> Getting (First Text) ListEventsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListEventsResponse -> Const (First Text) ListEventsResponse
Lens' ListEventsResponse (Maybe Text)
listEventsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListEventsResponse -> Const (First Text) ListEventsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListEventsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe ListEvents
forall a. Maybe a
Prelude.Nothing
| [Event] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop (AWSResponse ListEvents
ListEventsResponse
rs ListEventsResponse
-> Getting [Event] ListEventsResponse [Event] -> [Event]
forall s a. s -> Getting a s a -> a
Lens.^. Getting [Event] ListEventsResponse [Event]
Lens' ListEventsResponse [Event]
listEventsResponse_events) =
Maybe ListEvents
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
ListEvents -> Maybe ListEvents
forall a. a -> Maybe a
Prelude.Just (ListEvents -> Maybe ListEvents) -> ListEvents -> Maybe ListEvents
forall a b. (a -> b) -> a -> b
Prelude.$
ListEvents
rq
ListEvents -> (ListEvents -> ListEvents) -> ListEvents
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListEvents -> Identity ListEvents
Lens ListEvents ListEvents (Maybe Text) (Maybe Text)
listEvents_nextToken
((Maybe Text -> Identity (Maybe Text))
-> ListEvents -> Identity ListEvents)
-> Maybe Text -> ListEvents -> ListEvents
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListEvents
ListEventsResponse
rs
ListEventsResponse
-> Getting (First Text) ListEventsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListEventsResponse -> Const (First Text) ListEventsResponse
Lens' ListEventsResponse (Maybe Text)
listEventsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListEventsResponse -> Const (First Text) ListEventsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListEventsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListEvents where
type AWSResponse ListEvents = ListEventsResponse
request :: ListEvents -> Request ListEvents
request = Service -> ListEvents -> Request ListEvents
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListEvents
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListEvents)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListEvents))
-> Logger
-> Service
-> Proxy ListEvents
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListEvents)))
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 -> [Event] -> ListEventsResponse
ListEventsResponse'
(Maybe Text -> Int -> [Event] -> ListEventsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> [Event] -> ListEventsResponse)
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 (Int -> [Event] -> ListEventsResponse)
-> Either String Int
-> Either String ([Event] -> ListEventsResponse)
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))
Either String ([Event] -> ListEventsResponse)
-> Either String [Event] -> Either String ListEventsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [Event])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Events" Either String (Maybe [Event]) -> [Event] -> Either String [Event]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Event]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListEvents
instance Prelude.NFData ListEvents
instance Core.ToHeaders ListEvents where
toHeaders :: ListEvents -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListEvents -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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 ListEvents where
toJSON :: ListEvents -> Value
toJSON ListEvents' {Maybe Natural
Maybe Text
ListEventsFilters
filters :: ListEventsFilters
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:filters:ListEvents' :: ListEvents -> ListEventsFilters
$sel:maxResults:ListEvents' :: ListEvents -> Maybe Natural
$sel:nextToken:ListEvents' :: ListEvents -> 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
"MaxResults" 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
maxResults,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Filters" Text -> ListEventsFilters -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ListEventsFilters
filters)
]
)
instance Core.ToPath ListEvents where
toPath :: ListEvents -> ByteString
toPath = ByteString -> ListEvents -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/events"
instance Core.ToQuery ListEvents where
toQuery :: ListEvents -> QueryString
toQuery = QueryString -> ListEvents -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListEventsResponse = ListEventsResponse'
{
ListEventsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListEventsResponse -> Int
httpStatus :: Prelude.Int,
ListEventsResponse -> [Event]
events :: [Event]
}
deriving (ListEventsResponse -> ListEventsResponse -> Bool
(ListEventsResponse -> ListEventsResponse -> Bool)
-> (ListEventsResponse -> ListEventsResponse -> Bool)
-> Eq ListEventsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListEventsResponse -> ListEventsResponse -> Bool
$c/= :: ListEventsResponse -> ListEventsResponse -> Bool
== :: ListEventsResponse -> ListEventsResponse -> Bool
$c== :: ListEventsResponse -> ListEventsResponse -> Bool
Prelude.Eq, ReadPrec [ListEventsResponse]
ReadPrec ListEventsResponse
Int -> ReadS ListEventsResponse
ReadS [ListEventsResponse]
(Int -> ReadS ListEventsResponse)
-> ReadS [ListEventsResponse]
-> ReadPrec ListEventsResponse
-> ReadPrec [ListEventsResponse]
-> Read ListEventsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListEventsResponse]
$creadListPrec :: ReadPrec [ListEventsResponse]
readPrec :: ReadPrec ListEventsResponse
$creadPrec :: ReadPrec ListEventsResponse
readList :: ReadS [ListEventsResponse]
$creadList :: ReadS [ListEventsResponse]
readsPrec :: Int -> ReadS ListEventsResponse
$creadsPrec :: Int -> ReadS ListEventsResponse
Prelude.Read, Int -> ListEventsResponse -> ShowS
[ListEventsResponse] -> ShowS
ListEventsResponse -> String
(Int -> ListEventsResponse -> ShowS)
-> (ListEventsResponse -> String)
-> ([ListEventsResponse] -> ShowS)
-> Show ListEventsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListEventsResponse] -> ShowS
$cshowList :: [ListEventsResponse] -> ShowS
show :: ListEventsResponse -> String
$cshow :: ListEventsResponse -> String
showsPrec :: Int -> ListEventsResponse -> ShowS
$cshowsPrec :: Int -> ListEventsResponse -> ShowS
Prelude.Show, (forall x. ListEventsResponse -> Rep ListEventsResponse x)
-> (forall x. Rep ListEventsResponse x -> ListEventsResponse)
-> Generic ListEventsResponse
forall x. Rep ListEventsResponse x -> ListEventsResponse
forall x. ListEventsResponse -> Rep ListEventsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListEventsResponse x -> ListEventsResponse
$cfrom :: forall x. ListEventsResponse -> Rep ListEventsResponse x
Prelude.Generic)
newListEventsResponse ::
Prelude.Int ->
ListEventsResponse
newListEventsResponse :: Int -> ListEventsResponse
newListEventsResponse Int
pHttpStatus_ =
ListEventsResponse' :: Maybe Text -> Int -> [Event] -> ListEventsResponse
ListEventsResponse'
{ $sel:nextToken:ListEventsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListEventsResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:events:ListEventsResponse' :: [Event]
events = [Event]
forall a. Monoid a => a
Prelude.mempty
}
listEventsResponse_nextToken :: Lens.Lens' ListEventsResponse (Prelude.Maybe Prelude.Text)
listEventsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListEventsResponse -> f ListEventsResponse
listEventsResponse_nextToken = (ListEventsResponse -> Maybe Text)
-> (ListEventsResponse -> Maybe Text -> ListEventsResponse)
-> Lens' ListEventsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEventsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListEventsResponse' :: ListEventsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListEventsResponse
s@ListEventsResponse' {} Maybe Text
a -> ListEventsResponse
s {$sel:nextToken:ListEventsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListEventsResponse)
listEventsResponse_httpStatus :: Lens.Lens' ListEventsResponse Prelude.Int
listEventsResponse_httpStatus :: (Int -> f Int) -> ListEventsResponse -> f ListEventsResponse
listEventsResponse_httpStatus = (ListEventsResponse -> Int)
-> (ListEventsResponse -> Int -> ListEventsResponse)
-> Lens ListEventsResponse ListEventsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEventsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListEventsResponse' :: ListEventsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListEventsResponse
s@ListEventsResponse' {} Int
a -> ListEventsResponse
s {$sel:httpStatus:ListEventsResponse' :: Int
httpStatus = Int
a} :: ListEventsResponse)
listEventsResponse_events :: Lens.Lens' ListEventsResponse [Event]
listEventsResponse_events :: ([Event] -> f [Event])
-> ListEventsResponse -> f ListEventsResponse
listEventsResponse_events = (ListEventsResponse -> [Event])
-> (ListEventsResponse -> [Event] -> ListEventsResponse)
-> Lens' ListEventsResponse [Event]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEventsResponse' {[Event]
events :: [Event]
$sel:events:ListEventsResponse' :: ListEventsResponse -> [Event]
events} -> [Event]
events) (\s :: ListEventsResponse
s@ListEventsResponse' {} [Event]
a -> ListEventsResponse
s {$sel:events:ListEventsResponse' :: [Event]
events = [Event]
a} :: ListEventsResponse) (([Event] -> f [Event])
-> ListEventsResponse -> f ListEventsResponse)
-> (([Event] -> f [Event]) -> [Event] -> f [Event])
-> ([Event] -> f [Event])
-> ListEventsResponse
-> f ListEventsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Event] -> f [Event]) -> [Event] -> f [Event]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData ListEventsResponse