{-# 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.DescribeBuild
(
DescribeBuild (..),
newDescribeBuild,
describeBuild_buildId,
DescribeBuildResponse (..),
newDescribeBuildResponse,
describeBuildResponse_build,
describeBuildResponse_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 DescribeBuild = DescribeBuild'
{
DescribeBuild -> Text
buildId :: Prelude.Text
}
deriving (DescribeBuild -> DescribeBuild -> Bool
(DescribeBuild -> DescribeBuild -> Bool)
-> (DescribeBuild -> DescribeBuild -> Bool) -> Eq DescribeBuild
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeBuild -> DescribeBuild -> Bool
$c/= :: DescribeBuild -> DescribeBuild -> Bool
== :: DescribeBuild -> DescribeBuild -> Bool
$c== :: DescribeBuild -> DescribeBuild -> Bool
Prelude.Eq, ReadPrec [DescribeBuild]
ReadPrec DescribeBuild
Int -> ReadS DescribeBuild
ReadS [DescribeBuild]
(Int -> ReadS DescribeBuild)
-> ReadS [DescribeBuild]
-> ReadPrec DescribeBuild
-> ReadPrec [DescribeBuild]
-> Read DescribeBuild
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeBuild]
$creadListPrec :: ReadPrec [DescribeBuild]
readPrec :: ReadPrec DescribeBuild
$creadPrec :: ReadPrec DescribeBuild
readList :: ReadS [DescribeBuild]
$creadList :: ReadS [DescribeBuild]
readsPrec :: Int -> ReadS DescribeBuild
$creadsPrec :: Int -> ReadS DescribeBuild
Prelude.Read, Int -> DescribeBuild -> ShowS
[DescribeBuild] -> ShowS
DescribeBuild -> String
(Int -> DescribeBuild -> ShowS)
-> (DescribeBuild -> String)
-> ([DescribeBuild] -> ShowS)
-> Show DescribeBuild
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeBuild] -> ShowS
$cshowList :: [DescribeBuild] -> ShowS
show :: DescribeBuild -> String
$cshow :: DescribeBuild -> String
showsPrec :: Int -> DescribeBuild -> ShowS
$cshowsPrec :: Int -> DescribeBuild -> ShowS
Prelude.Show, (forall x. DescribeBuild -> Rep DescribeBuild x)
-> (forall x. Rep DescribeBuild x -> DescribeBuild)
-> Generic DescribeBuild
forall x. Rep DescribeBuild x -> DescribeBuild
forall x. DescribeBuild -> Rep DescribeBuild x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeBuild x -> DescribeBuild
$cfrom :: forall x. DescribeBuild -> Rep DescribeBuild x
Prelude.Generic)
newDescribeBuild ::
Prelude.Text ->
DescribeBuild
newDescribeBuild :: Text -> DescribeBuild
newDescribeBuild Text
pBuildId_ =
DescribeBuild' :: Text -> DescribeBuild
DescribeBuild' {$sel:buildId:DescribeBuild' :: Text
buildId = Text
pBuildId_}
describeBuild_buildId :: Lens.Lens' DescribeBuild Prelude.Text
describeBuild_buildId :: (Text -> f Text) -> DescribeBuild -> f DescribeBuild
describeBuild_buildId = (DescribeBuild -> Text)
-> (DescribeBuild -> Text -> DescribeBuild)
-> Lens DescribeBuild DescribeBuild Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeBuild' {Text
buildId :: Text
$sel:buildId:DescribeBuild' :: DescribeBuild -> Text
buildId} -> Text
buildId) (\s :: DescribeBuild
s@DescribeBuild' {} Text
a -> DescribeBuild
s {$sel:buildId:DescribeBuild' :: Text
buildId = Text
a} :: DescribeBuild)
instance Core.AWSRequest DescribeBuild where
type
AWSResponse DescribeBuild =
DescribeBuildResponse
request :: DescribeBuild -> Request DescribeBuild
request = Service -> DescribeBuild -> Request DescribeBuild
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeBuild
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeBuild)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeBuild))
-> Logger
-> Service
-> Proxy DescribeBuild
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeBuild)))
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 -> DescribeBuildResponse
DescribeBuildResponse'
(Maybe Build -> Int -> DescribeBuildResponse)
-> Either String (Maybe Build)
-> Either String (Int -> DescribeBuildResponse)
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 -> DescribeBuildResponse)
-> Either String Int -> Either String DescribeBuildResponse
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 DescribeBuild
instance Prelude.NFData DescribeBuild
instance Core.ToHeaders DescribeBuild where
toHeaders :: DescribeBuild -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeBuild -> 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.DescribeBuild" :: 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 DescribeBuild where
toJSON :: DescribeBuild -> Value
toJSON DescribeBuild' {Text
buildId :: Text
$sel:buildId:DescribeBuild' :: DescribeBuild -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[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 DescribeBuild where
toPath :: DescribeBuild -> ByteString
toPath = ByteString -> DescribeBuild -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeBuild where
toQuery :: DescribeBuild -> QueryString
toQuery = QueryString -> DescribeBuild -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeBuildResponse = DescribeBuildResponse'
{
DescribeBuildResponse -> Maybe Build
build :: Prelude.Maybe Build,
DescribeBuildResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeBuildResponse -> DescribeBuildResponse -> Bool
(DescribeBuildResponse -> DescribeBuildResponse -> Bool)
-> (DescribeBuildResponse -> DescribeBuildResponse -> Bool)
-> Eq DescribeBuildResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeBuildResponse -> DescribeBuildResponse -> Bool
$c/= :: DescribeBuildResponse -> DescribeBuildResponse -> Bool
== :: DescribeBuildResponse -> DescribeBuildResponse -> Bool
$c== :: DescribeBuildResponse -> DescribeBuildResponse -> Bool
Prelude.Eq, ReadPrec [DescribeBuildResponse]
ReadPrec DescribeBuildResponse
Int -> ReadS DescribeBuildResponse
ReadS [DescribeBuildResponse]
(Int -> ReadS DescribeBuildResponse)
-> ReadS [DescribeBuildResponse]
-> ReadPrec DescribeBuildResponse
-> ReadPrec [DescribeBuildResponse]
-> Read DescribeBuildResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeBuildResponse]
$creadListPrec :: ReadPrec [DescribeBuildResponse]
readPrec :: ReadPrec DescribeBuildResponse
$creadPrec :: ReadPrec DescribeBuildResponse
readList :: ReadS [DescribeBuildResponse]
$creadList :: ReadS [DescribeBuildResponse]
readsPrec :: Int -> ReadS DescribeBuildResponse
$creadsPrec :: Int -> ReadS DescribeBuildResponse
Prelude.Read, Int -> DescribeBuildResponse -> ShowS
[DescribeBuildResponse] -> ShowS
DescribeBuildResponse -> String
(Int -> DescribeBuildResponse -> ShowS)
-> (DescribeBuildResponse -> String)
-> ([DescribeBuildResponse] -> ShowS)
-> Show DescribeBuildResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeBuildResponse] -> ShowS
$cshowList :: [DescribeBuildResponse] -> ShowS
show :: DescribeBuildResponse -> String
$cshow :: DescribeBuildResponse -> String
showsPrec :: Int -> DescribeBuildResponse -> ShowS
$cshowsPrec :: Int -> DescribeBuildResponse -> ShowS
Prelude.Show, (forall x. DescribeBuildResponse -> Rep DescribeBuildResponse x)
-> (forall x. Rep DescribeBuildResponse x -> DescribeBuildResponse)
-> Generic DescribeBuildResponse
forall x. Rep DescribeBuildResponse x -> DescribeBuildResponse
forall x. DescribeBuildResponse -> Rep DescribeBuildResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeBuildResponse x -> DescribeBuildResponse
$cfrom :: forall x. DescribeBuildResponse -> Rep DescribeBuildResponse x
Prelude.Generic)
newDescribeBuildResponse ::
Prelude.Int ->
DescribeBuildResponse
newDescribeBuildResponse :: Int -> DescribeBuildResponse
newDescribeBuildResponse Int
pHttpStatus_ =
DescribeBuildResponse' :: Maybe Build -> Int -> DescribeBuildResponse
DescribeBuildResponse'
{ $sel:build:DescribeBuildResponse' :: Maybe Build
build = Maybe Build
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeBuildResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeBuildResponse_build :: Lens.Lens' DescribeBuildResponse (Prelude.Maybe Build)
describeBuildResponse_build :: (Maybe Build -> f (Maybe Build))
-> DescribeBuildResponse -> f DescribeBuildResponse
describeBuildResponse_build = (DescribeBuildResponse -> Maybe Build)
-> (DescribeBuildResponse -> Maybe Build -> DescribeBuildResponse)
-> Lens
DescribeBuildResponse
DescribeBuildResponse
(Maybe Build)
(Maybe Build)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeBuildResponse' {Maybe Build
build :: Maybe Build
$sel:build:DescribeBuildResponse' :: DescribeBuildResponse -> Maybe Build
build} -> Maybe Build
build) (\s :: DescribeBuildResponse
s@DescribeBuildResponse' {} Maybe Build
a -> DescribeBuildResponse
s {$sel:build:DescribeBuildResponse' :: Maybe Build
build = Maybe Build
a} :: DescribeBuildResponse)
describeBuildResponse_httpStatus :: Lens.Lens' DescribeBuildResponse Prelude.Int
describeBuildResponse_httpStatus :: (Int -> f Int) -> DescribeBuildResponse -> f DescribeBuildResponse
describeBuildResponse_httpStatus = (DescribeBuildResponse -> Int)
-> (DescribeBuildResponse -> Int -> DescribeBuildResponse)
-> Lens DescribeBuildResponse DescribeBuildResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeBuildResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeBuildResponse' :: DescribeBuildResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeBuildResponse
s@DescribeBuildResponse' {} Int
a -> DescribeBuildResponse
s {$sel:httpStatus:DescribeBuildResponse' :: Int
httpStatus = Int
a} :: DescribeBuildResponse)
instance Prelude.NFData DescribeBuildResponse