{-# 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.ElasticTranscoder.ListPresets
(
ListPresets (..),
newListPresets,
listPresets_ascending,
listPresets_pageToken,
ListPresetsResponse (..),
newListPresetsResponse,
listPresetsResponse_nextPageToken,
listPresetsResponse_presets,
listPresetsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.ElasticTranscoder.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 ListPresets = ListPresets'
{
ListPresets -> Maybe Text
ascending :: Prelude.Maybe Prelude.Text,
ListPresets -> Maybe Text
pageToken :: Prelude.Maybe Prelude.Text
}
deriving (ListPresets -> ListPresets -> Bool
(ListPresets -> ListPresets -> Bool)
-> (ListPresets -> ListPresets -> Bool) -> Eq ListPresets
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPresets -> ListPresets -> Bool
$c/= :: ListPresets -> ListPresets -> Bool
== :: ListPresets -> ListPresets -> Bool
$c== :: ListPresets -> ListPresets -> Bool
Prelude.Eq, ReadPrec [ListPresets]
ReadPrec ListPresets
Int -> ReadS ListPresets
ReadS [ListPresets]
(Int -> ReadS ListPresets)
-> ReadS [ListPresets]
-> ReadPrec ListPresets
-> ReadPrec [ListPresets]
-> Read ListPresets
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPresets]
$creadListPrec :: ReadPrec [ListPresets]
readPrec :: ReadPrec ListPresets
$creadPrec :: ReadPrec ListPresets
readList :: ReadS [ListPresets]
$creadList :: ReadS [ListPresets]
readsPrec :: Int -> ReadS ListPresets
$creadsPrec :: Int -> ReadS ListPresets
Prelude.Read, Int -> ListPresets -> ShowS
[ListPresets] -> ShowS
ListPresets -> String
(Int -> ListPresets -> ShowS)
-> (ListPresets -> String)
-> ([ListPresets] -> ShowS)
-> Show ListPresets
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPresets] -> ShowS
$cshowList :: [ListPresets] -> ShowS
show :: ListPresets -> String
$cshow :: ListPresets -> String
showsPrec :: Int -> ListPresets -> ShowS
$cshowsPrec :: Int -> ListPresets -> ShowS
Prelude.Show, (forall x. ListPresets -> Rep ListPresets x)
-> (forall x. Rep ListPresets x -> ListPresets)
-> Generic ListPresets
forall x. Rep ListPresets x -> ListPresets
forall x. ListPresets -> Rep ListPresets x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPresets x -> ListPresets
$cfrom :: forall x. ListPresets -> Rep ListPresets x
Prelude.Generic)
newListPresets ::
ListPresets
newListPresets :: ListPresets
newListPresets =
ListPresets' :: Maybe Text -> Maybe Text -> ListPresets
ListPresets'
{ $sel:ascending:ListPresets' :: Maybe Text
ascending = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:pageToken:ListPresets' :: Maybe Text
pageToken = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
listPresets_ascending :: Lens.Lens' ListPresets (Prelude.Maybe Prelude.Text)
listPresets_ascending :: (Maybe Text -> f (Maybe Text)) -> ListPresets -> f ListPresets
listPresets_ascending = (ListPresets -> Maybe Text)
-> (ListPresets -> Maybe Text -> ListPresets)
-> Lens ListPresets ListPresets (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPresets' {Maybe Text
ascending :: Maybe Text
$sel:ascending:ListPresets' :: ListPresets -> Maybe Text
ascending} -> Maybe Text
ascending) (\s :: ListPresets
s@ListPresets' {} Maybe Text
a -> ListPresets
s {$sel:ascending:ListPresets' :: Maybe Text
ascending = Maybe Text
a} :: ListPresets)
listPresets_pageToken :: Lens.Lens' ListPresets (Prelude.Maybe Prelude.Text)
listPresets_pageToken :: (Maybe Text -> f (Maybe Text)) -> ListPresets -> f ListPresets
listPresets_pageToken = (ListPresets -> Maybe Text)
-> (ListPresets -> Maybe Text -> ListPresets)
-> Lens ListPresets ListPresets (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPresets' {Maybe Text
pageToken :: Maybe Text
$sel:pageToken:ListPresets' :: ListPresets -> Maybe Text
pageToken} -> Maybe Text
pageToken) (\s :: ListPresets
s@ListPresets' {} Maybe Text
a -> ListPresets
s {$sel:pageToken:ListPresets' :: Maybe Text
pageToken = Maybe Text
a} :: ListPresets)
instance Core.AWSPager ListPresets where
page :: ListPresets -> AWSResponse ListPresets -> Maybe ListPresets
page ListPresets
rq AWSResponse ListPresets
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListPresets
ListPresetsResponse
rs
ListPresetsResponse
-> Getting (First Text) ListPresetsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListPresetsResponse -> Const (First Text) ListPresetsResponse
Lens' ListPresetsResponse (Maybe Text)
listPresetsResponse_nextPageToken
((Maybe Text -> Const (First Text) (Maybe Text))
-> ListPresetsResponse -> Const (First Text) ListPresetsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListPresetsResponse 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 ListPresets
forall a. Maybe a
Prelude.Nothing
| Maybe [Preset] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListPresets
ListPresetsResponse
rs
ListPresetsResponse
-> Getting (First [Preset]) ListPresetsResponse [Preset]
-> Maybe [Preset]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Preset] -> Const (First [Preset]) (Maybe [Preset]))
-> ListPresetsResponse
-> Const (First [Preset]) ListPresetsResponse
Lens' ListPresetsResponse (Maybe [Preset])
listPresetsResponse_presets ((Maybe [Preset] -> Const (First [Preset]) (Maybe [Preset]))
-> ListPresetsResponse
-> Const (First [Preset]) ListPresetsResponse)
-> (([Preset] -> Const (First [Preset]) [Preset])
-> Maybe [Preset] -> Const (First [Preset]) (Maybe [Preset]))
-> Getting (First [Preset]) ListPresetsResponse [Preset]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Preset] -> Const (First [Preset]) [Preset])
-> Maybe [Preset] -> Const (First [Preset]) (Maybe [Preset])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe ListPresets
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
ListPresets -> Maybe ListPresets
forall a. a -> Maybe a
Prelude.Just (ListPresets -> Maybe ListPresets)
-> ListPresets -> Maybe ListPresets
forall a b. (a -> b) -> a -> b
Prelude.$
ListPresets
rq
ListPresets -> (ListPresets -> ListPresets) -> ListPresets
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListPresets -> Identity ListPresets
Lens ListPresets ListPresets (Maybe Text) (Maybe Text)
listPresets_pageToken
((Maybe Text -> Identity (Maybe Text))
-> ListPresets -> Identity ListPresets)
-> Maybe Text -> ListPresets -> ListPresets
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListPresets
ListPresetsResponse
rs
ListPresetsResponse
-> Getting (First Text) ListPresetsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListPresetsResponse -> Const (First Text) ListPresetsResponse
Lens' ListPresetsResponse (Maybe Text)
listPresetsResponse_nextPageToken
((Maybe Text -> Const (First Text) (Maybe Text))
-> ListPresetsResponse -> Const (First Text) ListPresetsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListPresetsResponse 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 ListPresets where
type AWSResponse ListPresets = ListPresetsResponse
request :: ListPresets -> Request ListPresets
request = Service -> ListPresets -> Request ListPresets
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListPresets
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListPresets)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListPresets))
-> Logger
-> Service
-> Proxy ListPresets
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListPresets)))
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 [Preset] -> Int -> ListPresetsResponse
ListPresetsResponse'
(Maybe Text -> Maybe [Preset] -> Int -> ListPresetsResponse)
-> Either String (Maybe Text)
-> Either String (Maybe [Preset] -> Int -> ListPresetsResponse)
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
"NextPageToken")
Either String (Maybe [Preset] -> Int -> ListPresetsResponse)
-> Either String (Maybe [Preset])
-> Either String (Int -> ListPresetsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [Preset]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Presets" Either String (Maybe (Maybe [Preset]))
-> Maybe [Preset] -> Either String (Maybe [Preset])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Preset]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> ListPresetsResponse)
-> Either String Int -> Either String ListPresetsResponse
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 ListPresets
instance Prelude.NFData ListPresets
instance Core.ToHeaders ListPresets where
toHeaders :: ListPresets -> ResponseHeaders
toHeaders = ResponseHeaders -> ListPresets -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath ListPresets where
toPath :: ListPresets -> ByteString
toPath = ByteString -> ListPresets -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/2012-09-25/presets"
instance Core.ToQuery ListPresets where
toQuery :: ListPresets -> QueryString
toQuery ListPresets' {Maybe Text
pageToken :: Maybe Text
ascending :: Maybe Text
$sel:pageToken:ListPresets' :: ListPresets -> Maybe Text
$sel:ascending:ListPresets' :: ListPresets -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Ascending" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
ascending,
ByteString
"PageToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
pageToken
]
data ListPresetsResponse = ListPresetsResponse'
{
ListPresetsResponse -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
ListPresetsResponse -> Maybe [Preset]
presets :: Prelude.Maybe [Preset],
ListPresetsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListPresetsResponse -> ListPresetsResponse -> Bool
(ListPresetsResponse -> ListPresetsResponse -> Bool)
-> (ListPresetsResponse -> ListPresetsResponse -> Bool)
-> Eq ListPresetsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPresetsResponse -> ListPresetsResponse -> Bool
$c/= :: ListPresetsResponse -> ListPresetsResponse -> Bool
== :: ListPresetsResponse -> ListPresetsResponse -> Bool
$c== :: ListPresetsResponse -> ListPresetsResponse -> Bool
Prelude.Eq, ReadPrec [ListPresetsResponse]
ReadPrec ListPresetsResponse
Int -> ReadS ListPresetsResponse
ReadS [ListPresetsResponse]
(Int -> ReadS ListPresetsResponse)
-> ReadS [ListPresetsResponse]
-> ReadPrec ListPresetsResponse
-> ReadPrec [ListPresetsResponse]
-> Read ListPresetsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPresetsResponse]
$creadListPrec :: ReadPrec [ListPresetsResponse]
readPrec :: ReadPrec ListPresetsResponse
$creadPrec :: ReadPrec ListPresetsResponse
readList :: ReadS [ListPresetsResponse]
$creadList :: ReadS [ListPresetsResponse]
readsPrec :: Int -> ReadS ListPresetsResponse
$creadsPrec :: Int -> ReadS ListPresetsResponse
Prelude.Read, Int -> ListPresetsResponse -> ShowS
[ListPresetsResponse] -> ShowS
ListPresetsResponse -> String
(Int -> ListPresetsResponse -> ShowS)
-> (ListPresetsResponse -> String)
-> ([ListPresetsResponse] -> ShowS)
-> Show ListPresetsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPresetsResponse] -> ShowS
$cshowList :: [ListPresetsResponse] -> ShowS
show :: ListPresetsResponse -> String
$cshow :: ListPresetsResponse -> String
showsPrec :: Int -> ListPresetsResponse -> ShowS
$cshowsPrec :: Int -> ListPresetsResponse -> ShowS
Prelude.Show, (forall x. ListPresetsResponse -> Rep ListPresetsResponse x)
-> (forall x. Rep ListPresetsResponse x -> ListPresetsResponse)
-> Generic ListPresetsResponse
forall x. Rep ListPresetsResponse x -> ListPresetsResponse
forall x. ListPresetsResponse -> Rep ListPresetsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPresetsResponse x -> ListPresetsResponse
$cfrom :: forall x. ListPresetsResponse -> Rep ListPresetsResponse x
Prelude.Generic)
newListPresetsResponse ::
Prelude.Int ->
ListPresetsResponse
newListPresetsResponse :: Int -> ListPresetsResponse
newListPresetsResponse Int
pHttpStatus_ =
ListPresetsResponse' :: Maybe Text -> Maybe [Preset] -> Int -> ListPresetsResponse
ListPresetsResponse'
{ $sel:nextPageToken:ListPresetsResponse' :: Maybe Text
nextPageToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:presets:ListPresetsResponse' :: Maybe [Preset]
presets = Maybe [Preset]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListPresetsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listPresetsResponse_nextPageToken :: Lens.Lens' ListPresetsResponse (Prelude.Maybe Prelude.Text)
listPresetsResponse_nextPageToken :: (Maybe Text -> f (Maybe Text))
-> ListPresetsResponse -> f ListPresetsResponse
listPresetsResponse_nextPageToken = (ListPresetsResponse -> Maybe Text)
-> (ListPresetsResponse -> Maybe Text -> ListPresetsResponse)
-> Lens' ListPresetsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPresetsResponse' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:ListPresetsResponse' :: ListPresetsResponse -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: ListPresetsResponse
s@ListPresetsResponse' {} Maybe Text
a -> ListPresetsResponse
s {$sel:nextPageToken:ListPresetsResponse' :: Maybe Text
nextPageToken = Maybe Text
a} :: ListPresetsResponse)
listPresetsResponse_presets :: Lens.Lens' ListPresetsResponse (Prelude.Maybe [Preset])
listPresetsResponse_presets :: (Maybe [Preset] -> f (Maybe [Preset]))
-> ListPresetsResponse -> f ListPresetsResponse
listPresetsResponse_presets = (ListPresetsResponse -> Maybe [Preset])
-> (ListPresetsResponse -> Maybe [Preset] -> ListPresetsResponse)
-> Lens' ListPresetsResponse (Maybe [Preset])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPresetsResponse' {Maybe [Preset]
presets :: Maybe [Preset]
$sel:presets:ListPresetsResponse' :: ListPresetsResponse -> Maybe [Preset]
presets} -> Maybe [Preset]
presets) (\s :: ListPresetsResponse
s@ListPresetsResponse' {} Maybe [Preset]
a -> ListPresetsResponse
s {$sel:presets:ListPresetsResponse' :: Maybe [Preset]
presets = Maybe [Preset]
a} :: ListPresetsResponse) ((Maybe [Preset] -> f (Maybe [Preset]))
-> ListPresetsResponse -> f ListPresetsResponse)
-> ((Maybe [Preset] -> f (Maybe [Preset]))
-> Maybe [Preset] -> f (Maybe [Preset]))
-> (Maybe [Preset] -> f (Maybe [Preset]))
-> ListPresetsResponse
-> f ListPresetsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Preset] [Preset] [Preset] [Preset]
-> Iso
(Maybe [Preset]) (Maybe [Preset]) (Maybe [Preset]) (Maybe [Preset])
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 [Preset] [Preset] [Preset] [Preset]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listPresetsResponse_httpStatus :: Lens.Lens' ListPresetsResponse Prelude.Int
listPresetsResponse_httpStatus :: (Int -> f Int) -> ListPresetsResponse -> f ListPresetsResponse
listPresetsResponse_httpStatus = (ListPresetsResponse -> Int)
-> (ListPresetsResponse -> Int -> ListPresetsResponse)
-> Lens ListPresetsResponse ListPresetsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPresetsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListPresetsResponse' :: ListPresetsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListPresetsResponse
s@ListPresetsResponse' {} Int
a -> ListPresetsResponse
s {$sel:httpStatus:ListPresetsResponse' :: Int
httpStatus = Int
a} :: ListPresetsResponse)
instance Prelude.NFData ListPresetsResponse