{-# 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.GameLift.ListScripts
(
ListScripts (..),
newListScripts,
listScripts_nextToken,
listScripts_limit,
ListScriptsResponse (..),
newListScriptsResponse,
listScriptsResponse_scripts,
listScriptsResponse_nextToken,
listScriptsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.GameLift.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 ListScripts = ListScripts'
{
ListScripts -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListScripts -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural
}
deriving (ListScripts -> ListScripts -> Bool
(ListScripts -> ListScripts -> Bool)
-> (ListScripts -> ListScripts -> Bool) -> Eq ListScripts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListScripts -> ListScripts -> Bool
$c/= :: ListScripts -> ListScripts -> Bool
== :: ListScripts -> ListScripts -> Bool
$c== :: ListScripts -> ListScripts -> Bool
Prelude.Eq, ReadPrec [ListScripts]
ReadPrec ListScripts
Int -> ReadS ListScripts
ReadS [ListScripts]
(Int -> ReadS ListScripts)
-> ReadS [ListScripts]
-> ReadPrec ListScripts
-> ReadPrec [ListScripts]
-> Read ListScripts
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListScripts]
$creadListPrec :: ReadPrec [ListScripts]
readPrec :: ReadPrec ListScripts
$creadPrec :: ReadPrec ListScripts
readList :: ReadS [ListScripts]
$creadList :: ReadS [ListScripts]
readsPrec :: Int -> ReadS ListScripts
$creadsPrec :: Int -> ReadS ListScripts
Prelude.Read, Int -> ListScripts -> ShowS
[ListScripts] -> ShowS
ListScripts -> String
(Int -> ListScripts -> ShowS)
-> (ListScripts -> String)
-> ([ListScripts] -> ShowS)
-> Show ListScripts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListScripts] -> ShowS
$cshowList :: [ListScripts] -> ShowS
show :: ListScripts -> String
$cshow :: ListScripts -> String
showsPrec :: Int -> ListScripts -> ShowS
$cshowsPrec :: Int -> ListScripts -> ShowS
Prelude.Show, (forall x. ListScripts -> Rep ListScripts x)
-> (forall x. Rep ListScripts x -> ListScripts)
-> Generic ListScripts
forall x. Rep ListScripts x -> ListScripts
forall x. ListScripts -> Rep ListScripts x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListScripts x -> ListScripts
$cfrom :: forall x. ListScripts -> Rep ListScripts x
Prelude.Generic)
newListScripts ::
ListScripts
newListScripts :: ListScripts
newListScripts =
ListScripts' :: Maybe Text -> Maybe Natural -> ListScripts
ListScripts'
{ $sel:nextToken:ListScripts' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:limit:ListScripts' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listScripts_nextToken :: Lens.Lens' ListScripts (Prelude.Maybe Prelude.Text)
listScripts_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListScripts -> f ListScripts
listScripts_nextToken = (ListScripts -> Maybe Text)
-> (ListScripts -> Maybe Text -> ListScripts)
-> Lens ListScripts ListScripts (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListScripts' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListScripts' :: ListScripts -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListScripts
s@ListScripts' {} Maybe Text
a -> ListScripts
s {$sel:nextToken:ListScripts' :: Maybe Text
nextToken = Maybe Text
a} :: ListScripts)
listScripts_limit :: Lens.Lens' ListScripts (Prelude.Maybe Prelude.Natural)
listScripts_limit :: (Maybe Natural -> f (Maybe Natural))
-> ListScripts -> f ListScripts
listScripts_limit = (ListScripts -> Maybe Natural)
-> (ListScripts -> Maybe Natural -> ListScripts)
-> Lens ListScripts ListScripts (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListScripts' {Maybe Natural
limit :: Maybe Natural
$sel:limit:ListScripts' :: ListScripts -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: ListScripts
s@ListScripts' {} Maybe Natural
a -> ListScripts
s {$sel:limit:ListScripts' :: Maybe Natural
limit = Maybe Natural
a} :: ListScripts)
instance Core.AWSPager ListScripts where
page :: ListScripts -> AWSResponse ListScripts -> Maybe ListScripts
page ListScripts
rq AWSResponse ListScripts
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListScripts
ListScriptsResponse
rs
ListScriptsResponse
-> Getting (First Text) ListScriptsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListScriptsResponse -> Const (First Text) ListScriptsResponse
Lens' ListScriptsResponse (Maybe Text)
listScriptsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListScriptsResponse -> Const (First Text) ListScriptsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListScriptsResponse 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 ListScripts
forall a. Maybe a
Prelude.Nothing
| Maybe [Script] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListScripts
ListScriptsResponse
rs
ListScriptsResponse
-> Getting (First [Script]) ListScriptsResponse [Script]
-> Maybe [Script]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Script] -> Const (First [Script]) (Maybe [Script]))
-> ListScriptsResponse
-> Const (First [Script]) ListScriptsResponse
Lens' ListScriptsResponse (Maybe [Script])
listScriptsResponse_scripts ((Maybe [Script] -> Const (First [Script]) (Maybe [Script]))
-> ListScriptsResponse
-> Const (First [Script]) ListScriptsResponse)
-> (([Script] -> Const (First [Script]) [Script])
-> Maybe [Script] -> Const (First [Script]) (Maybe [Script]))
-> Getting (First [Script]) ListScriptsResponse [Script]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Script] -> Const (First [Script]) [Script])
-> Maybe [Script] -> Const (First [Script]) (Maybe [Script])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe ListScripts
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
ListScripts -> Maybe ListScripts
forall a. a -> Maybe a
Prelude.Just (ListScripts -> Maybe ListScripts)
-> ListScripts -> Maybe ListScripts
forall a b. (a -> b) -> a -> b
Prelude.$
ListScripts
rq
ListScripts -> (ListScripts -> ListScripts) -> ListScripts
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListScripts -> Identity ListScripts
Lens ListScripts ListScripts (Maybe Text) (Maybe Text)
listScripts_nextToken
((Maybe Text -> Identity (Maybe Text))
-> ListScripts -> Identity ListScripts)
-> Maybe Text -> ListScripts -> ListScripts
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListScripts
ListScriptsResponse
rs
ListScriptsResponse
-> Getting (First Text) ListScriptsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListScriptsResponse -> Const (First Text) ListScriptsResponse
Lens' ListScriptsResponse (Maybe Text)
listScriptsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListScriptsResponse -> Const (First Text) ListScriptsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListScriptsResponse 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 ListScripts where
type AWSResponse ListScripts = ListScriptsResponse
request :: ListScripts -> Request ListScripts
request = Service -> ListScripts -> Request ListScripts
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListScripts
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListScripts)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListScripts))
-> Logger
-> Service
-> Proxy ListScripts
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListScripts)))
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 [Script] -> Maybe Text -> Int -> ListScriptsResponse
ListScriptsResponse'
(Maybe [Script] -> Maybe Text -> Int -> ListScriptsResponse)
-> Either String (Maybe [Script])
-> Either String (Maybe Text -> Int -> ListScriptsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Script]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Scripts" Either String (Maybe (Maybe [Script]))
-> Maybe [Script] -> Either String (Maybe [Script])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Script]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe Text -> Int -> ListScriptsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListScriptsResponse)
forall (f :: * -> *) a b. Applicative f => 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 -> ListScriptsResponse)
-> Either String Int -> Either String ListScriptsResponse
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 ListScripts
instance Prelude.NFData ListScripts
instance Core.ToHeaders ListScripts where
toHeaders :: ListScripts -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListScripts -> 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
"GameLift.ListScripts" :: Prelude.ByteString),
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 ListScripts where
toJSON :: ListScripts -> Value
toJSON ListScripts' {Maybe Natural
Maybe Text
limit :: Maybe Natural
nextToken :: Maybe Text
$sel:limit:ListScripts' :: ListScripts -> Maybe Natural
$sel:nextToken:ListScripts' :: ListScripts -> 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
"Limit" 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
limit
]
)
instance Core.ToPath ListScripts where
toPath :: ListScripts -> ByteString
toPath = ByteString -> ListScripts -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ListScripts where
toQuery :: ListScripts -> QueryString
toQuery = QueryString -> ListScripts -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListScriptsResponse = ListScriptsResponse'
{
ListScriptsResponse -> Maybe [Script]
scripts :: Prelude.Maybe [Script],
ListScriptsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListScriptsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListScriptsResponse -> ListScriptsResponse -> Bool
(ListScriptsResponse -> ListScriptsResponse -> Bool)
-> (ListScriptsResponse -> ListScriptsResponse -> Bool)
-> Eq ListScriptsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListScriptsResponse -> ListScriptsResponse -> Bool
$c/= :: ListScriptsResponse -> ListScriptsResponse -> Bool
== :: ListScriptsResponse -> ListScriptsResponse -> Bool
$c== :: ListScriptsResponse -> ListScriptsResponse -> Bool
Prelude.Eq, ReadPrec [ListScriptsResponse]
ReadPrec ListScriptsResponse
Int -> ReadS ListScriptsResponse
ReadS [ListScriptsResponse]
(Int -> ReadS ListScriptsResponse)
-> ReadS [ListScriptsResponse]
-> ReadPrec ListScriptsResponse
-> ReadPrec [ListScriptsResponse]
-> Read ListScriptsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListScriptsResponse]
$creadListPrec :: ReadPrec [ListScriptsResponse]
readPrec :: ReadPrec ListScriptsResponse
$creadPrec :: ReadPrec ListScriptsResponse
readList :: ReadS [ListScriptsResponse]
$creadList :: ReadS [ListScriptsResponse]
readsPrec :: Int -> ReadS ListScriptsResponse
$creadsPrec :: Int -> ReadS ListScriptsResponse
Prelude.Read, Int -> ListScriptsResponse -> ShowS
[ListScriptsResponse] -> ShowS
ListScriptsResponse -> String
(Int -> ListScriptsResponse -> ShowS)
-> (ListScriptsResponse -> String)
-> ([ListScriptsResponse] -> ShowS)
-> Show ListScriptsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListScriptsResponse] -> ShowS
$cshowList :: [ListScriptsResponse] -> ShowS
show :: ListScriptsResponse -> String
$cshow :: ListScriptsResponse -> String
showsPrec :: Int -> ListScriptsResponse -> ShowS
$cshowsPrec :: Int -> ListScriptsResponse -> ShowS
Prelude.Show, (forall x. ListScriptsResponse -> Rep ListScriptsResponse x)
-> (forall x. Rep ListScriptsResponse x -> ListScriptsResponse)
-> Generic ListScriptsResponse
forall x. Rep ListScriptsResponse x -> ListScriptsResponse
forall x. ListScriptsResponse -> Rep ListScriptsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListScriptsResponse x -> ListScriptsResponse
$cfrom :: forall x. ListScriptsResponse -> Rep ListScriptsResponse x
Prelude.Generic)
newListScriptsResponse ::
Prelude.Int ->
ListScriptsResponse
newListScriptsResponse :: Int -> ListScriptsResponse
newListScriptsResponse Int
pHttpStatus_ =
ListScriptsResponse' :: Maybe [Script] -> Maybe Text -> Int -> ListScriptsResponse
ListScriptsResponse'
{ $sel:scripts:ListScriptsResponse' :: Maybe [Script]
scripts = Maybe [Script]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListScriptsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListScriptsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listScriptsResponse_scripts :: Lens.Lens' ListScriptsResponse (Prelude.Maybe [Script])
listScriptsResponse_scripts :: (Maybe [Script] -> f (Maybe [Script]))
-> ListScriptsResponse -> f ListScriptsResponse
listScriptsResponse_scripts = (ListScriptsResponse -> Maybe [Script])
-> (ListScriptsResponse -> Maybe [Script] -> ListScriptsResponse)
-> Lens' ListScriptsResponse (Maybe [Script])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListScriptsResponse' {Maybe [Script]
scripts :: Maybe [Script]
$sel:scripts:ListScriptsResponse' :: ListScriptsResponse -> Maybe [Script]
scripts} -> Maybe [Script]
scripts) (\s :: ListScriptsResponse
s@ListScriptsResponse' {} Maybe [Script]
a -> ListScriptsResponse
s {$sel:scripts:ListScriptsResponse' :: Maybe [Script]
scripts = Maybe [Script]
a} :: ListScriptsResponse) ((Maybe [Script] -> f (Maybe [Script]))
-> ListScriptsResponse -> f ListScriptsResponse)
-> ((Maybe [Script] -> f (Maybe [Script]))
-> Maybe [Script] -> f (Maybe [Script]))
-> (Maybe [Script] -> f (Maybe [Script]))
-> ListScriptsResponse
-> f ListScriptsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Script] [Script] [Script] [Script]
-> Iso
(Maybe [Script]) (Maybe [Script]) (Maybe [Script]) (Maybe [Script])
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 [Script] [Script] [Script] [Script]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listScriptsResponse_nextToken :: Lens.Lens' ListScriptsResponse (Prelude.Maybe Prelude.Text)
listScriptsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListScriptsResponse -> f ListScriptsResponse
listScriptsResponse_nextToken = (ListScriptsResponse -> Maybe Text)
-> (ListScriptsResponse -> Maybe Text -> ListScriptsResponse)
-> Lens' ListScriptsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListScriptsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListScriptsResponse' :: ListScriptsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListScriptsResponse
s@ListScriptsResponse' {} Maybe Text
a -> ListScriptsResponse
s {$sel:nextToken:ListScriptsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListScriptsResponse)
listScriptsResponse_httpStatus :: Lens.Lens' ListScriptsResponse Prelude.Int
listScriptsResponse_httpStatus :: (Int -> f Int) -> ListScriptsResponse -> f ListScriptsResponse
listScriptsResponse_httpStatus = (ListScriptsResponse -> Int)
-> (ListScriptsResponse -> Int -> ListScriptsResponse)
-> Lens ListScriptsResponse ListScriptsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListScriptsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListScriptsResponse' :: ListScriptsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListScriptsResponse
s@ListScriptsResponse' {} Int
a -> ListScriptsResponse
s {$sel:httpStatus:ListScriptsResponse' :: Int
httpStatus = Int
a} :: ListScriptsResponse)
instance Prelude.NFData ListScriptsResponse