{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.GamesParks.GetGeneratedCodeJob
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets details about a job that is generating code for a snapshot.
module Amazonka.GamesParks.GetGeneratedCodeJob
  ( -- * Creating a Request
    GetGeneratedCodeJob (..),
    newGetGeneratedCodeJob,

    -- * Request Lenses
    getGeneratedCodeJob_gameName,
    getGeneratedCodeJob_jobId,
    getGeneratedCodeJob_snapshotId,

    -- * Destructuring the Response
    GetGeneratedCodeJobResponse (..),
    newGetGeneratedCodeJobResponse,

    -- * Response Lenses
    getGeneratedCodeJobResponse_generatedCodeJob,
    getGeneratedCodeJobResponse_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

-- | /See:/ 'newGetGeneratedCodeJob' smart constructor.
data GetGeneratedCodeJob = GetGeneratedCodeJob'
  { -- | The name of the game.
    GetGeneratedCodeJob -> Text
gameName :: Prelude.Text,
    -- | The identifier of the code generation job.
    GetGeneratedCodeJob -> Text
jobId :: Prelude.Text,
    -- | The identifier of the snapshot for the code generation job.
    GetGeneratedCodeJob -> Text
snapshotId :: Prelude.Text
  }
  deriving (GetGeneratedCodeJob -> GetGeneratedCodeJob -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetGeneratedCodeJob -> GetGeneratedCodeJob -> Bool
$c/= :: GetGeneratedCodeJob -> GetGeneratedCodeJob -> Bool
== :: GetGeneratedCodeJob -> GetGeneratedCodeJob -> Bool
$c== :: GetGeneratedCodeJob -> GetGeneratedCodeJob -> Bool
Prelude.Eq, ReadPrec [GetGeneratedCodeJob]
ReadPrec GetGeneratedCodeJob
Int -> ReadS GetGeneratedCodeJob
ReadS [GetGeneratedCodeJob]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetGeneratedCodeJob]
$creadListPrec :: ReadPrec [GetGeneratedCodeJob]
readPrec :: ReadPrec GetGeneratedCodeJob
$creadPrec :: ReadPrec GetGeneratedCodeJob
readList :: ReadS [GetGeneratedCodeJob]
$creadList :: ReadS [GetGeneratedCodeJob]
readsPrec :: Int -> ReadS GetGeneratedCodeJob
$creadsPrec :: Int -> ReadS GetGeneratedCodeJob
Prelude.Read, Int -> GetGeneratedCodeJob -> ShowS
[GetGeneratedCodeJob] -> ShowS
GetGeneratedCodeJob -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetGeneratedCodeJob] -> ShowS
$cshowList :: [GetGeneratedCodeJob] -> ShowS
show :: GetGeneratedCodeJob -> String
$cshow :: GetGeneratedCodeJob -> String
showsPrec :: Int -> GetGeneratedCodeJob -> ShowS
$cshowsPrec :: Int -> GetGeneratedCodeJob -> ShowS
Prelude.Show, forall x. Rep GetGeneratedCodeJob x -> GetGeneratedCodeJob
forall x. GetGeneratedCodeJob -> Rep GetGeneratedCodeJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetGeneratedCodeJob x -> GetGeneratedCodeJob
$cfrom :: forall x. GetGeneratedCodeJob -> Rep GetGeneratedCodeJob x
Prelude.Generic)

-- |
-- Create a value of 'GetGeneratedCodeJob' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'gameName', 'getGeneratedCodeJob_gameName' - The name of the game.
--
-- 'jobId', 'getGeneratedCodeJob_jobId' - The identifier of the code generation job.
--
-- 'snapshotId', 'getGeneratedCodeJob_snapshotId' - The identifier of the snapshot for the code generation job.
newGetGeneratedCodeJob ::
  -- | 'gameName'
  Prelude.Text ->
  -- | 'jobId'
  Prelude.Text ->
  -- | 'snapshotId'
  Prelude.Text ->
  GetGeneratedCodeJob
