{-# 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.GamesParks.ListSnapshots
(
ListSnapshots (..),
newListSnapshots,
listSnapshots_maxResults,
listSnapshots_nextToken,
listSnapshots_gameName,
ListSnapshotsResponse (..),
newListSnapshotsResponse,
listSnapshotsResponse_nextToken,
listSnapshotsResponse_snapshots,
listSnapshotsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GamesParks.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListSnapshots = ListSnapshots'
{
ListSnapshots -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListSnapshots -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListSnapshots -> Text
gameName :: Prelude.Text
}
deriving (ListSnapshots -> ListSnapshots -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSnapshots -> ListSnapshots -> Bool
$c/= :: ListSnapshots -> ListSnapshots -> Bool
== :: ListSnapshots -> ListSnapshots -> Bool
$c== :: ListSnapshots -> ListSnapshots -> Bool
Prelude.Eq, ReadPrec [ListSnapshots]
ReadPrec ListSnapshots
Int -> ReadS ListSnapshots
ReadS [ListSnapshots]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSnapshots]
$creadListPrec :: ReadPrec [ListSnapshots]
readPrec :: ReadPrec ListSnapshots
$creadPrec :: ReadPrec ListSnapshots
readList :: ReadS [ListSnapshots]
$creadList :: ReadS [ListSnapshots]
readsPrec :: Int -> ReadS ListSnapshots
$creadsPrec :: Int -> ReadS ListSnapshots
Prelude.Read, Int -> ListSnapshots -> ShowS
[ListSnapshots] -> ShowS
ListSnapshots -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSnapshots] -> ShowS
$cshowList :: [ListSnapshots] -> ShowS
show :: ListSnapshots -> String
$cshow :: ListSnapshots -> String
showsPrec :: Int -> ListSnapshots -> ShowS
$cshowsPrec :: Int -> ListSnapshots -> ShowS
Prelude.Show, forall x. Rep ListSnapshots x -> ListSnapshots
forall x. ListSnapshots -> Rep ListSnapshots x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListSnapshots x -> ListSnapshots
$cfrom :: forall x. ListSnapshots -> Rep ListSnapshots x
Prelude.Generic)
newListSnapshots ::
Prelude.Text ->
ListSnapshots
newListSnapshots :: Text -> ListSnapshots
newListSnapshots Text
pGameName_ =
ListSnapshots'
{ $sel:maxResults:ListSnapshots' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListSnapshots' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:gameName:ListSnapshots' :: Text
gameName = Text
pGameName_
}
listSnapshots_maxResults :: Lens.Lens' ListSnapshots (Prelude.Maybe Prelude.Natural)
listSnapshots_maxResults :: Lens' ListSnapshots (Maybe Natural)
listSnapshots_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSnapshots' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListSnapshots' :: ListSnapshots -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListSnapshots
s@ListSnapshots' {} Maybe Natural
a -> ListSnapshots
s {$sel:maxResults:ListSnapshots' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListSnapshots)
listSnapshots_nextToken :: Lens.Lens' ListSnapshots (Prelude.Maybe Prelude.Text)
listSnapshots_nextToken :: Lens' ListSnapshots (Maybe Text)
listSnapshots_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSnapshots' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSnapshots' :: ListSnapshots -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSnapshots
s@ListSnapshots' {} Maybe Text
a -> ListSnapshots
s {$sel:nextToken:ListSnapshots' :: Maybe Text
nextToken = Maybe Text
a} :: ListSnapshots)
listSnapshots_gameName :: Lens.Lens' ListSnapshots Prelude.Text
listSnapshots_gameName :: Lens' ListSnapshots Text
listSnapshots_gameName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSnapshots' {Text
gameName :: Text
$sel:gameName:ListSnapshots' :: ListSnapshots -> Text
gameName} -> Text
gameName) (\s :: ListSnapshots
s@ListSnapshots' {} Text
a -> ListSnapshots
s {$sel:gameName:ListSnapshots' :: Text
gameName = Text
a} :: ListSnapshots)
instance Core.AWSPager ListSnapshots where
page :: ListSnapshots -> AWSResponse ListSnapshots -> Maybe ListSnapshots
page ListSnapshots
rq AWSResponse ListSnapshots
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListSnapshots
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListSnapshotsResponse (Maybe Text)
listSnapshotsResponse_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 ListSnapshots
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListSnapshotsResponse (Maybe [SnapshotSummary])
listSnapshotsResponse_snapshots
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.$ ListSnapshots
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListSnapshots (Maybe Text)
listSnapshots_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListSnapshots
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListSnapshotsResponse (Maybe Text)
listSnapshotsResponse_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 ListSnapshots where
type
AWSResponse ListSnapshots =
ListSnapshotsResponse
request :: (Service -> Service) -> ListSnapshots -> Request ListSnapshots
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListSnapshots
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListSnapshots)))
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 Text
-> Maybe [SnapshotSummary] -> Int -> ListSnapshotsResponse
ListSnapshotsResponse'
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
"NextToken")
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
"Snapshots" 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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ListSnapshots where
hashWithSalt :: Int -> ListSnapshots -> Int
hashWithSalt Int
_salt ListSnapshots' {Maybe Natural
Maybe Text
Text
gameName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:gameName:ListSnapshots' :: ListSnapshots -> Text
$sel:nextToken:ListSnapshots' :: ListSnapshots -> Maybe Text
$sel:maxResults:ListSnapshots' :: ListSnapshots -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
gameName
instance Prelude.NFData ListSnapshots where
rnf :: ListSnapshots -> ()
rnf ListSnapshots' {Maybe Natural
Maybe Text
Text
gameName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:gameName:ListSnapshots' :: ListSnapshots -> Text
$sel:nextToken:ListSnapshots' :: ListSnapshots -> Maybe Text
$sel:maxResults:ListSnapshots' :: ListSnapshots -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
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 Text
gameName
instance Data.ToHeaders ListSnapshots where
toHeaders :: ListSnapshots -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath ListSnapshots where
toPath :: ListSnapshots -> ByteString
toPath ListSnapshots' {Maybe Natural
Maybe Text
Text
gameName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:gameName:ListSnapshots' :: ListSnapshots -> Text
$sel:nextToken:ListSnapshots' :: ListSnapshots -> Maybe Text
$sel:maxResults:ListSnapshots' :: ListSnapshots -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/game/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
gameName, ByteString
"/snapshot"]
instance Data.ToQuery ListSnapshots where
toQuery :: ListSnapshots -> QueryString
toQuery ListSnapshots' {Maybe Natural
Maybe Text
Text
gameName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:gameName:ListSnapshots' :: ListSnapshots -> Text
$sel:nextToken:ListSnapshots' :: ListSnapshots -> Maybe Text
$sel:maxResults:ListSnapshots' :: ListSnapshots -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"MaxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
ByteString
"NextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
]
data ListSnapshotsResponse = ListSnapshotsResponse'
{
ListSnapshotsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListSnapshotsResponse -> Maybe [SnapshotSummary]
snapshots :: Prelude.Maybe [SnapshotSummary],
ListSnapshotsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListSnapshotsResponse -> ListSnapshotsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSnapshotsResponse -> ListSnapshotsResponse -> Bool
$c/= :: ListSnapshotsResponse -> ListSnapshotsResponse -> Bool
== :: ListSnapshotsResponse -> ListSnapshotsResponse -> Bool
$c== :: ListSnapshotsResponse -> ListSnapshotsResponse -> Bool
Prelude.Eq, ReadPrec [ListSnapshotsResponse]
ReadPrec ListSnapshotsResponse
Int -> ReadS ListSnapshotsResponse
ReadS [ListSnapshotsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSnapshotsResponse]
$creadListPrec :: ReadPrec [ListSnapshotsResponse]
readPrec :: ReadPrec ListSnapshotsResponse
$creadPrec :: ReadPrec ListSnapshotsResponse
readList :: ReadS [ListSnapshotsResponse]
$creadList :: ReadS [ListSnapshotsResponse]
readsPrec :: Int -> ReadS ListSnapshotsResponse
$creadsPrec :: Int -> ReadS ListSnapshotsResponse
Prelude.Read, Int -> ListSnapshotsResponse -> ShowS
[ListSnapshotsResponse] -> ShowS
ListSnapshotsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSnapshotsResponse] -> ShowS
$cshowList :: [ListSnapshotsResponse] -> ShowS
show :: ListSnapshotsResponse -> String
$cshow :: ListSnapshotsResponse -> String
showsPrec :: Int -> ListSnapshotsResponse -> ShowS
$cshowsPrec :: Int -> ListSnapshotsResponse -> ShowS
Prelude.Show, forall x. Rep ListSnapshotsResponse x -> ListSnapshotsResponse
forall x. ListSnapshotsResponse -> Rep ListSnapshotsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListSnapshotsResponse x -> ListSnapshotsResponse
$cfrom :: forall x. ListSnapshotsResponse -> Rep ListSnapshotsResponse x
Prelude.Generic)
newListSnapshotsResponse ::
Prelude.Int ->
ListSnapshotsResponse
newListSnapshotsResponse :: Int -> ListSnapshotsResponse
newListSnapshotsResponse Int
pHttpStatus_ =
ListSnapshotsResponse'
{ $sel:nextToken:ListSnapshotsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:snapshots:ListSnapshotsResponse' :: Maybe [SnapshotSummary]
snapshots = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListSnapshotsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listSnapshotsResponse_nextToken :: Lens.Lens' ListSnapshotsResponse (Prelude.Maybe Prelude.Text)
listSnapshotsResponse_nextToken :: Lens' ListSnapshotsResponse (Maybe Text)
listSnapshotsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSnapshotsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSnapshotsResponse' :: ListSnapshotsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSnapshotsResponse
s@ListSnapshotsResponse' {} Maybe Text
a -> ListSnapshotsResponse
s {$sel:nextToken:ListSnapshotsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListSnapshotsResponse)
listSnapshotsResponse_snapshots :: Lens.Lens' ListSnapshotsResponse (Prelude.Maybe [SnapshotSummary])
listSnapshotsResponse_snapshots :: Lens' ListSnapshotsResponse (Maybe [SnapshotSummary])
listSnapshotsResponse_snapshots = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSnapshotsResponse' {Maybe [SnapshotSummary]
snapshots :: Maybe [SnapshotSummary]
$sel:snapshots:ListSnapshotsResponse' :: ListSnapshotsResponse -> Maybe [SnapshotSummary]
snapshots} -> Maybe [SnapshotSummary]
snapshots) (\s :: ListSnapshotsResponse
s@ListSnapshotsResponse' {} Maybe [SnapshotSummary]
a -> ListSnapshotsResponse
s {$sel:snapshots:ListSnapshotsResponse' :: Maybe [SnapshotSummary]
snapshots = Maybe [SnapshotSummary]
a} :: ListSnapshotsResponse) 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
listSnapshotsResponse_httpStatus :: Lens.Lens' ListSnapshotsResponse Prelude.Int
listSnapshotsResponse_httpStatus :: Lens' ListSnapshotsResponse Int
listSnapshotsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSnapshotsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListSnapshotsResponse' :: ListSnapshotsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListSnapshotsResponse
s@ListSnapshotsResponse' {} Int
a -> ListSnapshotsResponse
s {$sel:httpStatus:ListSnapshotsResponse' :: Int
httpStatus = Int
a} :: ListSnapshotsResponse)
instance Prelude.NFData ListSnapshotsResponse where
rnf :: ListSnapshotsResponse -> ()
rnf ListSnapshotsResponse' {Int
Maybe [SnapshotSummary]
Maybe Text
httpStatus :: Int
snapshots :: Maybe [SnapshotSummary]
nextToken :: Maybe Text
$sel:httpStatus:ListSnapshotsResponse' :: ListSnapshotsResponse -> Int
$sel:snapshots:ListSnapshotsResponse' :: ListSnapshotsResponse -> Maybe [SnapshotSummary]
$sel:nextToken:ListSnapshotsResponse' :: ListSnapshotsResponse -> Maybe Text
..} =
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 Maybe [SnapshotSummary]
snapshots
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus