{-# 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.MediaConnect.ListFlows
(
ListFlows (..),
newListFlows,
listFlows_nextToken,
listFlows_maxResults,
ListFlowsResponse (..),
newListFlowsResponse,
listFlowsResponse_nextToken,
listFlowsResponse_flows,
listFlowsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConnect.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListFlows = ListFlows'
{
ListFlows -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListFlows -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (ListFlows -> ListFlows -> Bool
(ListFlows -> ListFlows -> Bool)
-> (ListFlows -> ListFlows -> Bool) -> Eq ListFlows
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListFlows -> ListFlows -> Bool
$c/= :: ListFlows -> ListFlows -> Bool
== :: ListFlows -> ListFlows -> Bool
$c== :: ListFlows -> ListFlows -> Bool
Prelude.Eq, ReadPrec [ListFlows]
ReadPrec ListFlows
Int -> ReadS ListFlows
ReadS [ListFlows]
(Int -> ReadS ListFlows)
-> ReadS [ListFlows]
-> ReadPrec ListFlows
-> ReadPrec [ListFlows]
-> Read ListFlows
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListFlows]
$creadListPrec :: ReadPrec [ListFlows]
readPrec :: ReadPrec ListFlows
$creadPrec :: ReadPrec ListFlows
readList :: ReadS [ListFlows]
$creadList :: ReadS [ListFlows]
readsPrec :: Int -> ReadS ListFlows
$creadsPrec :: Int -> ReadS ListFlows
Prelude.Read, Int -> ListFlows -> ShowS
[ListFlows] -> ShowS
ListFlows -> String
(Int -> ListFlows -> ShowS)
-> (ListFlows -> String)
-> ([ListFlows] -> ShowS)
-> Show ListFlows
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListFlows] -> ShowS
$cshowList :: [ListFlows] -> ShowS
show :: ListFlows -> String
$cshow :: ListFlows -> String
showsPrec :: Int -> ListFlows -> ShowS
$cshowsPrec :: Int -> ListFlows -> ShowS
Prelude.Show, (forall x. ListFlows -> Rep ListFlows x)
-> (forall x. Rep ListFlows x -> ListFlows) -> Generic ListFlows
forall x. Rep ListFlows x -> ListFlows
forall x. ListFlows -> Rep ListFlows x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListFlows x -> ListFlows
$cfrom :: forall x. ListFlows -> Rep ListFlows x
Prelude.Generic)
newListFlows ::
ListFlows
newListFlows :: ListFlows
newListFlows =
ListFlows' :: Maybe Text -> Maybe Natural -> ListFlows
ListFlows'
{ $sel:nextToken:ListFlows' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListFlows' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listFlows_nextToken :: Lens.Lens' ListFlows (Prelude.Maybe Prelude.Text)
listFlows_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListFlows -> f ListFlows
listFlows_nextToken = (ListFlows -> Maybe Text)
-> (ListFlows -> Maybe Text -> ListFlows)
-> Lens ListFlows ListFlows (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFlows' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListFlows' :: ListFlows -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListFlows
s@ListFlows' {} Maybe Text
a -> ListFlows
s {$sel:nextToken:ListFlows' :: Maybe Text
nextToken = Maybe Text
a} :: ListFlows)
listFlows_maxResults :: Lens.Lens' ListFlows (Prelude.Maybe Prelude.Natural)
listFlows_maxResults :: (Maybe Natural -> f (Maybe Natural)) -> ListFlows -> f ListFlows
listFlows_maxResults = (ListFlows -> Maybe Natural)
-> (ListFlows -> Maybe Natural -> ListFlows)
-> Lens ListFlows ListFlows (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFlows' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListFlows' :: ListFlows -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListFlows
s@ListFlows' {} Maybe Natural
a -> ListFlows
s {$sel:maxResults:ListFlows' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListFlows)
instance Core.AWSPager ListFlows where
page :: ListFlows -> AWSResponse ListFlows -> Maybe ListFlows
page ListFlows
rq AWSResponse ListFlows
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListFlows
ListFlowsResponse
rs
ListFlowsResponse
-> Getting (First Text) ListFlowsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListFlowsResponse -> Const (First Text) ListFlowsResponse
Lens' ListFlowsResponse (Maybe Text)
listFlowsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListFlowsResponse -> Const (First Text) ListFlowsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListFlowsResponse 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 ListFlows
forall a. Maybe a
Prelude.Nothing
| Maybe [ListedFlow] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListFlows
ListFlowsResponse
rs
ListFlowsResponse
-> Getting (First [ListedFlow]) ListFlowsResponse [ListedFlow]
-> Maybe [ListedFlow]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [ListedFlow]
-> Const (First [ListedFlow]) (Maybe [ListedFlow]))
-> ListFlowsResponse
-> Const (First [ListedFlow]) ListFlowsResponse
Lens' ListFlowsResponse (Maybe [ListedFlow])
listFlowsResponse_flows ((Maybe [ListedFlow]
-> Const (First [ListedFlow]) (Maybe [ListedFlow]))
-> ListFlowsResponse
-> Const (First [ListedFlow]) ListFlowsResponse)
-> (([ListedFlow] -> Const (First [ListedFlow]) [ListedFlow])
-> Maybe [ListedFlow]
-> Const (First [ListedFlow]) (Maybe [ListedFlow]))
-> Getting (First [ListedFlow]) ListFlowsResponse [ListedFlow]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ListedFlow] -> Const (First [ListedFlow]) [ListedFlow])
-> Maybe [ListedFlow]
-> Const (First [ListedFlow]) (Maybe [ListedFlow])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe ListFlows
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
ListFlows -> Maybe ListFlows
forall a. a -> Maybe a
Prelude.Just (ListFlows -> Maybe ListFlows) -> ListFlows -> Maybe ListFlows
forall a b. (a -> b) -> a -> b
Prelude.$
ListFlows
rq
ListFlows -> (ListFlows -> ListFlows) -> ListFlows
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListFlows -> Identity ListFlows
Lens ListFlows ListFlows (Maybe Text) (Maybe Text)
listFlows_nextToken
((Maybe Text -> Identity (Maybe Text))
-> ListFlows -> Identity ListFlows)
-> Maybe Text -> ListFlows -> ListFlows
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListFlows
ListFlowsResponse
rs
ListFlowsResponse
-> Getting (First Text) ListFlowsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListFlowsResponse -> Const (First Text) ListFlowsResponse
Lens' ListFlowsResponse (Maybe Text)
listFlowsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListFlowsResponse -> Const (First Text) ListFlowsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListFlowsResponse 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 ListFlows where
type AWSResponse ListFlows = ListFlowsResponse
request :: ListFlows -> Request ListFlows
request = Service -> ListFlows -> Request ListFlows
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListFlows
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListFlows)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListFlows))
-> Logger
-> Service
-> Proxy ListFlows
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListFlows)))
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 [ListedFlow] -> Int -> ListFlowsResponse
ListFlowsResponse'
(Maybe Text -> Maybe [ListedFlow] -> Int -> ListFlowsResponse)
-> Either String (Maybe Text)
-> Either String (Maybe [ListedFlow] -> Int -> ListFlowsResponse)
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 [ListedFlow] -> Int -> ListFlowsResponse)
-> Either String (Maybe [ListedFlow])
-> Either String (Int -> ListFlowsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [ListedFlow]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"flows" Either String (Maybe (Maybe [ListedFlow]))
-> Maybe [ListedFlow] -> Either String (Maybe [ListedFlow])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ListedFlow]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> ListFlowsResponse)
-> Either String Int -> Either String ListFlowsResponse
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 ListFlows
instance Prelude.NFData ListFlows
instance Core.ToHeaders ListFlows where
toHeaders :: ListFlows -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListFlows -> 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 ListFlows where
toPath :: ListFlows -> ByteString
toPath = ByteString -> ListFlows -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/v1/flows"
instance Core.ToQuery ListFlows where
toQuery :: ListFlows -> QueryString
toQuery ListFlows' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListFlows' :: ListFlows -> Maybe Natural
$sel:nextToken:ListFlows' :: ListFlows -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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 ListFlowsResponse = ListFlowsResponse'
{
ListFlowsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListFlowsResponse -> Maybe [ListedFlow]
flows :: Prelude.Maybe [ListedFlow],
ListFlowsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListFlowsResponse -> ListFlowsResponse -> Bool
(ListFlowsResponse -> ListFlowsResponse -> Bool)
-> (ListFlowsResponse -> ListFlowsResponse -> Bool)
-> Eq ListFlowsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListFlowsResponse -> ListFlowsResponse -> Bool
$c/= :: ListFlowsResponse -> ListFlowsResponse -> Bool
== :: ListFlowsResponse -> ListFlowsResponse -> Bool
$c== :: ListFlowsResponse -> ListFlowsResponse -> Bool
Prelude.Eq, ReadPrec [ListFlowsResponse]
ReadPrec ListFlowsResponse
Int -> ReadS ListFlowsResponse
ReadS [ListFlowsResponse]
(Int -> ReadS ListFlowsResponse)
-> ReadS [ListFlowsResponse]
-> ReadPrec ListFlowsResponse
-> ReadPrec [ListFlowsResponse]
-> Read ListFlowsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListFlowsResponse]
$creadListPrec :: ReadPrec [ListFlowsResponse]
readPrec :: ReadPrec ListFlowsResponse
$creadPrec :: ReadPrec ListFlowsResponse
readList :: ReadS [ListFlowsResponse]
$creadList :: ReadS [ListFlowsResponse]
readsPrec :: Int -> ReadS ListFlowsResponse
$creadsPrec :: Int -> ReadS ListFlowsResponse
Prelude.Read, Int -> ListFlowsResponse -> ShowS
[ListFlowsResponse] -> ShowS
ListFlowsResponse -> String
(Int -> ListFlowsResponse -> ShowS)
-> (ListFlowsResponse -> String)
-> ([ListFlowsResponse] -> ShowS)
-> Show ListFlowsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListFlowsResponse] -> ShowS
$cshowList :: [ListFlowsResponse] -> ShowS
show :: ListFlowsResponse -> String
$cshow :: ListFlowsResponse -> String
showsPrec :: Int -> ListFlowsResponse -> ShowS
$cshowsPrec :: Int -> ListFlowsResponse -> ShowS
Prelude.Show, (forall x. ListFlowsResponse -> Rep ListFlowsResponse x)
-> (forall x. Rep ListFlowsResponse x -> ListFlowsResponse)
-> Generic ListFlowsResponse
forall x. Rep ListFlowsResponse x -> ListFlowsResponse
forall x. ListFlowsResponse -> Rep ListFlowsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListFlowsResponse x -> ListFlowsResponse
$cfrom :: forall x. ListFlowsResponse -> Rep ListFlowsResponse x
Prelude.Generic)
newListFlowsResponse ::
Prelude.Int ->
ListFlowsResponse
newListFlowsResponse :: Int -> ListFlowsResponse
newListFlowsResponse Int
pHttpStatus_ =
ListFlowsResponse' :: Maybe Text -> Maybe [ListedFlow] -> Int -> ListFlowsResponse
ListFlowsResponse'
{ $sel:nextToken:ListFlowsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:flows:ListFlowsResponse' :: Maybe [ListedFlow]
flows = Maybe [ListedFlow]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListFlowsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listFlowsResponse_nextToken :: Lens.Lens' ListFlowsResponse (Prelude.Maybe Prelude.Text)
listFlowsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListFlowsResponse -> f ListFlowsResponse
listFlowsResponse_nextToken = (ListFlowsResponse -> Maybe Text)
-> (ListFlowsResponse -> Maybe Text -> ListFlowsResponse)
-> Lens' ListFlowsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFlowsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListFlowsResponse' :: ListFlowsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListFlowsResponse
s@ListFlowsResponse' {} Maybe Text
a -> ListFlowsResponse
s {$sel:nextToken:ListFlowsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListFlowsResponse)
listFlowsResponse_flows :: Lens.Lens' ListFlowsResponse (Prelude.Maybe [ListedFlow])
listFlowsResponse_flows :: (Maybe [ListedFlow] -> f (Maybe [ListedFlow]))
-> ListFlowsResponse -> f ListFlowsResponse
listFlowsResponse_flows = (ListFlowsResponse -> Maybe [ListedFlow])
-> (ListFlowsResponse -> Maybe [ListedFlow] -> ListFlowsResponse)
-> Lens' ListFlowsResponse (Maybe [ListedFlow])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFlowsResponse' {Maybe [ListedFlow]
flows :: Maybe [ListedFlow]
$sel:flows:ListFlowsResponse' :: ListFlowsResponse -> Maybe [ListedFlow]
flows} -> Maybe [ListedFlow]
flows) (\s :: ListFlowsResponse
s@ListFlowsResponse' {} Maybe [ListedFlow]
a -> ListFlowsResponse
s {$sel:flows:ListFlowsResponse' :: Maybe [ListedFlow]
flows = Maybe [ListedFlow]
a} :: ListFlowsResponse) ((Maybe [ListedFlow] -> f (Maybe [ListedFlow]))
-> ListFlowsResponse -> f ListFlowsResponse)
-> ((Maybe [ListedFlow] -> f (Maybe [ListedFlow]))
-> Maybe [ListedFlow] -> f (Maybe [ListedFlow]))
-> (Maybe [ListedFlow] -> f (Maybe [ListedFlow]))
-> ListFlowsResponse
-> f ListFlowsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [ListedFlow] [ListedFlow] [ListedFlow] [ListedFlow]
-> Iso
(Maybe [ListedFlow])
(Maybe [ListedFlow])
(Maybe [ListedFlow])
(Maybe [ListedFlow])
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 [ListedFlow] [ListedFlow] [ListedFlow] [ListedFlow]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listFlowsResponse_httpStatus :: Lens.Lens' ListFlowsResponse Prelude.Int
listFlowsResponse_httpStatus :: (Int -> f Int) -> ListFlowsResponse -> f ListFlowsResponse
listFlowsResponse_httpStatus = (ListFlowsResponse -> Int)
-> (ListFlowsResponse -> Int -> ListFlowsResponse)
-> Lens ListFlowsResponse ListFlowsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFlowsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListFlowsResponse' :: ListFlowsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListFlowsResponse
s@ListFlowsResponse' {} Int
a -> ListFlowsResponse
s {$sel:httpStatus:ListFlowsResponse' :: Int
httpStatus = Int
a} :: ListFlowsResponse)
instance Prelude.NFData ListFlowsResponse