newGetGeneratedCodeJob :: Text -> Text -> Text -> GetGeneratedCodeJob
newGetGeneratedCodeJob
  Text
pGameName_
  Text
pJobId_
  Text
pSnapshotId_ =
    GetGeneratedCodeJob'
      { $sel:gameName:GetGeneratedCodeJob' :: Text
gameName = Text
pGameName_,
        $sel:jobId:GetGeneratedCodeJob' :: Text
jobId = Text
pJobId_,
        $sel:snapshotId:GetGeneratedCodeJob' :: Text
snapshotId = Text
pSnapshotId_
      }

-- | The name of the game.
getGeneratedCodeJob_gameName :: Lens.Lens' GetGeneratedCodeJob Prelude.Text
getGeneratedCodeJob_gameName :: Lens' GetGeneratedCodeJob Text
getGeneratedCodeJob_gameName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGeneratedCodeJob' {Text
gameName :: Text
$sel:gameName:GetGeneratedCodeJob' :: GetGeneratedCodeJob -> Text
gameName} -> Text
gameName) (\s :: GetGeneratedCodeJob
s@GetGeneratedCodeJob' {} Text
a -> GetGeneratedCodeJob
s {$sel:gameName:GetGeneratedCodeJob' :: Text
gameName = Text
a} :: GetGeneratedCodeJob)

-- | The identifier of the code generation job.
getGeneratedCodeJob_jobId :: Lens.Lens' GetGeneratedCodeJob Prelude.Text
getGeneratedCodeJob_jobId :: Lens' GetGeneratedCodeJob Text
getGeneratedCodeJob_jobId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGeneratedCodeJob' {Text
jobId :: Text
$sel:jobId:GetGeneratedCodeJob' :: GetGeneratedCodeJob -> Text
jobId} -> Text
jobId) (\s :: GetGeneratedCodeJob
s@GetGeneratedCodeJob' {} Text
a -> GetGeneratedCodeJob
s {$sel:jobId:GetGeneratedCodeJob' :: Text
jobId = Text
a} :: GetGeneratedCodeJob)

-- | The identifier of the snapshot for the code generation job.
getGeneratedCodeJob_snapshotId :: Lens.Lens' GetGeneratedCodeJob Prelude.Text
getGeneratedCodeJob_snapshotId :: Lens' GetGeneratedCodeJob Text
getGeneratedCodeJob_snapshotId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGeneratedCodeJob' {Text
snapshotId :: Text
$sel:snapshotId:GetGeneratedCodeJob' :: GetGeneratedCodeJob -> Text
snapshotId} -> Text
snapshotId) (\s :: GetGeneratedCodeJob
s@GetGeneratedCodeJob' {} Text
a -> GetGeneratedCodeJob
s {$sel:snapshotId:GetGeneratedCodeJob' :: Text
snapshotId = Text
a} :: GetGeneratedCodeJob)

instance Core.AWSRequest GetGeneratedCodeJob where
  type
    AWSResponse GetGeneratedCodeJob =
      GetGeneratedCodeJobResponse
  request :: (Service -> Service)
-> GetGeneratedCodeJob -> Request GetGeneratedCodeJob
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 GetGeneratedCodeJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetGeneratedCodeJob)))
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 GeneratedCodeJobDetails -> Int -> GetGeneratedCodeJobResponse
GetGeneratedCodeJobResponse'
            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
"GeneratedCodeJob")
            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 GetGeneratedCodeJob where
  hashWithSalt :: Int -> GetGeneratedCodeJob -> Int
hashWithSalt Int
_salt GetGeneratedCodeJob' {Text
snapshotId :: Text
jobId :: Text
gameName :: Text
$sel:snapshotId:GetGeneratedCodeJob' :: GetGeneratedCodeJob -> Text
$sel:jobId:GetGeneratedCodeJob' :: GetGeneratedCodeJob -> Text
$sel:gameName:GetGeneratedCodeJob' :: GetGeneratedCodeJob -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
gameName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
jobId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
snapshotId

