{-# 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.UpdateBuild
(
UpdateBuild (..),
newUpdateBuild,
updateBuild_name,
updateBuild_version,
updateBuild_buildId,
UpdateBuildResponse (..),
newUpdateBuildResponse,
updateBuildResponse_build,
updateBuildResponse_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 UpdateBuild = UpdateBuild'
{
UpdateBuild -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
UpdateBuild -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
UpdateBuild -> Text
buildId :: Prelude.Text
}
deriving (UpdateBuild -> UpdateBuild -> Bool
(UpdateBuild -> UpdateBuild -> Bool)
-> (UpdateBuild -> UpdateBuild -> Bool) -> Eq UpdateBuild
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateBuild -> UpdateBuild -> Bool
$c/= :: UpdateBuild -> UpdateBuild -> Bool
== :: UpdateBuild -> UpdateBuild -> Bool
$c== :: UpdateBuild -> UpdateBuild -> Bool
Prelude.Eq, ReadPrec [UpdateBuild]
ReadPrec UpdateBuild
Int -> ReadS UpdateBuild
ReadS [UpdateBuild]
(Int -> ReadS UpdateBuild)
-> ReadS [UpdateBuild]
-> ReadPrec UpdateBuild
-> ReadPrec [UpdateBuild]
-> Read UpdateBuild
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateBuild]
$creadListPrec :: ReadPrec [UpdateBuild]
readPrec :: ReadPrec UpdateBuild
$creadPrec :: ReadPrec UpdateBuild
readList :: ReadS [UpdateBuild]
$creadList :: ReadS [UpdateBuild]
readsPrec :: Int -> ReadS UpdateBuild
$creadsPrec :: Int -> ReadS UpdateBuild
Prelude.Read, Int -> UpdateBuild -> ShowS
[UpdateBuild] -> ShowS
UpdateBuild -> String
(Int -> UpdateBuild -> ShowS)
-> (UpdateBuild -> String)
-> ([UpdateBuild] -> ShowS)
-> Show UpdateBuild
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateBuild] -> ShowS
$cshowList :: [UpdateBuild] -> ShowS
show :: UpdateBuild -> String
$cshow :: UpdateBuild -> String
showsPrec :: Int -> UpdateBuild -> ShowS
$cshowsPrec :: Int -> UpdateBuild -> ShowS
Prelude.Show, (forall x. UpdateBuild -> Rep UpdateBuild x)
-> (forall x. Rep UpdateBuild x -> UpdateBuild)
-> Generic UpdateBuild
forall x. Rep UpdateBuild x -> UpdateBuild
forall x. UpdateBuild -> Rep UpdateBuild x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateBuild x -> UpdateBuild
$cfrom :: forall x. UpdateBuild -> Rep UpdateBuild x
Prelude.Generic)
newUpdateBuild ::
Prelude.Text ->
UpdateBuild
newUpdateBuild :: Text -> UpdateBuild
newUpdateBuild Text
pBuildId_ =
UpdateBuild' :: Maybe Text -> Maybe Text -> Text -> UpdateBuild
UpdateBuild'
{ $sel:name:UpdateBuild' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:version:UpdateBuild' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:buildId:UpdateBuild' :: Text
buildId = Text
pBuildId_
}
updateBuild_name :: Lens.Lens' UpdateBuild (Prelude.Maybe Prelude.Text)
updateBuild_name :: (Maybe Text -> f (Maybe Text)) -> UpdateBuild -> f UpdateBuild
updateBuild_name = (UpdateBuild -> Maybe Text)
-> (UpdateBuild -> Maybe Text -> UpdateBuild)
-> Lens UpdateBuild UpdateBuild (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBuild' {Maybe Text
name :: Maybe Text
$sel:name:UpdateBuild' :: UpdateBuild -> Maybe Text
name} -> Maybe Text
name) (\s :: UpdateBuild
s@UpdateBuild' {} Maybe Text
a -> UpdateBuild
s {$sel:name:UpdateBuild' :: Maybe Text
name = Maybe Text
a} :: UpdateBuild)
updateBuild_version :: Lens.Lens' UpdateBuild (Prelude.Maybe Prelude.Text)
updateBuild_version :: (Maybe Text -> f (Maybe Text)) -> UpdateBuild -> f UpdateBuild
updateBuild_version = (UpdateBuild -> Maybe Text)
-> (UpdateBuild -> Maybe Text -> UpdateBuild)
-> Lens UpdateBuild UpdateBuild (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBuild' {Maybe Text
version :: Maybe Text
$sel:version:UpdateBuild' :: UpdateBuild -> Maybe Text
version} -> Maybe Text
version) (\s :: UpdateBuild
s@UpdateBuild' {} Maybe Text
a -> UpdateBuild
s {$sel:version:UpdateBuild' :: Maybe Text
version = Maybe Text
a} :: UpdateBuild)
updateBuild_buildId :: Lens.Lens' UpdateBuild Prelude.Text
updateBuild_buildId :: (Text -> f Text) -> UpdateBuild -> f UpdateBuild
updateBuild_buildId = (UpdateBuild -> Text)
-> (UpdateBuild -> Text -> UpdateBuild)
-> Lens UpdateBuild UpdateBuild Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBuild' {Text
buildId :: Text
$sel:buildId:UpdateBuild' :: UpdateBuild -> Text
buildId} -> Text
buildId) (\s :: UpdateBuild
s@UpdateBuild' {} Text
a -> UpdateBuild
s {$sel:buildId:UpdateBuild' :: Text
buildId = Text
a} :: UpdateBuild)
instance Core.AWSRequest UpdateBuild where
type AWSResponse UpdateBuild = UpdateBuildResponse
request :: UpdateBuild -> Request UpdateBuild
request = Service -> UpdateBuild -> Request UpdateBuild
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateBuild
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateBuild)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateBuild))
-> Logger
-> Service
-> Proxy UpdateBuild
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateBuild)))
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 Build -> Int -> UpdateBuildResponse
UpdateBuildResponse'
(Maybe Build -> Int -> UpdateBuildResponse)
-> Either String (Maybe Build)
-> Either String (Int -> UpdateBuildResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Build)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Build")
Either String (Int -> UpdateBuildResponse)
-> Either String Int -> Either String UpdateBuildResponse
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 UpdateBuild
instance Prelude.NFData UpdateBuild
instance Core.ToHeaders UpdateBuild where
toHeaders :: UpdateBuild -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateBuild -> 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.UpdateBuild" :: 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 UpdateBuild where
toJSON :: UpdateBuild -> Value
toJSON UpdateBuild' {Maybe Text
Text
buildId :: Text
version :: Maybe Text
name :: Maybe Text
$sel:buildId:UpdateBuild' :: UpdateBuild -> Text
$sel:version:UpdateBuild' :: UpdateBuild -> Maybe Text
$sel:name:UpdateBuild' :: UpdateBuild -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Name" 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
name,
(Text
"Version" 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
version,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"BuildId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
buildId)
]
)
instance Core.ToPath UpdateBuild where
toPath :: UpdateBuild -> ByteString
toPath = ByteString -> UpdateBuild -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateBuild where
toQuery :: UpdateBuild -> QueryString
toQuery = QueryString -> UpdateBuild -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateBuildResponse = UpdateBuildResponse'
{
UpdateBuildResponse -> Maybe Build
build :: Prelude.Maybe Build,
UpdateBuildResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateBuildResponse -> UpdateBuildResponse -> Bool
(UpdateBuildResponse -> UpdateBuildResponse -> Bool)
-> (UpdateBuildResponse -> UpdateBuildResponse -> Bool)
-> Eq UpdateBuildResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateBuildResponse -> UpdateBuildResponse -> Bool
$c/= :: UpdateBuildResponse -> UpdateBuildResponse -> Bool
== :: UpdateBuildResponse -> UpdateBuildResponse -> Bool
$c== :: UpdateBuildResponse -> UpdateBuildResponse -> Bool
Prelude.Eq, ReadPrec [UpdateBuildResponse]
ReadPrec UpdateBuildResponse
Int -> ReadS UpdateBuildResponse
ReadS [UpdateBuildResponse]
(Int -> ReadS UpdateBuildResponse)
-> ReadS [UpdateBuildResponse]
-> ReadPrec UpdateBuildResponse
-> ReadPrec [UpdateBuildResponse]
-> Read UpdateBuildResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateBuildResponse]
$creadListPrec :: ReadPrec [UpdateBuildResponse]
readPrec :: ReadPrec UpdateBuildResponse
$creadPrec :: ReadPrec UpdateBuildResponse
readList :: ReadS [UpdateBuildResponse]
$creadList :: ReadS [UpdateBuildResponse]
readsPrec :: Int -> ReadS UpdateBuildResponse
$creadsPrec :: Int -> ReadS UpdateBuildResponse
Prelude.Read, Int -> UpdateBuildResponse -> ShowS
[UpdateBuildResponse] -> ShowS
UpdateBuildResponse -> String
(Int -> UpdateBuildResponse -> ShowS)
-> (UpdateBuildResponse -> String)
-> ([UpdateBuildResponse] -> ShowS)
-> Show UpdateBuildResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateBuildResponse] -> ShowS
$cshowList :: [UpdateBuildResponse] -> ShowS
show :: UpdateBuildResponse -> String
$cshow :: UpdateBuildResponse -> String
showsPrec :: Int -> UpdateBuildResponse -> ShowS
$cshowsPrec :: Int -> UpdateBuildResponse -> ShowS
Prelude.Show, (forall x. UpdateBuildResponse -> Rep UpdateBuildResponse x)
-> (forall x. Rep UpdateBuildResponse x -> UpdateBuildResponse)
-> Generic UpdateBuildResponse
forall x. Rep UpdateBuildResponse x -> UpdateBuildResponse
forall x. UpdateBuildResponse -> Rep UpdateBuildResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateBuildResponse x -> UpdateBuildResponse
$cfrom :: forall x. UpdateBuildResponse -> Rep UpdateBuildResponse x
Prelude.Generic)
newUpdateBuildResponse ::
Prelude.Int ->
UpdateBuildResponse
newUpdateBuildResponse :: Int -> UpdateBuildResponse
newUpdateBuildResponse Int
pHttpStatus_ =
UpdateBuildResponse' :: Maybe Build -> Int -> UpdateBuildResponse
UpdateBuildResponse'
{ $sel:build:UpdateBuildResponse' :: Maybe Build
build = Maybe Build
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateBuildResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateBuildResponse_build :: Lens.Lens' UpdateBuildResponse (Prelude.Maybe Build)
updateBuildResponse_build :: (Maybe Build -> f (Maybe Build))
-> UpdateBuildResponse -> f UpdateBuildResponse
updateBuildResponse_build = (UpdateBuildResponse -> Maybe Build)
-> (UpdateBuildResponse -> Maybe Build -> UpdateBuildResponse)
-> Lens
UpdateBuildResponse UpdateBuildResponse (Maybe Build) (Maybe Build)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBuildResponse' {Maybe Build
build :: Maybe Build
$sel:build:UpdateBuildResponse' :: UpdateBuildResponse -> Maybe Build
build} -> Maybe Build
build) (\s :: UpdateBuildResponse
s@UpdateBuildResponse' {} Maybe Build
a -> UpdateBuildResponse
s {$sel:build:UpdateBuildResponse' :: Maybe Build
build = Maybe Build
a} :: UpdateBuildResponse)
updateBuildResponse_httpStatus :: Lens.Lens' UpdateBuildResponse Prelude.Int
updateBuildResponse_httpStatus :: (Int -> f Int) -> UpdateBuildResponse -> f UpdateBuildResponse
updateBuildResponse_httpStatus = (UpdateBuildResponse -> Int)
-> (UpdateBuildResponse -> Int -> UpdateBuildResponse)
-> Lens UpdateBuildResponse UpdateBuildResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBuildResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateBuildResponse' :: UpdateBuildResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateBuildResponse
s@UpdateBuildResponse' {} Int
a -> UpdateBuildResponse
s {$sel:httpStatus:UpdateBuildResponse' :: Int
httpStatus = Int
a} :: UpdateBuildResponse)
instance Prelude.NFData UpdateBuildResponse