{-# 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.UpdateSnapshot
(
UpdateSnapshot (..),
newUpdateSnapshot,
updateSnapshot_description,
updateSnapshot_gameName,
updateSnapshot_snapshotId,
UpdateSnapshotResponse (..),
newUpdateSnapshotResponse,
updateSnapshotResponse_snapshot,
updateSnapshotResponse_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 UpdateSnapshot = UpdateSnapshot'
{
UpdateSnapshot -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
UpdateSnapshot -> Text
gameName :: Prelude.Text,
UpdateSnapshot -> Text
snapshotId :: Prelude.Text
}
deriving (UpdateSnapshot -> UpdateSnapshot -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateSnapshot -> UpdateSnapshot -> Bool
$c/= :: UpdateSnapshot -> UpdateSnapshot -> Bool
== :: UpdateSnapshot -> UpdateSnapshot -> Bool
$c== :: UpdateSnapshot -> UpdateSnapshot -> Bool
Prelude.Eq, ReadPrec [UpdateSnapshot]
ReadPrec UpdateSnapshot
Int -> ReadS UpdateSnapshot
ReadS [UpdateSnapshot]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateSnapshot]
$creadListPrec :: ReadPrec [UpdateSnapshot]
readPrec :: ReadPrec UpdateSnapshot
$creadPrec :: ReadPrec UpdateSnapshot
readList :: ReadS [UpdateSnapshot]
$creadList :: ReadS [UpdateSnapshot]
readsPrec :: Int -> ReadS UpdateSnapshot
$creadsPrec :: Int -> ReadS UpdateSnapshot
Prelude.Read, Int -> UpdateSnapshot -> ShowS
[UpdateSnapshot] -> ShowS
UpdateSnapshot -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateSnapshot] -> ShowS
$cshowList :: [UpdateSnapshot] -> ShowS
show :: UpdateSnapshot -> String
$cshow :: UpdateSnapshot -> String
showsPrec :: Int -> UpdateSnapshot -> ShowS
$cshowsPrec :: Int -> UpdateSnapshot -> ShowS
Prelude.Show, forall x. Rep UpdateSnapshot x -> UpdateSnapshot
forall x. UpdateSnapshot -> Rep UpdateSnapshot x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateSnapshot x -> UpdateSnapshot
$cfrom :: forall x. UpdateSnapshot -> Rep UpdateSnapshot x
Prelude.Generic)
newUpdateSnapshot ::
Prelude.Text ->
Prelude.Text ->
UpdateSnapshot
newUpdateSnapshot :: Text -> Text -> UpdateSnapshot
newUpdateSnapshot Text
pGameName_ Text
pSnapshotId_ =
UpdateSnapshot'
{ $sel:description:UpdateSnapshot' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
$sel:gameName:UpdateSnapshot' :: Text
gameName = Text
pGameName_,
$sel:snapshotId:UpdateSnapshot' :: Text
snapshotId = Text
pSnapshotId_
}
updateSnapshot_description :: Lens.Lens' UpdateSnapshot (Prelude.Maybe Prelude.Text)
updateSnapshot_description :: Lens' UpdateSnapshot (Maybe Text)
updateSnapshot_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSnapshot' {Maybe Text
description :: Maybe Text
$sel:description:UpdateSnapshot' :: UpdateSnapshot -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateSnapshot
s@UpdateSnapshot' {} Maybe Text
a -> UpdateSnapshot
s {$sel:description:UpdateSnapshot' :: Maybe Text
description = Maybe Text
a} :: UpdateSnapshot)
updateSnapshot_gameName :: Lens.Lens' UpdateSnapshot Prelude.Text
updateSnapshot_gameName :: Lens' UpdateSnapshot Text
updateSnapshot_gameName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSnapshot' {Text
gameName :: Text
$sel:gameName:UpdateSnapshot' :: UpdateSnapshot -> Text
gameName} -> Text
gameName) (\s :: UpdateSnapshot
s@UpdateSnapshot' {} Text
a -> UpdateSnapshot
s {$sel:gameName:UpdateSnapshot' :: Text
gameName = Text
a} :: UpdateSnapshot)
updateSnapshot_snapshotId :: Lens.Lens' UpdateSnapshot Prelude.Text
updateSnapshot_snapshotId :: Lens' UpdateSnapshot Text
updateSnapshot_snapshotId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSnapshot' {Text
snapshotId :: Text
$sel:snapshotId:UpdateSnapshot' :: UpdateSnapshot -> Text
snapshotId} -> Text
snapshotId) (\s :: UpdateSnapshot
s@UpdateSnapshot' {} Text
a -> UpdateSnapshot
s {$sel:snapshotId:UpdateSnapshot' :: Text
snapshotId = Text
a} :: UpdateSnapshot)
instance Core.AWSRequest UpdateSnapshot where
type
AWSResponse UpdateSnapshot =
UpdateSnapshotResponse
request :: (Service -> Service) -> UpdateSnapshot -> Request UpdateSnapshot
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.patchJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateSnapshot
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateSnapshot)))
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 SnapshotDetails -> Int -> UpdateSnapshotResponse
UpdateSnapshotResponse'
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
"Snapshot")
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 UpdateSnapshot where
hashWithSalt :: Int -> UpdateSnapshot -> Int
hashWithSalt Int
_salt UpdateSnapshot' {Maybe Text
Text
snapshotId :: Text
gameName :: Text
description :: Maybe Text
$sel:snapshotId:UpdateSnapshot' :: UpdateSnapshot -> Text
$sel:gameName:UpdateSnapshot' :: UpdateSnapshot -> Text
$sel:description:UpdateSnapshot' :: UpdateSnapshot -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
gameName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
snapshotId
instance Prelude.NFData UpdateSnapshot where
rnf :: UpdateSnapshot -> ()
rnf UpdateSnapshot' {Maybe Text
Text
snapshotId :: Text
gameName :: Text
description :: Maybe Text
$sel:snapshotId:UpdateSnapshot' :: UpdateSnapshot -> Text
$sel:gameName:UpdateSnapshot' :: UpdateSnapshot -> Text
$sel:description:UpdateSnapshot' :: UpdateSnapshot -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
gameName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
snapshotId
instance Data.ToHeaders UpdateSnapshot where
toHeaders :: UpdateSnapshot -> 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.ToJSON UpdateSnapshot where
toJSON :: UpdateSnapshot -> Value
toJSON UpdateSnapshot' {Maybe Text
Text
snapshotId :: Text
gameName :: Text
description :: Maybe Text
$sel:snapshotId:UpdateSnapshot' :: UpdateSnapshot -> Text
$sel:gameName:UpdateSnapshot' :: UpdateSnapshot -> Text
$sel:description:UpdateSnapshot' :: UpdateSnapshot -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Key
"Description" 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
description]
)
instance Data.ToPath UpdateSnapshot where
toPath :: UpdateSnapshot -> ByteString
toPath UpdateSnapshot' {Maybe Text
Text
snapshotId :: Text
gameName :: Text
description :: Maybe Text
$sel:snapshotId:UpdateSnapshot' :: UpdateSnapshot -> Text
$sel:gameName:UpdateSnapshot' :: UpdateSnapshot -> Text
$sel:description:UpdateSnapshot' :: UpdateSnapshot -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/game/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
gameName,
ByteString
"/snapshot/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
snapshotId
]
instance Data.ToQuery UpdateSnapshot where
toQuery :: UpdateSnapshot -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data UpdateSnapshotResponse = UpdateSnapshotResponse'
{
UpdateSnapshotResponse -> Maybe SnapshotDetails
snapshot :: Prelude.Maybe SnapshotDetails,
UpdateSnapshotResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateSnapshotResponse -> UpdateSnapshotResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateSnapshotResponse -> UpdateSnapshotResponse -> Bool
$c/= :: UpdateSnapshotResponse -> UpdateSnapshotResponse -> Bool
== :: UpdateSnapshotResponse -> UpdateSnapshotResponse -> Bool
$c== :: UpdateSnapshotResponse -> UpdateSnapshotResponse -> Bool
Prelude.Eq, ReadPrec [UpdateSnapshotResponse]
ReadPrec UpdateSnapshotResponse
Int -> ReadS UpdateSnapshotResponse
ReadS [UpdateSnapshotResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateSnapshotResponse]
$creadListPrec :: ReadPrec [UpdateSnapshotResponse]
readPrec :: ReadPrec UpdateSnapshotResponse
$creadPrec :: ReadPrec UpdateSnapshotResponse
readList :: ReadS [UpdateSnapshotResponse]
$creadList :: ReadS [UpdateSnapshotResponse]
readsPrec :: Int -> ReadS UpdateSnapshotResponse
$creadsPrec :: Int -> ReadS UpdateSnapshotResponse
Prelude.Read, Int -> UpdateSnapshotResponse -> ShowS
[UpdateSnapshotResponse] -> ShowS
UpdateSnapshotResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateSnapshotResponse] -> ShowS
$cshowList :: [UpdateSnapshotResponse] -> ShowS
show :: UpdateSnapshotResponse -> String
$cshow :: UpdateSnapshotResponse -> String
showsPrec :: Int -> UpdateSnapshotResponse -> ShowS
$cshowsPrec :: Int -> UpdateSnapshotResponse -> ShowS
Prelude.Show, forall x. Rep UpdateSnapshotResponse x -> UpdateSnapshotResponse
forall x. UpdateSnapshotResponse -> Rep UpdateSnapshotResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateSnapshotResponse x -> UpdateSnapshotResponse
$cfrom :: forall x. UpdateSnapshotResponse -> Rep UpdateSnapshotResponse x
Prelude.Generic)
newUpdateSnapshotResponse ::
Prelude.Int ->
UpdateSnapshotResponse
newUpdateSnapshotResponse :: Int -> UpdateSnapshotResponse
newUpdateSnapshotResponse Int
pHttpStatus_ =
UpdateSnapshotResponse'
{ $sel:snapshot:UpdateSnapshotResponse' :: Maybe SnapshotDetails
snapshot = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateSnapshotResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateSnapshotResponse_snapshot :: Lens.Lens' UpdateSnapshotResponse (Prelude.Maybe SnapshotDetails)
updateSnapshotResponse_snapshot :: Lens' UpdateSnapshotResponse (Maybe SnapshotDetails)
updateSnapshotResponse_snapshot = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSnapshotResponse' {Maybe SnapshotDetails
snapshot :: Maybe SnapshotDetails
$sel:snapshot:UpdateSnapshotResponse' :: UpdateSnapshotResponse -> Maybe SnapshotDetails
snapshot} -> Maybe SnapshotDetails
snapshot) (\s :: UpdateSnapshotResponse
s@UpdateSnapshotResponse' {} Maybe SnapshotDetails
a -> UpdateSnapshotResponse
s {$sel:snapshot:UpdateSnapshotResponse' :: Maybe SnapshotDetails
snapshot = Maybe SnapshotDetails
a} :: UpdateSnapshotResponse)
updateSnapshotResponse_httpStatus :: Lens.Lens' UpdateSnapshotResponse Prelude.Int
updateSnapshotResponse_httpStatus :: Lens' UpdateSnapshotResponse Int
updateSnapshotResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSnapshotResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateSnapshotResponse' :: UpdateSnapshotResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateSnapshotResponse
s@UpdateSnapshotResponse' {} Int
a -> UpdateSnapshotResponse
s {$sel:httpStatus:UpdateSnapshotResponse' :: Int
httpStatus = Int
a} :: UpdateSnapshotResponse)
instance Prelude.NFData UpdateSnapshotResponse where
rnf :: UpdateSnapshotResponse -> ()
rnf UpdateSnapshotResponse' {Int
Maybe SnapshotDetails
httpStatus :: Int
snapshot :: Maybe SnapshotDetails
$sel:httpStatus:UpdateSnapshotResponse' :: UpdateSnapshotResponse -> Int
$sel:snapshot:UpdateSnapshotResponse' :: UpdateSnapshotResponse -> Maybe SnapshotDetails
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe SnapshotDetails
snapshot
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus