{-# 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.ListLocations
(
ListLocations (..),
newListLocations,
listLocations_filters,
listLocations_limit,
listLocations_nextToken,
ListLocationsResponse (..),
newListLocationsResponse,
listLocationsResponse_locations,
listLocationsResponse_nextToken,
listLocationsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GameLift.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListLocations = ListLocations'
{
ListLocations -> Maybe (NonEmpty LocationFilter)
filters :: Prelude.Maybe (Prelude.NonEmpty LocationFilter),
ListLocations -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
ListLocations -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListLocations -> ListLocations -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListLocations -> ListLocations -> Bool
$c/= :: ListLocations -> ListLocations -> Bool
== :: ListLocations -> ListLocations -> Bool
$c== :: ListLocations -> ListLocations -> Bool
Prelude.Eq, ReadPrec [ListLocations]
ReadPrec ListLocations
Int -> ReadS ListLocations
ReadS [ListLocations]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListLocations]
$creadListPrec :: ReadPrec [ListLocations]
readPrec :: ReadPrec ListLocations
$creadPrec :: ReadPrec ListLocations
readList :: ReadS [ListLocations]
$creadList :: ReadS [ListLocations]
readsPrec :: Int -> ReadS ListLocations
$creadsPrec :: Int -> ReadS ListLocations
Prelude.Read, Int -> ListLocations -> ShowS
[ListLocations] -> ShowS
ListLocations -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListLocations] -> ShowS
$cshowList :: [ListLocations] -> ShowS
show :: ListLocations -> String
$cshow :: ListLocations -> String
showsPrec :: Int -> ListLocations -> ShowS
$cshowsPrec :: Int -> ListLocations -> ShowS
Prelude.Show, forall x. Rep ListLocations x -> ListLocations
forall x. ListLocations -> Rep ListLocations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListLocations x -> ListLocations
$cfrom :: forall x. ListLocations -> Rep ListLocations x
Prelude.Generic)
newListLocations ::
ListLocations
newListLocations :: ListLocations
newListLocations =
ListLocations'
{ $sel:filters:ListLocations' :: Maybe (NonEmpty LocationFilter)
filters = forall a. Maybe a
Prelude.Nothing,
$sel:limit:ListLocations' :: Maybe Natural
limit = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListLocations' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listLocations_filters :: Lens.Lens' ListLocations (Prelude.Maybe (Prelude.NonEmpty LocationFilter))
listLocations_filters :: Lens' ListLocations (Maybe (NonEmpty LocationFilter))
listLocations_filters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLocations' {Maybe (NonEmpty LocationFilter)
filters :: Maybe (NonEmpty LocationFilter)
$sel:filters:ListLocations' :: ListLocations -> Maybe (NonEmpty LocationFilter)
filters} -> Maybe (NonEmpty LocationFilter)
filters) (\s :: ListLocations
s@ListLocations' {} Maybe (NonEmpty LocationFilter)
a -> ListLocations
s {$sel:filters:ListLocations' :: Maybe (NonEmpty LocationFilter)
filters = Maybe (NonEmpty LocationFilter)
a} :: ListLocations) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listLocations_limit :: Lens.Lens' ListLocations (Prelude.Maybe Prelude.Natural)
listLocations_limit :: Lens' ListLocations (Maybe Natural)
listLocations_limit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLocations' {Maybe Natural
limit :: Maybe Natural
$sel:limit:ListLocations' :: ListLocations -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: ListLocations
s@ListLocations' {} Maybe Natural
a -> ListLocations
s {$sel:limit:ListLocations' :: Maybe Natural
limit = Maybe Natural
a} :: ListLocations)
listLocations_nextToken :: Lens.Lens' ListLocations (Prelude.Maybe Prelude.Text)
listLocations_nextToken :: Lens' ListLocations (Maybe Text)
listLocations_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLocations' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListLocations' :: ListLocations -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListLocations
s@ListLocations' {} Maybe Text
a -> ListLocations
s {$sel:nextToken:ListLocations' :: Maybe Text
nextToken = Maybe Text
a} :: ListLocations)
instance Core.AWSPager ListLocations where
page :: ListLocations -> AWSResponse ListLocations -> Maybe ListLocations
page ListLocations
rq AWSResponse ListLocations
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListLocations
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListLocationsResponse (Maybe Text)
listLocationsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListLocations
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListLocationsResponse (Maybe [LocationModel])
listLocationsResponse_locations
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListLocations
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListLocations (Maybe Text)
listLocations_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListLocations
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListLocationsResponse (Maybe Text)
listLocationsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListLocations where
type
AWSResponse ListLocations =
ListLocationsResponse
request :: (Service -> Service) -> ListLocations -> Request ListLocations
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListLocations
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListLocations)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [LocationModel] -> Maybe Text -> Int -> ListLocationsResponse
ListLocationsResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Locations" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NextToken")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ListLocations where
hashWithSalt :: Int -> ListLocations -> Int
hashWithSalt Int
_salt ListLocations' {Maybe Natural
Maybe (NonEmpty LocationFilter)
Maybe Text
nextToken :: Maybe Text
limit :: Maybe Natural
filters :: Maybe (NonEmpty LocationFilter)
$sel:nextToken:ListLocations' :: ListLocations -> Maybe Text
$sel:limit:ListLocations' :: ListLocations -> Maybe Natural
$sel:filters:ListLocations' :: ListLocations -> Maybe (NonEmpty LocationFilter)
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty LocationFilter)
filters
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
limit
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
instance Prelude.NFData ListLocations where
rnf :: ListLocations -> ()
rnf ListLocations' {Maybe Natural
Maybe (NonEmpty LocationFilter)
Maybe Text
nextToken :: Maybe Text
limit :: Maybe Natural
filters :: Maybe (NonEmpty LocationFilter)
$sel:nextToken:ListLocations' :: ListLocations -> Maybe Text
$sel:limit:ListLocations' :: ListLocations -> Maybe Natural
$sel:filters:ListLocations' :: ListLocations -> Maybe (NonEmpty LocationFilter)
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty LocationFilter)
filters
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
limit
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
instance Data.ToHeaders ListLocations where
toHeaders :: ListLocations -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# (ByteString
"GameLift.ListLocations" :: Prelude.ByteString),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON ListLocations where
toJSON :: ListLocations -> Value
toJSON ListLocations' {Maybe Natural
Maybe (NonEmpty LocationFilter)
Maybe Text
nextToken :: Maybe Text
limit :: Maybe Natural
filters :: Maybe (NonEmpty LocationFilter)
$sel:nextToken:ListLocations' :: ListLocations -> Maybe Text
$sel:limit:ListLocations' :: ListLocations -> Maybe Natural
$sel:filters:ListLocations' :: ListLocations -> Maybe (NonEmpty LocationFilter)
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Filters" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty LocationFilter)
filters,
(Key
"Limit" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
limit,
(Key
"NextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken
]
)
instance Data.ToPath ListLocations where
toPath :: ListLocations -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListLocations where
toQuery :: ListLocations -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListLocationsResponse = ListLocationsResponse'
{
ListLocationsResponse -> Maybe [LocationModel]
locations :: Prelude.Maybe [LocationModel],
ListLocationsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListLocationsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListLocationsResponse -> ListLocationsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListLocationsResponse -> ListLocationsResponse -> Bool
$c/= :: ListLocationsResponse -> ListLocationsResponse -> Bool
== :: ListLocationsResponse -> ListLocationsResponse -> Bool
$c== :: ListLocationsResponse -> ListLocationsResponse -> Bool
Prelude.Eq, ReadPrec [ListLocationsResponse]
ReadPrec ListLocationsResponse
Int -> ReadS ListLocationsResponse
ReadS [ListLocationsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListLocationsResponse]
$creadListPrec :: ReadPrec [ListLocationsResponse]
readPrec :: ReadPrec ListLocationsResponse
$creadPrec :: ReadPrec ListLocationsResponse
readList :: ReadS [ListLocationsResponse]
$creadList :: ReadS [ListLocationsResponse]
readsPrec :: Int -> ReadS ListLocationsResponse
$creadsPrec :: Int -> ReadS ListLocationsResponse
Prelude.Read, Int -> ListLocationsResponse -> ShowS
[ListLocationsResponse] -> ShowS
ListLocationsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListLocationsResponse] -> ShowS
$cshowList :: [ListLocationsResponse] -> ShowS
show :: ListLocationsResponse -> String
$cshow :: ListLocationsResponse -> String
showsPrec :: Int -> ListLocationsResponse -> ShowS
$cshowsPrec :: Int -> ListLocationsResponse -> ShowS
Prelude.Show, forall x. Rep ListLocationsResponse x -> ListLocationsResponse
forall x. ListLocationsResponse -> Rep ListLocationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListLocationsResponse x -> ListLocationsResponse
$cfrom :: forall x. ListLocationsResponse -> Rep ListLocationsResponse x
Prelude.Generic)
newListLocationsResponse ::
Prelude.Int ->
ListLocationsResponse
newListLocationsResponse :: Int -> ListLocationsResponse
newListLocationsResponse Int
pHttpStatus_ =
ListLocationsResponse'
{ $sel:locations:ListLocationsResponse' :: Maybe [LocationModel]
locations = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListLocationsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListLocationsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listLocationsResponse_locations :: Lens.Lens' ListLocationsResponse (Prelude.Maybe [LocationModel])
listLocationsResponse_locations :: Lens' ListLocationsResponse (Maybe [LocationModel])
listLocationsResponse_locations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLocationsResponse' {Maybe [LocationModel]
locations :: Maybe [LocationModel]
$sel:locations:ListLocationsResponse' :: ListLocationsResponse -> Maybe [LocationModel]
locations} -> Maybe [LocationModel]
locations) (\s :: ListLocationsResponse
s@ListLocationsResponse' {} Maybe [LocationModel]
a -> ListLocationsResponse
s {$sel:locations:ListLocationsResponse' :: Maybe [LocationModel]
locations = Maybe [LocationModel]
a} :: ListLocationsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listLocationsResponse_nextToken :: Lens.Lens' ListLocationsResponse (Prelude.Maybe Prelude.Text)
listLocationsResponse_nextToken :: Lens' ListLocationsResponse (Maybe Text)
listLocationsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLocationsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListLocationsResponse' :: ListLocationsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListLocationsResponse
s@ListLocationsResponse' {} Maybe Text
a -> ListLocationsResponse
s {$sel:nextToken:ListLocationsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListLocationsResponse)
listLocationsResponse_httpStatus :: Lens.Lens' ListLocationsResponse Prelude.Int
listLocationsResponse_httpStatus :: Lens' ListLocationsResponse Int
listLocationsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLocationsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListLocationsResponse' :: ListLocationsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListLocationsResponse
s@ListLocationsResponse' {} Int
a -> ListLocationsResponse
s {$sel:httpStatus:ListLocationsResponse' :: Int
httpStatus = Int
a} :: ListLocationsResponse)
instance Prelude.NFData ListLocationsResponse where
rnf :: ListLocationsResponse -> ()
rnf ListLocationsResponse' {Int
Maybe [LocationModel]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
locations :: Maybe [LocationModel]
$sel:httpStatus:ListLocationsResponse' :: ListLocationsResponse -> Int
$sel:nextToken:ListLocationsResponse' :: ListLocationsResponse -> Maybe Text
$sel:locations:ListLocationsResponse' :: ListLocationsResponse -> Maybe [LocationModel]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [LocationModel]
locations
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus