{-# 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.StepFunctions.ListActivities
(
ListActivities (..),
newListActivities,
listActivities_nextToken,
listActivities_maxResults,
ListActivitiesResponse (..),
newListActivitiesResponse,
listActivitiesResponse_nextToken,
listActivitiesResponse_httpStatus,
listActivitiesResponse_activities,
)
where
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
import Amazonka.StepFunctions.Types
data ListActivities = ListActivities'
{
ListActivities -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListActivities -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (ListActivities -> ListActivities -> Bool
(ListActivities -> ListActivities -> Bool)
-> (ListActivities -> ListActivities -> Bool) -> Eq ListActivities
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListActivities -> ListActivities -> Bool
$c/= :: ListActivities -> ListActivities -> Bool
== :: ListActivities -> ListActivities -> Bool
$c== :: ListActivities -> ListActivities -> Bool
Prelude.Eq, ReadPrec [ListActivities]
ReadPrec ListActivities
Int -> ReadS ListActivities
ReadS [ListActivities]
(Int -> ReadS ListActivities)
-> ReadS [ListActivities]
-> ReadPrec ListActivities
-> ReadPrec [ListActivities]
-> Read ListActivities
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListActivities]
$creadListPrec :: ReadPrec [ListActivities]
readPrec :: ReadPrec ListActivities
$creadPrec :: ReadPrec ListActivities
readList :: ReadS [ListActivities]
$creadList :: ReadS [ListActivities]
readsPrec :: Int -> ReadS ListActivities
$creadsPrec :: Int -> ReadS ListActivities
Prelude.Read, Int -> ListActivities -> ShowS
[ListActivities] -> ShowS
ListActivities -> String
(Int -> ListActivities -> ShowS)
-> (ListActivities -> String)
-> ([ListActivities] -> ShowS)
-> Show ListActivities
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListActivities] -> ShowS
$cshowList :: [ListActivities] -> ShowS
show :: ListActivities -> String
$cshow :: ListActivities -> String
showsPrec :: Int -> ListActivities -> ShowS
$cshowsPrec :: Int -> ListActivities -> ShowS
Prelude.Show, (forall x. ListActivities -> Rep ListActivities x)
-> (forall x. Rep ListActivities x -> ListActivities)
-> Generic ListActivities
forall x. Rep ListActivities x -> ListActivities
forall x. ListActivities -> Rep ListActivities x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListActivities x -> ListActivities
$cfrom :: forall x. ListActivities -> Rep ListActivities x
Prelude.Generic)
newListActivities ::
ListActivities
newListActivities :: ListActivities
newListActivities =
ListActivities' :: Maybe Text -> Maybe Natural -> ListActivities
ListActivities'
{ $sel:nextToken:ListActivities' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListActivities' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listActivities_nextToken :: Lens.Lens' ListActivities (Prelude.Maybe Prelude.Text)
listActivities_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListActivities -> f ListActivities
listActivities_nextToken = (ListActivities -> Maybe Text)
-> (ListActivities -> Maybe Text -> ListActivities)
-> Lens ListActivities ListActivities (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListActivities' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListActivities' :: ListActivities -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListActivities
s@ListActivities' {} Maybe Text
a -> ListActivities
s {$sel:nextToken:ListActivities' :: Maybe Text
nextToken = Maybe Text
a} :: ListActivities)
listActivities_maxResults :: Lens.Lens' ListActivities (Prelude.Maybe Prelude.Natural)
listActivities_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListActivities -> f ListActivities
listActivities_maxResults = (ListActivities -> Maybe Natural)
-> (ListActivities -> Maybe Natural -> ListActivities)
-> Lens
ListActivities ListActivities (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListActivities' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListActivities' :: ListActivities -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListActivities
s@ListActivities' {} Maybe Natural
a -> ListActivities
s {$sel:maxResults:ListActivities' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListActivities)
instance Core.AWSPager ListActivities where
page :: ListActivities
-> AWSResponse ListActivities -> Maybe ListActivities
page ListActivities
rq AWSResponse ListActivities
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListActivities
ListActivitiesResponse
rs
ListActivitiesResponse
-> Getting (First Text) ListActivitiesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListActivitiesResponse
-> Const (First Text) ListActivitiesResponse
Lens' ListActivitiesResponse (Maybe Text)
listActivitiesResponse_nextToken
((Maybe Text -> Const (First Text) (Maybe Text))
-> ListActivitiesResponse
-> Const (First Text) ListActivitiesResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListActivitiesResponse 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 ListActivities
forall a. Maybe a
Prelude.Nothing
| [ActivityListItem] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
(AWSResponse ListActivities
ListActivitiesResponse
rs ListActivitiesResponse
-> Getting
[ActivityListItem] ListActivitiesResponse [ActivityListItem]
-> [ActivityListItem]
forall s a. s -> Getting a s a -> a
Lens.^. Getting
[ActivityListItem] ListActivitiesResponse [ActivityListItem]
Lens' ListActivitiesResponse [ActivityListItem]
listActivitiesResponse_activities) =
Maybe ListActivities
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
ListActivities -> Maybe ListActivities
forall a. a -> Maybe a
Prelude.Just (ListActivities -> Maybe ListActivities)
-> ListActivities -> Maybe ListActivities
forall a b. (a -> b) -> a -> b
Prelude.$
ListActivities
rq
ListActivities
-> (ListActivities -> ListActivities) -> ListActivities
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListActivities -> Identity ListActivities
Lens ListActivities ListActivities (Maybe Text) (Maybe Text)
listActivities_nextToken
((Maybe Text -> Identity (Maybe Text))
-> ListActivities -> Identity ListActivities)
-> Maybe Text -> ListActivities -> ListActivities
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListActivities
ListActivitiesResponse
rs
ListActivitiesResponse
-> Getting (First Text) ListActivitiesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListActivitiesResponse
-> Const (First Text) ListActivitiesResponse
Lens' ListActivitiesResponse (Maybe Text)
listActivitiesResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListActivitiesResponse
-> Const (First Text) ListActivitiesResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListActivitiesResponse 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 ListActivities where
type
AWSResponse ListActivities =
ListActivitiesResponse
request :: ListActivities -> Request ListActivities
request = Service -> ListActivities -> Request ListActivities
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListActivities
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListActivities)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListActivities))
-> Logger
-> Service
-> Proxy ListActivities
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListActivities)))
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 -> [ActivityListItem] -> ListActivitiesResponse
ListActivitiesResponse'
(Maybe Text -> Int -> [ActivityListItem] -> ListActivitiesResponse)
-> Either String (Maybe Text)
-> Either
String (Int -> [ActivityListItem] -> ListActivitiesResponse)
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 -> [ActivityListItem] -> ListActivitiesResponse)
-> Either String Int
-> Either String ([ActivityListItem] -> ListActivitiesResponse)
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 ([ActivityListItem] -> ListActivitiesResponse)
-> Either String [ActivityListItem]
-> Either String ListActivitiesResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [ActivityListItem])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"activities" Either String (Maybe [ActivityListItem])
-> [ActivityListItem] -> Either String [ActivityListItem]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [ActivityListItem]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListActivities
instance Prelude.NFData ListActivities
instance Core.ToHeaders ListActivities where
toHeaders :: ListActivities -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListActivities -> 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
"AWSStepFunctions.ListActivities" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON ListActivities where
toJSON :: ListActivities -> Value
toJSON ListActivities' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListActivities' :: ListActivities -> Maybe Natural
$sel:nextToken:ListActivities' :: ListActivities -> 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
]
)
instance Core.ToPath ListActivities where
toPath :: ListActivities -> ByteString
toPath = ByteString -> ListActivities -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ListActivities where
toQuery :: ListActivities -> QueryString
toQuery = QueryString -> ListActivities -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListActivitiesResponse = ListActivitiesResponse'
{
ListActivitiesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListActivitiesResponse -> Int
httpStatus :: Prelude.Int,
ListActivitiesResponse -> [ActivityListItem]
activities :: [ActivityListItem]
}
deriving (ListActivitiesResponse -> ListActivitiesResponse -> Bool
(ListActivitiesResponse -> ListActivitiesResponse -> Bool)
-> (ListActivitiesResponse -> ListActivitiesResponse -> Bool)
-> Eq ListActivitiesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListActivitiesResponse -> ListActivitiesResponse -> Bool
$c/= :: ListActivitiesResponse -> ListActivitiesResponse -> Bool
== :: ListActivitiesResponse -> ListActivitiesResponse -> Bool
$c== :: ListActivitiesResponse -> ListActivitiesResponse -> Bool
Prelude.Eq, ReadPrec [ListActivitiesResponse]
ReadPrec ListActivitiesResponse
Int -> ReadS ListActivitiesResponse
ReadS [ListActivitiesResponse]
(Int -> ReadS ListActivitiesResponse)
-> ReadS [ListActivitiesResponse]
-> ReadPrec ListActivitiesResponse
-> ReadPrec [ListActivitiesResponse]
-> Read ListActivitiesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListActivitiesResponse]
$creadListPrec :: ReadPrec [ListActivitiesResponse]
readPrec :: ReadPrec ListActivitiesResponse
$creadPrec :: ReadPrec ListActivitiesResponse
readList :: ReadS [ListActivitiesResponse]
$creadList :: ReadS [ListActivitiesResponse]
readsPrec :: Int -> ReadS ListActivitiesResponse
$creadsPrec :: Int -> ReadS ListActivitiesResponse
Prelude.Read, Int -> ListActivitiesResponse -> ShowS
[ListActivitiesResponse] -> ShowS
ListActivitiesResponse -> String
(Int -> ListActivitiesResponse -> ShowS)
-> (ListActivitiesResponse -> String)
-> ([ListActivitiesResponse] -> ShowS)
-> Show ListActivitiesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListActivitiesResponse] -> ShowS
$cshowList :: [ListActivitiesResponse] -> ShowS
show :: ListActivitiesResponse -> String
$cshow :: ListActivitiesResponse -> String
showsPrec :: Int -> ListActivitiesResponse -> ShowS
$cshowsPrec :: Int -> ListActivitiesResponse -> ShowS
Prelude.Show, (forall x. ListActivitiesResponse -> Rep ListActivitiesResponse x)
-> (forall x.
Rep ListActivitiesResponse x -> ListActivitiesResponse)
-> Generic ListActivitiesResponse
forall x. Rep ListActivitiesResponse x -> ListActivitiesResponse
forall x. ListActivitiesResponse -> Rep ListActivitiesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListActivitiesResponse x -> ListActivitiesResponse
$cfrom :: forall x. ListActivitiesResponse -> Rep ListActivitiesResponse x
Prelude.Generic)
newListActivitiesResponse ::
Prelude.Int ->
ListActivitiesResponse
newListActivitiesResponse :: Int -> ListActivitiesResponse
newListActivitiesResponse Int
pHttpStatus_ =
ListActivitiesResponse' :: Maybe Text -> Int -> [ActivityListItem] -> ListActivitiesResponse
ListActivitiesResponse'
{ $sel:nextToken:ListActivitiesResponse' :: Maybe Text
nextToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListActivitiesResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:activities:ListActivitiesResponse' :: [ActivityListItem]
activities = [ActivityListItem]
forall a. Monoid a => a
Prelude.mempty
}
listActivitiesResponse_nextToken :: Lens.Lens' ListActivitiesResponse (Prelude.Maybe Prelude.Text)
listActivitiesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListActivitiesResponse -> f ListActivitiesResponse
listActivitiesResponse_nextToken = (ListActivitiesResponse -> Maybe Text)
-> (ListActivitiesResponse -> Maybe Text -> ListActivitiesResponse)
-> Lens' ListActivitiesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListActivitiesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListActivitiesResponse' :: ListActivitiesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListActivitiesResponse
s@ListActivitiesResponse' {} Maybe Text
a -> ListActivitiesResponse
s {$sel:nextToken:ListActivitiesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListActivitiesResponse)
listActivitiesResponse_httpStatus :: Lens.Lens' ListActivitiesResponse Prelude.Int
listActivitiesResponse_httpStatus :: (Int -> f Int)
-> ListActivitiesResponse -> f ListActivitiesResponse
listActivitiesResponse_httpStatus = (ListActivitiesResponse -> Int)
-> (ListActivitiesResponse -> Int -> ListActivitiesResponse)
-> Lens ListActivitiesResponse ListActivitiesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListActivitiesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListActivitiesResponse' :: ListActivitiesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListActivitiesResponse
s@ListActivitiesResponse' {} Int
a -> ListActivitiesResponse
s {$sel:httpStatus:ListActivitiesResponse' :: Int
httpStatus = Int
a} :: ListActivitiesResponse)
listActivitiesResponse_activities :: Lens.Lens' ListActivitiesResponse [ActivityListItem]
listActivitiesResponse_activities :: ([ActivityListItem] -> f [ActivityListItem])
-> ListActivitiesResponse -> f ListActivitiesResponse
listActivitiesResponse_activities = (ListActivitiesResponse -> [ActivityListItem])
-> (ListActivitiesResponse
-> [ActivityListItem] -> ListActivitiesResponse)
-> Lens' ListActivitiesResponse [ActivityListItem]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListActivitiesResponse' {[ActivityListItem]
activities :: [ActivityListItem]
$sel:activities:ListActivitiesResponse' :: ListActivitiesResponse -> [ActivityListItem]
activities} -> [ActivityListItem]
activities) (\s :: ListActivitiesResponse
s@ListActivitiesResponse' {} [ActivityListItem]
a -> ListActivitiesResponse
s {$sel:activities:ListActivitiesResponse' :: [ActivityListItem]
activities = [ActivityListItem]
a} :: ListActivitiesResponse) (([ActivityListItem] -> f [ActivityListItem])
-> ListActivitiesResponse -> f ListActivitiesResponse)
-> (([ActivityListItem] -> f [ActivityListItem])
-> [ActivityListItem] -> f [ActivityListItem])
-> ([ActivityListItem] -> f [ActivityListItem])
-> ListActivitiesResponse
-> f ListActivitiesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ActivityListItem] -> f [ActivityListItem])
-> [ActivityListItem] -> f [ActivityListItem]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData ListActivitiesResponse