{-# 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.DataBrew.ListSchedules
(
ListSchedules (..),
newListSchedules,
listSchedules_jobName,
listSchedules_nextToken,
listSchedules_maxResults,
ListSchedulesResponse (..),
newListSchedulesResponse,
listSchedulesResponse_nextToken,
listSchedulesResponse_httpStatus,
listSchedulesResponse_schedules,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DataBrew.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 ListSchedules = ListSchedules'
{
ListSchedules -> Maybe Text
jobName :: Prelude.Maybe Prelude.Text,
ListSchedules -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListSchedules -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (ListSchedules -> ListSchedules -> Bool
(ListSchedules -> ListSchedules -> Bool)
-> (ListSchedules -> ListSchedules -> Bool) -> Eq ListSchedules
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSchedules -> ListSchedules -> Bool
$c/= :: ListSchedules -> ListSchedules -> Bool
== :: ListSchedules -> ListSchedules -> Bool
$c== :: ListSchedules -> ListSchedules -> Bool
Prelude.Eq, ReadPrec [ListSchedules]
ReadPrec ListSchedules
Int -> ReadS ListSchedules
ReadS [ListSchedules]
(Int -> ReadS ListSchedules)
-> ReadS [ListSchedules]
-> ReadPrec ListSchedules
-> ReadPrec [ListSchedules]
-> Read ListSchedules
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSchedules]
$creadListPrec :: ReadPrec [ListSchedules]
readPrec :: ReadPrec ListSchedules
$creadPrec :: ReadPrec ListSchedules
readList :: ReadS [ListSchedules]
$creadList :: ReadS [ListSchedules]
readsPrec :: Int -> ReadS ListSchedules
$creadsPrec :: Int -> ReadS ListSchedules
Prelude.Read, Int -> ListSchedules -> ShowS
[ListSchedules] -> ShowS
ListSchedules -> String
(Int -> ListSchedules -> ShowS)
-> (ListSchedules -> String)
-> ([ListSchedules] -> ShowS)
-> Show ListSchedules
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSchedules] -> ShowS
$cshowList :: [ListSchedules] -> ShowS
show :: ListSchedules -> String
$cshow :: ListSchedules -> String
showsPrec :: Int -> ListSchedules -> ShowS
$cshowsPrec :: Int -> ListSchedules -> ShowS
Prelude.Show, (forall x. ListSchedules -> Rep ListSchedules x)
-> (forall x. Rep ListSchedules x -> ListSchedules)
-> Generic ListSchedules
forall x. Rep ListSchedules x -> ListSchedules
forall x. ListSchedules -> Rep ListSchedules x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListSchedules x -> ListSchedules
$cfrom :: forall x. ListSchedules -> Rep ListSchedules x
Prelude.Generic)
newListSchedules ::
ListSchedules
newListSchedules :: ListSchedules
newListSchedules =
ListSchedules' :: Maybe Text -> Maybe Text -> Maybe Natural -> ListSchedules
ListSchedules'
{ $sel:jobName:ListSchedules' :: Maybe Text
jobName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListSchedules' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListSchedules' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listSchedules_jobName :: Lens.Lens' ListSchedules (Prelude.Maybe Prelude.Text)
listSchedules_jobName :: (Maybe Text -> f (Maybe Text)) -> ListSchedules -> f ListSchedules
listSchedules_jobName = (ListSchedules -> Maybe Text)
-> (ListSchedules -> Maybe Text -> ListSchedules)
-> Lens ListSchedules ListSchedules (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSchedules' {Maybe Text
jobName :: Maybe Text
$sel:jobName:ListSchedules' :: ListSchedules -> Maybe Text
jobName} -> Maybe Text
jobName) (\s :: ListSchedules
s@ListSchedules' {} Maybe Text
a -> ListSchedules
s {$sel:jobName:ListSchedules' :: Maybe Text
jobName = Maybe Text
a} :: ListSchedules)
listSchedules_nextToken :: Lens.Lens' ListSchedules (Prelude.Maybe Prelude.Text)
listSchedules_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListSchedules -> f ListSchedules
listSchedules_nextToken = (ListSchedules -> Maybe Text)
-> (ListSchedules -> Maybe Text -> ListSchedules)
-> Lens ListSchedules ListSchedules (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSchedules' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSchedules' :: ListSchedules -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSchedules
s@ListSchedules' {} Maybe Text
a -> ListSchedules
s {$sel:nextToken:ListSchedules' :: Maybe Text
nextToken = Maybe Text
a} :: ListSchedules)
listSchedules_maxResults :: Lens.Lens' ListSchedules (Prelude.Maybe Prelude.Natural)
listSchedules_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListSchedules -> f ListSchedules
listSchedules_maxResults = (ListSchedules -> Maybe Natural)
-> (ListSchedules -> Maybe Natural -> ListSchedules)
-> Lens ListSchedules ListSchedules (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSchedules' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListSchedules' :: ListSchedules -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListSchedules
s@ListSchedules' {} Maybe Natural
a -> ListSchedules
s {$sel:maxResults:ListSchedules' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListSchedules)
instance Core.AWSPager ListSchedules where
page :: ListSchedules -> AWSResponse ListSchedules -> Maybe ListSchedules
page ListSchedules
rq AWSResponse ListSchedules
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListSchedules
ListSchedulesResponse
rs
ListSchedulesResponse
-> Getting (First Text) ListSchedulesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListSchedulesResponse
-> Const (First Text) ListSchedulesResponse
Lens' ListSchedulesResponse (Maybe Text)
listSchedulesResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListSchedulesResponse
-> Const (First Text) ListSchedulesResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListSchedulesResponse 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 ListSchedules
forall a. Maybe a
Prelude.Nothing
| [Schedule] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
(AWSResponse ListSchedules
ListSchedulesResponse
rs ListSchedulesResponse
-> Getting [Schedule] ListSchedulesResponse [Schedule]
-> [Schedule]
forall s a. s -> Getting a s a -> a
Lens.^. Getting [Schedule] ListSchedulesResponse [Schedule]
Lens' ListSchedulesResponse [Schedule]
listSchedulesResponse_schedules) =
Maybe ListSchedules
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
ListSchedules -> Maybe ListSchedules
forall a. a -> Maybe a
Prelude.Just (ListSchedules -> Maybe ListSchedules)
-> ListSchedules -> Maybe ListSchedules
forall a b. (a -> b) -> a -> b
Prelude.$
ListSchedules
rq
ListSchedules -> (ListSchedules -> ListSchedules) -> ListSchedules
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListSchedules -> Identity ListSchedules
Lens ListSchedules ListSchedules (Maybe Text) (Maybe Text)
listSchedules_nextToken
((Maybe Text -> Identity (Maybe Text))
-> ListSchedules -> Identity ListSchedules)
-> Maybe Text -> ListSchedules -> ListSchedules
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListSchedules
ListSchedulesResponse
rs
ListSchedulesResponse
-> Getting (First Text) ListSchedulesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListSchedulesResponse
-> Const (First Text) ListSchedulesResponse
Lens' ListSchedulesResponse (Maybe Text)
listSchedulesResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListSchedulesResponse
-> Const (First Text) ListSchedulesResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListSchedulesResponse 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 ListSchedules where
type
AWSResponse ListSchedules =
ListSchedulesResponse
request :: ListSchedules -> Request ListSchedules
request = Service -> ListSchedules -> Request ListSchedules
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListSchedules
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListSchedules)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListSchedules))
-> Logger
-> Service
-> Proxy ListSchedules
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListSchedules)))
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 -> [Schedule] -> ListSchedulesResponse
ListSchedulesResponse'
(Maybe Text -> Int -> [Schedule] -> ListSchedulesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> [Schedule] -> ListSchedulesResponse)
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 -> [Schedule] -> ListSchedulesResponse)
-> Either String Int
-> Either String ([Schedule] -> ListSchedulesResponse)
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 ([Schedule] -> ListSchedulesResponse)
-> Either String [Schedule] -> Either String ListSchedulesResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [Schedule])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Schedules" Either String (Maybe [Schedule])
-> [Schedule] -> Either String [Schedule]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Schedule]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListSchedules
instance Prelude.NFData ListSchedules
instance Core.ToHeaders ListSchedules where
toHeaders :: ListSchedules -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListSchedules -> 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.ToPath ListSchedules where
toPath :: ListSchedules -> ByteString
toPath = ByteString -> ListSchedules -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/schedules"
instance Core.ToQuery ListSchedules where
toQuery :: ListSchedules -> QueryString
toQuery ListSchedules' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
jobName :: Maybe Text
$sel:maxResults:ListSchedules' :: ListSchedules -> Maybe Natural
$sel:nextToken:ListSchedules' :: ListSchedules -> Maybe Text
$sel:jobName:ListSchedules' :: ListSchedules -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"jobName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
jobName,
ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
]
data ListSchedulesResponse = ListSchedulesResponse'
{
ListSchedulesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListSchedulesResponse -> Int
httpStatus :: Prelude.Int,
ListSchedulesResponse -> [Schedule]
schedules :: [Schedule]
}
deriving (ListSchedulesResponse -> ListSchedulesResponse -> Bool
(ListSchedulesResponse -> ListSchedulesResponse -> Bool)
-> (ListSchedulesResponse -> ListSchedulesResponse -> Bool)
-> Eq ListSchedulesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSchedulesResponse -> ListSchedulesResponse -> Bool
$c/= :: ListSchedulesResponse -> ListSchedulesResponse -> Bool
== :: ListSchedulesResponse -> ListSchedulesResponse -> Bool
$c== :: ListSchedulesResponse -> ListSchedulesResponse -> Bool
Prelude.Eq, ReadPrec [ListSchedulesResponse]
ReadPrec ListSchedulesResponse
Int -> ReadS ListSchedulesResponse
ReadS [ListSchedulesResponse]
(Int -> ReadS ListSchedulesResponse)
-> ReadS [ListSchedulesResponse]
-> ReadPrec ListSchedulesResponse
-> ReadPrec [ListSchedulesResponse]
-> Read ListSchedulesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSchedulesResponse]
$creadListPrec :: ReadPrec [ListSchedulesResponse]
readPrec :: ReadPrec ListSchedulesResponse
$creadPrec :: ReadPrec ListSchedulesResponse
readList :: ReadS [ListSchedulesResponse]
$creadList :: ReadS [ListSchedulesResponse]
readsPrec :: Int -> ReadS ListSchedulesResponse
$creadsPrec :: Int -> ReadS ListSchedulesResponse
Prelude.Read, Int -> ListSchedulesResponse -> ShowS
[ListSchedulesResponse] -> ShowS
ListSchedulesResponse -> String
(Int -> ListSchedulesResponse -> ShowS)
-> (ListSchedulesResponse -> String)
-> ([ListSchedulesResponse] -> ShowS)
-> Show ListSchedulesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSchedulesResponse] -> ShowS
$cshowList :: [ListSchedulesResponse] -> ShowS
show :: ListSchedulesResponse -> String
$cshow :: ListSchedulesResponse -> String
showsPrec :: Int -> ListSchedulesResponse -> ShowS
$cshowsPrec :: Int -> ListSchedulesResponse -> ShowS
Prelude.Show, (forall x. ListSchedulesResponse -> Rep ListSchedulesResponse x)
-> (forall x. Rep ListSchedulesResponse x -> ListSchedulesResponse)
-> Generic ListSchedulesResponse
forall x. Rep ListSchedulesResponse x -> ListSchedulesResponse
forall x. ListSchedulesResponse -> Rep ListSchedulesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListSchedulesResponse x -> ListSchedulesResponse
$cfrom :: forall x. ListSchedulesResponse -> Rep ListSchedulesResponse x
Prelude.Generic)
newListSchedulesResponse ::
Prelude.Int ->
ListSchedulesResponse
newListSchedulesResponse :: Int -> ListSchedulesResponse
newListSchedulesResponse Int
pHttpStatus_ =
ListSchedulesResponse' :: Maybe Text -> Int -> [Schedule] -> ListSchedulesResponse
ListSchedulesResponse'
{ $sel:nextToken:ListSchedulesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListSchedulesResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:schedules:ListSchedulesResponse' :: [Schedule]
schedules = [Schedule]
forall a. Monoid a => a
Prelude.mempty
}
listSchedulesResponse_nextToken :: Lens.Lens' ListSchedulesResponse (Prelude.Maybe Prelude.Text)
listSchedulesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListSchedulesResponse -> f ListSchedulesResponse
listSchedulesResponse_nextToken = (ListSchedulesResponse -> Maybe Text)
-> (ListSchedulesResponse -> Maybe Text -> ListSchedulesResponse)
-> Lens' ListSchedulesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSchedulesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSchedulesResponse' :: ListSchedulesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSchedulesResponse
s@ListSchedulesResponse' {} Maybe Text
a -> ListSchedulesResponse
s {$sel:nextToken:ListSchedulesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListSchedulesResponse)
listSchedulesResponse_httpStatus :: Lens.Lens' ListSchedulesResponse Prelude.Int
listSchedulesResponse_httpStatus :: (Int -> f Int) -> ListSchedulesResponse -> f ListSchedulesResponse
listSchedulesResponse_httpStatus = (ListSchedulesResponse -> Int)
-> (ListSchedulesResponse -> Int -> ListSchedulesResponse)
-> Lens ListSchedulesResponse ListSchedulesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSchedulesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListSchedulesResponse' :: ListSchedulesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListSchedulesResponse
s@ListSchedulesResponse' {} Int
a -> ListSchedulesResponse
s {$sel:httpStatus:ListSchedulesResponse' :: Int
httpStatus = Int
a} :: ListSchedulesResponse)
listSchedulesResponse_schedules :: Lens.Lens' ListSchedulesResponse [Schedule]
listSchedulesResponse_schedules :: ([Schedule] -> f [Schedule])
-> ListSchedulesResponse -> f ListSchedulesResponse
listSchedulesResponse_schedules = (ListSchedulesResponse -> [Schedule])
-> (ListSchedulesResponse -> [Schedule] -> ListSchedulesResponse)
-> Lens' ListSchedulesResponse [Schedule]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSchedulesResponse' {[Schedule]
schedules :: [Schedule]
$sel:schedules:ListSchedulesResponse' :: ListSchedulesResponse -> [Schedule]
schedules} -> [Schedule]
schedules) (\s :: ListSchedulesResponse
s@ListSchedulesResponse' {} [Schedule]
a -> ListSchedulesResponse
s {$sel:schedules:ListSchedulesResponse' :: [Schedule]
schedules = [Schedule]
a} :: ListSchedulesResponse) (([Schedule] -> f [Schedule])
-> ListSchedulesResponse -> f ListSchedulesResponse)
-> (([Schedule] -> f [Schedule]) -> [Schedule] -> f [Schedule])
-> ([Schedule] -> f [Schedule])
-> ListSchedulesResponse
-> f ListSchedulesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Schedule] -> f [Schedule]) -> [Schedule] -> f [Schedule]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData ListSchedulesResponse