instance Prelude.NFData GetGeneratedCodeJob where
  rnf :: GetGeneratedCodeJob -> ()
rnf GetGeneratedCodeJob' {Text
snapshotId :: Text
jobId :: Text
gameName :: Text
$sel:snapshotId:GetGeneratedCodeJob' :: GetGeneratedCodeJob -> Text
$sel:jobId:GetGeneratedCodeJob' :: GetGeneratedCodeJob -> Text
$sel:gameName:GetGeneratedCodeJob' :: GetGeneratedCodeJob -> Text
..} =
    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
jobId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
snapshotId

instance Data.ToHeaders GetGeneratedCodeJob where
  toHeaders :: GetGeneratedCodeJob -> 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 GetGeneratedCodeJob where
  toPath :: GetGeneratedCodeJob -> ByteString
toPath GetGeneratedCodeJob' {Text
snapshotId :: Text
jobId :: Text
gameName :: Text
$sel:snapshotId:GetGeneratedCodeJob' :: GetGeneratedCodeJob -> Text
$sel:jobId:GetGeneratedCodeJob' :: GetGeneratedCodeJob -> Text
$sel:gameName:GetGeneratedCodeJob' :: GetGeneratedCodeJob -> 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,
        ByteString
"/generated-sdk-code-job/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
jobId
      ]

instance Data.ToQuery GetGeneratedCodeJob where
  toQuery :: GetGeneratedCodeJob -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newGetGeneratedCodeJobResponse' smart constructor.
data GetGeneratedCodeJobResponse = GetGeneratedCodeJobResponse'
  { -- | Details about the generated code job.
    GetGeneratedCodeJobResponse -> Maybe GeneratedCodeJobDetails
generatedCodeJob :: Prelude.Maybe GeneratedCodeJobDetails,
    -- | The response's http status code.
    GetGeneratedCodeJobResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetGeneratedCodeJobResponse -> GetGeneratedCodeJobResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetGeneratedCodeJobResponse -> GetGeneratedCodeJobResponse -> Bool
$c/= :: GetGeneratedCodeJobResponse -> GetGeneratedCodeJobResponse -> Bool
== :: GetGeneratedCodeJobResponse -> GetGeneratedCodeJobResponse -> Bool
$c== :: GetGeneratedCodeJobResponse -> GetGeneratedCodeJobResponse -> Bool
Prelude.Eq, ReadPrec [GetGeneratedCodeJobResponse]
ReadPrec GetGeneratedCodeJobResponse
Int -> ReadS GetGeneratedCodeJobResponse
ReadS [GetGeneratedCodeJobResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetGeneratedCodeJobResponse]
$creadListPrec :: ReadPrec [GetGeneratedCodeJobResponse]
readPrec :: ReadPrec GetGeneratedCodeJobResponse
$creadPrec :: ReadPrec GetGeneratedCodeJobResponse
readList :: ReadS [GetGeneratedCodeJobResponse]
$creadList :: ReadS [GetGeneratedCodeJobResponse]
readsPrec :: Int -> ReadS GetGeneratedCodeJobResponse
$creadsPrec :: Int -> ReadS GetGeneratedCodeJobResponse
Prelude.Read, Int -> GetGeneratedCodeJobResponse -> ShowS
[GetGeneratedCodeJobResponse] -> ShowS
GetGeneratedCodeJobResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetGeneratedCodeJobResponse] -> ShowS
$cshowList :: [GetGeneratedCodeJobResponse] -> ShowS
show :: GetGeneratedCodeJobResponse -> String
$cshow :: GetGeneratedCodeJobResponse -> String
showsPrec :: Int -> GetGeneratedCodeJobResponse -> ShowS
$cshowsPrec :: Int -> GetGeneratedCodeJobResponse -> ShowS
Prelude.Show, forall x.
Rep GetGeneratedCodeJobResponse x -> GetGeneratedCodeJobResponse
forall x.
GetGeneratedCodeJobResponse -> Rep GetGeneratedCodeJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetGeneratedCodeJobResponse x -> GetGeneratedCodeJobResponse
$cfrom :: forall x.
GetGeneratedCodeJobResponse -> Rep GetGeneratedCodeJobResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetGeneratedCodeJobResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'generatedCodeJob', 'getGeneratedCodeJobResponse_generatedCodeJob' - Details about the generated code job.
--
-- 'httpStatus', 'getGeneratedCodeJobResponse_httpStatus' - The response's http status code.
newGetGeneratedCodeJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetGeneratedCodeJobResponse
newGetGeneratedCodeJobResponse :: Int -> GetGeneratedCodeJobResponse
newGetGeneratedCodeJobResponse Int
pHttpStatus_ =
  GetGeneratedCodeJobResponse'
    { $sel:generatedCodeJob:GetGeneratedCodeJobResponse' :: Maybe GeneratedCodeJobDetails
generatedCodeJob =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetGeneratedCodeJobResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Details about the generated code job.
getGeneratedCodeJobResponse_generatedCodeJob :: Lens.Lens' GetGeneratedCodeJobResponse (Prelude.Maybe GeneratedCodeJobDetails)
getGeneratedCodeJobResponse_generatedCodeJob :: Lens' GetGeneratedCodeJobResponse (Maybe GeneratedCodeJobDetails)
getGeneratedCodeJobResponse_generatedCodeJob = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGeneratedCodeJobResponse' {Maybe GeneratedCodeJobDetails
generatedCodeJob :: Maybe GeneratedCodeJobDetails
$sel:generatedCodeJob:GetGeneratedCodeJobResponse' :: GetGeneratedCodeJobResponse -> Maybe GeneratedCodeJobDetails
generatedCodeJob} -> Maybe GeneratedCodeJobDetails
generatedCodeJob) (\s :: GetGeneratedCodeJobResponse
s@GetGeneratedCodeJobResponse' {} Maybe GeneratedCodeJobDetails
a -> GetGeneratedCodeJobResponse
s {$sel:generatedCodeJob:GetGeneratedCodeJobResponse' :: Maybe GeneratedCodeJobDetails
generatedCodeJob = Maybe GeneratedCodeJobDetails
a} :: GetGeneratedCodeJobResponse)

-- | The response's http status code.
getGeneratedCodeJobResponse_httpStatus :: Lens.Lens' GetGeneratedCodeJobResponse Prelude.Int
getGeneratedCodeJobResponse_httpStatus :: Lens' GetGeneratedCodeJobResponse Int
getGeneratedCodeJobResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGeneratedCodeJobResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetGeneratedCodeJobResponse' :: GetGeneratedCodeJobResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetGeneratedCodeJobResponse
s@GetGeneratedCodeJobResponse' {} Int
a -> GetGeneratedCodeJobResponse
s {$sel:httpStatus:GetGeneratedCodeJobResponse' :: Int
httpStatus = Int
a} :: GetGeneratedCodeJobResponse)

instance Prelude.NFData GetGeneratedCodeJobResponse where
  rnf :: GetGeneratedCodeJobResponse -> ()
rnf GetGeneratedCodeJobResponse' {Int
Maybe GeneratedCodeJobDetails
httpStatus :: Int
generatedCodeJob :: Maybe GeneratedCodeJobDetails
$sel:httpStatus:GetGeneratedCodeJobResponse' :: GetGeneratedCodeJobResponse -> Int
$sel:generatedCodeJob:GetGeneratedCodeJobResponse' :: GetGeneratedCodeJobResponse -> Maybe GeneratedCodeJobDetails
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe GeneratedCodeJobDetails
generatedCodeJob
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus